Jiawei Ou | 651b92e | 2018-06-29 15:46:44 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 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_PEERCONNECTIONINTERFACE_H_ |
| 12 | #define API_TEST_MOCK_PEERCONNECTIONINTERFACE_H_ |
| 13 | |
| 14 | #include <memory> |
| 15 | #include <string> |
| 16 | #include <utility> |
| 17 | #include <vector> |
| 18 | |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame^] | 19 | #include "api/peer_connection_interface.h" |
Jiawei Ou | 651b92e | 2018-06-29 15:46:44 -0700 | [diff] [blame] | 20 | #include "test/gmock.h" |
| 21 | |
| 22 | namespace webrtc { |
| 23 | |
| 24 | class MockPeerConnectionInterface |
| 25 | : public rtc::RefCountedObject<webrtc::PeerConnectionInterface> { |
| 26 | public: |
| 27 | // PeerConnectionInterface |
| 28 | MOCK_METHOD0(local_streams, rtc::scoped_refptr<StreamCollectionInterface>()); |
| 29 | MOCK_METHOD0(remote_streams, rtc::scoped_refptr<StreamCollectionInterface>()); |
| 30 | MOCK_METHOD1(AddStream, bool(MediaStreamInterface*)); |
| 31 | MOCK_METHOD1(RemoveStream, void(MediaStreamInterface*)); |
| 32 | MOCK_METHOD2(AddTrack, |
| 33 | RTCErrorOr<rtc::scoped_refptr<RtpSenderInterface>>( |
| 34 | rtc::scoped_refptr<MediaStreamTrackInterface>, |
| 35 | const std::vector<std::string>&)); |
| 36 | MOCK_METHOD2(AddTrack, |
| 37 | rtc::scoped_refptr<RtpSenderInterface>( |
| 38 | MediaStreamTrackInterface*, |
| 39 | std::vector<MediaStreamInterface*>)); |
| 40 | MOCK_METHOD1(RemoveTrack, bool(RtpSenderInterface*)); |
| 41 | MOCK_METHOD1(AddTransceiver, |
| 42 | RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>( |
| 43 | rtc::scoped_refptr<MediaStreamTrackInterface>)); |
| 44 | MOCK_METHOD2(AddTransceiver, |
| 45 | RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>( |
| 46 | rtc::scoped_refptr<MediaStreamTrackInterface>, |
| 47 | const RtpTransceiverInit&)); |
| 48 | MOCK_METHOD1(AddTransceiver, |
| 49 | RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>( |
| 50 | cricket::MediaType)); |
| 51 | MOCK_METHOD2(AddTransceiver, |
| 52 | RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>( |
| 53 | cricket::MediaType, |
| 54 | const RtpTransceiverInit&)); |
| 55 | MOCK_METHOD2(CreateSender, |
| 56 | rtc::scoped_refptr<RtpSenderInterface>(const std::string&, |
| 57 | const std::string&)); |
| 58 | MOCK_CONST_METHOD0(GetSenders, |
| 59 | std::vector<rtc::scoped_refptr<RtpSenderInterface>>()); |
| 60 | MOCK_CONST_METHOD0(GetReceivers, |
| 61 | std::vector<rtc::scoped_refptr<RtpReceiverInterface>>()); |
| 62 | MOCK_CONST_METHOD0( |
| 63 | GetTransceivers, |
| 64 | std::vector<rtc::scoped_refptr<RtpTransceiverInterface>>()); |
| 65 | MOCK_METHOD3(GetStats, |
| 66 | bool(StatsObserver*, |
| 67 | MediaStreamTrackInterface*, |
| 68 | StatsOutputLevel)); |
| 69 | MOCK_METHOD1(GetStats, void(RTCStatsCollectorCallback*)); |
| 70 | MOCK_METHOD2(GetStats, |
| 71 | void(rtc::scoped_refptr<RtpSenderInterface>, |
| 72 | rtc::scoped_refptr<RTCStatsCollectorCallback>)); |
| 73 | MOCK_METHOD2(GetStats, |
| 74 | void(rtc::scoped_refptr<RtpReceiverInterface>, |
| 75 | rtc::scoped_refptr<RTCStatsCollectorCallback>)); |
| 76 | MOCK_METHOD0(ClearStatsCache, void()); |
| 77 | MOCK_METHOD2( |
| 78 | CreateDataChannel, |
| 79 | rtc::scoped_refptr<DataChannelInterface>(const std::string&, |
| 80 | const DataChannelInit*)); |
| 81 | MOCK_CONST_METHOD0(local_description, const SessionDescriptionInterface*()); |
| 82 | MOCK_CONST_METHOD0(remote_description, const SessionDescriptionInterface*()); |
| 83 | MOCK_CONST_METHOD0(current_local_description, |
| 84 | const SessionDescriptionInterface*()); |
| 85 | MOCK_CONST_METHOD0(current_remote_description, |
| 86 | const SessionDescriptionInterface*()); |
| 87 | MOCK_CONST_METHOD0(pending_local_description, |
| 88 | const SessionDescriptionInterface*()); |
| 89 | MOCK_CONST_METHOD0(pending_remote_description, |
| 90 | const SessionDescriptionInterface*()); |
| 91 | MOCK_METHOD2(CreateOffer, |
| 92 | void(CreateSessionDescriptionObserver*, |
Jiawei Ou | 651b92e | 2018-06-29 15:46:44 -0700 | [diff] [blame] | 93 | const RTCOfferAnswerOptions&)); |
| 94 | MOCK_METHOD2(CreateAnswer, |
| 95 | void(CreateSessionDescriptionObserver*, |
| 96 | const RTCOfferAnswerOptions&)); |
Jiawei Ou | 651b92e | 2018-06-29 15:46:44 -0700 | [diff] [blame] | 97 | MOCK_METHOD2(SetLocalDescription, |
| 98 | void(SetSessionDescriptionObserver*, |
| 99 | SessionDescriptionInterface*)); |
| 100 | MOCK_METHOD2(SetRemoteDescription, |
| 101 | void(SetSessionDescriptionObserver*, |
| 102 | SessionDescriptionInterface*)); |
| 103 | MOCK_METHOD2(SetRemoteDescription, |
| 104 | void(std::unique_ptr<SessionDescriptionInterface>, |
| 105 | rtc::scoped_refptr<SetRemoteDescriptionObserverInterface>)); |
| 106 | MOCK_METHOD0(GetConfiguration, PeerConnectionInterface::RTCConfiguration()); |
| 107 | MOCK_METHOD2(SetConfiguration, |
| 108 | bool(const PeerConnectionInterface::RTCConfiguration&, |
| 109 | RTCError*)); |
| 110 | MOCK_METHOD1(SetConfiguration, |
| 111 | bool(const PeerConnectionInterface::RTCConfiguration&)); |
| 112 | MOCK_METHOD1(AddIceCandidate, bool(const IceCandidateInterface*)); |
| 113 | MOCK_METHOD1(RemoveIceCandidates, |
| 114 | bool(const std::vector<cricket::Candidate>&)); |
Jiawei Ou | 651b92e | 2018-06-29 15:46:44 -0700 | [diff] [blame] | 115 | MOCK_METHOD1(SetBitrate, RTCError(const BitrateSettings&)); |
| 116 | MOCK_METHOD1(SetBitrate, RTCError(const BitrateParameters&)); |
| 117 | MOCK_METHOD1(SetBitrateAllocationStrategy, |
| 118 | void(std::unique_ptr<rtc::BitrateAllocationStrategy>)); |
| 119 | MOCK_METHOD1(SetAudioPlayout, void(bool)); |
| 120 | MOCK_METHOD1(SetAudioRecording, void(bool)); |
| 121 | MOCK_METHOD0(signaling_state, SignalingState()); |
| 122 | MOCK_METHOD0(ice_connection_state, IceConnectionState()); |
| 123 | MOCK_METHOD0(ice_gathering_state, IceGatheringState()); |
| 124 | MOCK_METHOD2(StartRtcEventLog, bool(rtc::PlatformFile, int64_t)); |
| 125 | MOCK_METHOD2(StartRtcEventLog, |
| 126 | bool(std::unique_ptr<RtcEventLogOutput>, int64_t)); |
| 127 | MOCK_METHOD0(StopRtcEventLog, void()); |
| 128 | MOCK_METHOD0(Close, void()); |
| 129 | }; |
| 130 | |
| 131 | } // namespace webrtc |
| 132 | |
| 133 | #endif // API_TEST_MOCK_PEERCONNECTIONINTERFACE_H_ |