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_PEER_CONNECTION_FACTORY_INTERFACE_H_ 12 #define API_TEST_MOCK_PEER_CONNECTION_FACTORY_INTERFACE_H_ 13 14 #include <memory> 15 #include <string> 16 17 #include "api/peer_connection_interface.h" 18 #include "test/gmock.h" 19 20 namespace webrtc { 21 22 class MockPeerConnectionFactoryInterface 23 : public rtc::RefCountedObject<webrtc::PeerConnectionFactoryInterface> { 24 public: Create()25 static rtc::scoped_refptr<MockPeerConnectionFactoryInterface> Create() { 26 return rtc::scoped_refptr<MockPeerConnectionFactoryInterface>( 27 new MockPeerConnectionFactoryInterface()); 28 } 29 30 MOCK_METHOD(void, SetOptions, (const Options&), (override)); 31 MOCK_METHOD(rtc::scoped_refptr<PeerConnectionInterface>, 32 CreatePeerConnection, 33 (const PeerConnectionInterface::RTCConfiguration&, 34 PeerConnectionDependencies), 35 (override)); 36 MOCK_METHOD(RTCErrorOr<rtc::scoped_refptr<PeerConnectionInterface>>, 37 CreatePeerConnectionOrError, 38 (const PeerConnectionInterface::RTCConfiguration&, 39 PeerConnectionDependencies), 40 (override)); 41 MOCK_METHOD(rtc::scoped_refptr<PeerConnectionInterface>, 42 CreatePeerConnection, 43 (const PeerConnectionInterface::RTCConfiguration&, 44 std::unique_ptr<cricket::PortAllocator>, 45 std::unique_ptr<rtc::RTCCertificateGeneratorInterface>, 46 PeerConnectionObserver*), 47 (override)); 48 MOCK_METHOD(RtpCapabilities, 49 GetRtpSenderCapabilities, 50 (cricket::MediaType), 51 (const, override)); 52 MOCK_METHOD(RtpCapabilities, 53 GetRtpReceiverCapabilities, 54 (cricket::MediaType), 55 (const, override)); 56 MOCK_METHOD(rtc::scoped_refptr<MediaStreamInterface>, 57 CreateLocalMediaStream, 58 (const std::string&), 59 (override)); 60 MOCK_METHOD(rtc::scoped_refptr<AudioSourceInterface>, 61 CreateAudioSource, 62 (const cricket::AudioOptions&), 63 (override)); 64 MOCK_METHOD(rtc::scoped_refptr<VideoTrackInterface>, 65 CreateVideoTrack, 66 (const std::string&, VideoTrackSourceInterface*), 67 (override)); 68 MOCK_METHOD(rtc::scoped_refptr<AudioTrackInterface>, 69 CreateAudioTrack, 70 (const std::string&, AudioSourceInterface*), 71 (override)); 72 MOCK_METHOD(bool, StartAecDump, (FILE*, int64_t), (override)); 73 MOCK_METHOD(void, StopAecDump, (), (override)); 74 75 protected: 76 MockPeerConnectionFactoryInterface() = default; 77 }; 78 79 } // namespace webrtc 80 81 #endif // API_TEST_MOCK_PEER_CONNECTION_FACTORY_INTERFACE_H_ 82