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> |
Niels Möller | 7b04a91 | 2019-09-13 15:41:21 +0200 | [diff] [blame] | 16 | #include <type_traits> |
Jiawei Ou | 651b92e | 2018-06-29 15:46:44 -0700 | [diff] [blame] | 17 | #include <utility> |
| 18 | #include <vector> |
| 19 | |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 20 | #include "api/peer_connection_interface.h" |
Harald Alvestrand | 15845af | 2019-03-05 09:50:57 +0100 | [diff] [blame] | 21 | #include "api/sctp_transport_interface.h" |
Jiawei Ou | 651b92e | 2018-06-29 15:46:44 -0700 | [diff] [blame] | 22 | #include "test/gmock.h" |
| 23 | |
| 24 | namespace webrtc { |
| 25 | |
| 26 | class MockPeerConnectionInterface |
| 27 | : public rtc::RefCountedObject<webrtc::PeerConnectionInterface> { |
| 28 | public: |
| 29 | // PeerConnectionInterface |
Danil Chapovalov | fc11519 | 2020-05-08 15:03:03 +0200 | [diff] [blame^] | 30 | MOCK_METHOD(rtc::scoped_refptr<StreamCollectionInterface>, |
| 31 | local_streams, |
| 32 | (), |
| 33 | (override)); |
| 34 | MOCK_METHOD(rtc::scoped_refptr<StreamCollectionInterface>, |
| 35 | remote_streams, |
| 36 | (), |
| 37 | (override)); |
| 38 | MOCK_METHOD(bool, AddStream, (MediaStreamInterface*), (override)); |
| 39 | MOCK_METHOD(void, RemoveStream, (MediaStreamInterface*), (override)); |
| 40 | MOCK_METHOD(RTCErrorOr<rtc::scoped_refptr<RtpSenderInterface>>, |
| 41 | AddTrack, |
| 42 | (rtc::scoped_refptr<MediaStreamTrackInterface>, |
| 43 | const std::vector<std::string>&), |
| 44 | (override)); |
| 45 | MOCK_METHOD(bool, RemoveTrack, (RtpSenderInterface*), (override)); |
| 46 | MOCK_METHOD(RTCError, |
| 47 | RemoveTrackNew, |
| 48 | (rtc::scoped_refptr<RtpSenderInterface>), |
| 49 | (override)); |
| 50 | MOCK_METHOD(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>, |
| 51 | AddTransceiver, |
| 52 | (rtc::scoped_refptr<MediaStreamTrackInterface>), |
| 53 | (override)); |
| 54 | MOCK_METHOD(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>, |
| 55 | AddTransceiver, |
| 56 | (rtc::scoped_refptr<MediaStreamTrackInterface>, |
| 57 | const RtpTransceiverInit&), |
| 58 | (override)); |
| 59 | MOCK_METHOD(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>, |
| 60 | AddTransceiver, |
| 61 | (cricket::MediaType), |
| 62 | (override)); |
| 63 | MOCK_METHOD(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>, |
| 64 | AddTransceiver, |
| 65 | (cricket::MediaType, const RtpTransceiverInit&), |
| 66 | (override)); |
| 67 | MOCK_METHOD(rtc::scoped_refptr<RtpSenderInterface>, |
| 68 | CreateSender, |
| 69 | (const std::string&, const std::string&), |
| 70 | (override)); |
| 71 | MOCK_METHOD(std::vector<rtc::scoped_refptr<RtpSenderInterface>>, |
| 72 | GetSenders, |
| 73 | (), |
| 74 | (const override)); |
| 75 | MOCK_METHOD(std::vector<rtc::scoped_refptr<RtpReceiverInterface>>, |
| 76 | GetReceivers, |
| 77 | (), |
| 78 | (const override)); |
| 79 | MOCK_METHOD(std::vector<rtc::scoped_refptr<RtpTransceiverInterface>>, |
| 80 | GetTransceivers, |
| 81 | (), |
| 82 | (const override)); |
| 83 | MOCK_METHOD(bool, |
| 84 | GetStats, |
| 85 | (StatsObserver*, MediaStreamTrackInterface*, StatsOutputLevel), |
| 86 | (override)); |
| 87 | MOCK_METHOD(void, GetStats, (RTCStatsCollectorCallback*), (override)); |
| 88 | MOCK_METHOD(void, |
| 89 | GetStats, |
| 90 | (rtc::scoped_refptr<RtpSenderInterface>, |
| 91 | rtc::scoped_refptr<RTCStatsCollectorCallback>), |
| 92 | (override)); |
| 93 | MOCK_METHOD(void, |
| 94 | GetStats, |
| 95 | (rtc::scoped_refptr<RtpReceiverInterface>, |
| 96 | rtc::scoped_refptr<RTCStatsCollectorCallback>), |
| 97 | (override)); |
| 98 | MOCK_METHOD(void, ClearStatsCache, (), (override)); |
| 99 | MOCK_METHOD(rtc::scoped_refptr<SctpTransportInterface>, |
| 100 | GetSctpTransport, |
| 101 | (), |
| 102 | (const override)); |
| 103 | MOCK_METHOD(rtc::scoped_refptr<DataChannelInterface>, |
| 104 | CreateDataChannel, |
| 105 | (const std::string&, const DataChannelInit*), |
| 106 | (override)); |
| 107 | MOCK_METHOD(const SessionDescriptionInterface*, |
| 108 | local_description, |
| 109 | (), |
| 110 | (const override)); |
| 111 | MOCK_METHOD(const SessionDescriptionInterface*, |
| 112 | remote_description, |
| 113 | (), |
| 114 | (const override)); |
| 115 | MOCK_METHOD(const SessionDescriptionInterface*, |
| 116 | current_local_description, |
| 117 | (), |
| 118 | (const override)); |
| 119 | MOCK_METHOD(const SessionDescriptionInterface*, |
| 120 | current_remote_description, |
| 121 | (), |
| 122 | (const override)); |
| 123 | MOCK_METHOD(const SessionDescriptionInterface*, |
| 124 | pending_local_description, |
| 125 | (), |
| 126 | (const override)); |
| 127 | MOCK_METHOD(const SessionDescriptionInterface*, |
| 128 | pending_remote_description, |
| 129 | (), |
| 130 | (const override)); |
| 131 | MOCK_METHOD(void, RestartIce, (), (override)); |
| 132 | MOCK_METHOD(void, |
| 133 | CreateOffer, |
| 134 | (CreateSessionDescriptionObserver*, const RTCOfferAnswerOptions&), |
| 135 | (override)); |
| 136 | MOCK_METHOD(void, |
| 137 | CreateAnswer, |
| 138 | (CreateSessionDescriptionObserver*, const RTCOfferAnswerOptions&), |
| 139 | (override)); |
| 140 | MOCK_METHOD(void, |
| 141 | SetLocalDescription, |
| 142 | (SetSessionDescriptionObserver*, SessionDescriptionInterface*), |
| 143 | (override)); |
| 144 | MOCK_METHOD(void, |
| 145 | SetRemoteDescription, |
| 146 | (SetSessionDescriptionObserver*, SessionDescriptionInterface*), |
| 147 | (override)); |
| 148 | MOCK_METHOD(void, |
| 149 | SetRemoteDescription, |
| 150 | (std::unique_ptr<SessionDescriptionInterface>, |
| 151 | rtc::scoped_refptr<SetRemoteDescriptionObserverInterface>), |
| 152 | (override)); |
| 153 | MOCK_METHOD(PeerConnectionInterface::RTCConfiguration, |
| 154 | GetConfiguration, |
| 155 | (), |
| 156 | (override)); |
| 157 | MOCK_METHOD(RTCError, |
| 158 | SetConfiguration, |
| 159 | (const PeerConnectionInterface::RTCConfiguration&), |
| 160 | (override)); |
| 161 | MOCK_METHOD(bool, |
| 162 | AddIceCandidate, |
| 163 | (const IceCandidateInterface*), |
| 164 | (override)); |
| 165 | MOCK_METHOD(bool, |
| 166 | RemoveIceCandidates, |
| 167 | (const std::vector<cricket::Candidate>&), |
| 168 | (override)); |
| 169 | MOCK_METHOD(RTCError, SetBitrate, (const BitrateSettings&), (override)); |
| 170 | MOCK_METHOD(RTCError, SetBitrate, (const BitrateParameters&), (override)); |
| 171 | MOCK_METHOD(void, SetAudioPlayout, (bool), (override)); |
| 172 | MOCK_METHOD(void, SetAudioRecording, (bool), (override)); |
| 173 | MOCK_METHOD(rtc::scoped_refptr<DtlsTransportInterface>, |
| 174 | LookupDtlsTransportByMid, |
| 175 | (const std::string&), |
| 176 | (override)); |
| 177 | MOCK_METHOD(SignalingState, signaling_state, (), (override)); |
| 178 | MOCK_METHOD(IceConnectionState, ice_connection_state, (), (override)); |
| 179 | MOCK_METHOD(IceConnectionState, |
| 180 | standardized_ice_connection_state, |
| 181 | (), |
| 182 | (override)); |
| 183 | MOCK_METHOD(PeerConnectionState, peer_connection_state, (), (override)); |
| 184 | MOCK_METHOD(IceGatheringState, ice_gathering_state, (), (override)); |
| 185 | MOCK_METHOD(absl::optional<bool>, can_trickle_ice_candidates, (), (override)); |
| 186 | MOCK_METHOD(bool, |
| 187 | StartRtcEventLog, |
| 188 | (std::unique_ptr<RtcEventLogOutput>, int64_t), |
| 189 | (override)); |
| 190 | MOCK_METHOD(bool, |
| 191 | StartRtcEventLog, |
| 192 | (std::unique_ptr<RtcEventLogOutput>), |
| 193 | (override)); |
| 194 | MOCK_METHOD(void, StopRtcEventLog, (), (override)); |
| 195 | MOCK_METHOD(void, Close, (), (override)); |
Jiawei Ou | 651b92e | 2018-06-29 15:46:44 -0700 | [diff] [blame] | 196 | }; |
| 197 | |
Niels Möller | 7b04a91 | 2019-09-13 15:41:21 +0200 | [diff] [blame] | 198 | static_assert(!std::is_abstract<MockPeerConnectionInterface>::value, ""); |
| 199 | |
Jiawei Ou | 651b92e | 2018-06-29 15:46:44 -0700 | [diff] [blame] | 200 | } // namespace webrtc |
| 201 | |
| 202 | #endif // API_TEST_MOCK_PEERCONNECTIONINTERFACE_H_ |