mock_peerconnectioninterface.h 7.8 KB

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