xref: /aosp_15_r20/external/webrtc/api/test/mock_data_channel.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright 2020 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef API_TEST_MOCK_DATA_CHANNEL_H_
12 #define API_TEST_MOCK_DATA_CHANNEL_H_
13 
14 #include <string>
15 
16 #include "api/data_channel_interface.h"
17 #include "test/gmock.h"
18 
19 namespace webrtc {
20 
21 class MockDataChannelInterface
22     : public rtc::RefCountedObject<webrtc::DataChannelInterface> {
23  public:
Create()24   static rtc::scoped_refptr<MockDataChannelInterface> Create() {
25     return rtc::scoped_refptr<MockDataChannelInterface>(
26         new MockDataChannelInterface());
27   }
28 
29   MOCK_METHOD(void,
30               RegisterObserver,
31               (DataChannelObserver * observer),
32               (override));
33   MOCK_METHOD(void, UnregisterObserver, (), (override));
34   MOCK_METHOD(std::string, label, (), (const, override));
35   MOCK_METHOD(bool, reliable, (), (const, override));
36   MOCK_METHOD(bool, ordered, (), (const, override));
37   MOCK_METHOD(uint16_t, maxRetransmitTime, (), (const, override));
38   MOCK_METHOD(uint16_t, maxRetransmits, (), (const, override));
39   MOCK_METHOD(absl::optional<int>, maxRetransmitsOpt, (), (const, override));
40   MOCK_METHOD(absl::optional<int>, maxPacketLifeTime, (), (const, override));
41   MOCK_METHOD(std::string, protocol, (), (const, override));
42   MOCK_METHOD(bool, negotiated, (), (const, override));
43   MOCK_METHOD(int, id, (), (const, override));
44   MOCK_METHOD(Priority, priority, (), (const, override));
45   MOCK_METHOD(DataState, state, (), (const, override));
46   MOCK_METHOD(RTCError, error, (), (const, override));
47   MOCK_METHOD(uint32_t, messages_sent, (), (const, override));
48   MOCK_METHOD(uint64_t, bytes_sent, (), (const, override));
49   MOCK_METHOD(uint32_t, messages_received, (), (const, override));
50   MOCK_METHOD(uint64_t, bytes_received, (), (const, override));
51   MOCK_METHOD(uint64_t, buffered_amount, (), (const, override));
52   MOCK_METHOD(void, Close, (), (override));
53   MOCK_METHOD(bool, Send, (const DataBuffer& buffer), (override));
54 
55  protected:
56   MockDataChannelInterface() = default;
57 };
58 
59 }  // namespace webrtc
60 
61 #endif  // API_TEST_MOCK_DATA_CHANNEL_H_
62