xref: /aosp_15_r20/external/webrtc/pc/test/mock_channel_interface.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright 2018 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 PC_TEST_MOCK_CHANNEL_INTERFACE_H_
12 #define PC_TEST_MOCK_CHANNEL_INTERFACE_H_
13 
14 #include <string>
15 #include <vector>
16 
17 #include "pc/channel_interface.h"
18 #include "test/gmock.h"
19 
20 namespace cricket {
21 
22 // Mock class for BaseChannel.
23 // Use this class in unit tests to avoid dependecy on a specific
24 // implementation of BaseChannel.
25 class MockChannelInterface : public cricket::ChannelInterface {
26  public:
27   MOCK_METHOD(cricket::MediaType, media_type, (), (const, override));
28   MOCK_METHOD(MediaChannel*, media_channel, (), (const, override));
29   MOCK_METHOD(VoiceMediaChannel*, voice_media_channel, (), (const, override));
30   MOCK_METHOD(VideoMediaChannel*, video_media_channel, (), (const, override));
31   MOCK_METHOD(absl::string_view, transport_name, (), (const, override));
32   MOCK_METHOD(const std::string&, mid, (), (const, override));
33   MOCK_METHOD(void, Enable, (bool), (override));
34   MOCK_METHOD(void,
35               SetFirstPacketReceivedCallback,
36               (std::function<void()>),
37               (override));
38   MOCK_METHOD(bool,
39               SetLocalContent,
40               (const cricket::MediaContentDescription*,
41                webrtc::SdpType,
42                std::string&),
43               (override));
44   MOCK_METHOD(bool,
45               SetRemoteContent,
46               (const cricket::MediaContentDescription*,
47                webrtc::SdpType,
48                std::string&),
49               (override));
50   MOCK_METHOD(bool, SetPayloadTypeDemuxingEnabled, (bool), (override));
51   MOCK_METHOD(const std::vector<StreamParams>&,
52               local_streams,
53               (),
54               (const, override));
55   MOCK_METHOD(const std::vector<StreamParams>&,
56               remote_streams,
57               (),
58               (const, override));
59   MOCK_METHOD(bool,
60               SetRtpTransport,
61               (webrtc::RtpTransportInternal*),
62               (override));
63 };
64 
65 }  // namespace cricket
66 
67 #endif  // PC_TEST_MOCK_CHANNEL_INTERFACE_H_
68