blob: aacaaf6cabd3ff2603cceb45ec1da04c5d3feca6 [file] [log] [blame]
Jiawei Ou651b92e2018-06-29 15:46:44 -07001/*
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öller7b04a912019-09-13 15:41:21 +020016#include <type_traits>
Jiawei Ou651b92e2018-06-29 15:46:44 -070017#include <utility>
18#include <vector>
19
Steve Anton10542f22019-01-11 09:11:00 -080020#include "api/peer_connection_interface.h"
Harald Alvestrand15845af2019-03-05 09:50:57 +010021#include "api/sctp_transport_interface.h"
Jiawei Ou651b92e2018-06-29 15:46:44 -070022#include "test/gmock.h"
23
24namespace webrtc {
25
26class MockPeerConnectionInterface
27 : public rtc::RefCountedObject<webrtc::PeerConnectionInterface> {
28 public:
29 // PeerConnectionInterface
30 MOCK_METHOD0(local_streams, rtc::scoped_refptr<StreamCollectionInterface>());
31 MOCK_METHOD0(remote_streams, rtc::scoped_refptr<StreamCollectionInterface>());
32 MOCK_METHOD1(AddStream, bool(MediaStreamInterface*));
33 MOCK_METHOD1(RemoveStream, void(MediaStreamInterface*));
34 MOCK_METHOD2(AddTrack,
35 RTCErrorOr<rtc::scoped_refptr<RtpSenderInterface>>(
36 rtc::scoped_refptr<MediaStreamTrackInterface>,
37 const std::vector<std::string>&));
38 MOCK_METHOD2(AddTrack,
39 rtc::scoped_refptr<RtpSenderInterface>(
40 MediaStreamTrackInterface*,
41 std::vector<MediaStreamInterface*>));
42 MOCK_METHOD1(RemoveTrack, bool(RtpSenderInterface*));
Niels Möller7b04a912019-09-13 15:41:21 +020043 MOCK_METHOD1(RemoveTrackNew,
44 RTCError(rtc::scoped_refptr<RtpSenderInterface>));
Jiawei Ou651b92e2018-06-29 15:46:44 -070045 MOCK_METHOD1(AddTransceiver,
46 RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>(
47 rtc::scoped_refptr<MediaStreamTrackInterface>));
48 MOCK_METHOD2(AddTransceiver,
49 RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>(
50 rtc::scoped_refptr<MediaStreamTrackInterface>,
51 const RtpTransceiverInit&));
52 MOCK_METHOD1(AddTransceiver,
53 RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>(
54 cricket::MediaType));
55 MOCK_METHOD2(AddTransceiver,
56 RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>(
57 cricket::MediaType,
58 const RtpTransceiverInit&));
59 MOCK_METHOD2(CreateSender,
60 rtc::scoped_refptr<RtpSenderInterface>(const std::string&,
61 const std::string&));
62 MOCK_CONST_METHOD0(GetSenders,
63 std::vector<rtc::scoped_refptr<RtpSenderInterface>>());
64 MOCK_CONST_METHOD0(GetReceivers,
65 std::vector<rtc::scoped_refptr<RtpReceiverInterface>>());
66 MOCK_CONST_METHOD0(
67 GetTransceivers,
68 std::vector<rtc::scoped_refptr<RtpTransceiverInterface>>());
69 MOCK_METHOD3(GetStats,
70 bool(StatsObserver*,
71 MediaStreamTrackInterface*,
72 StatsOutputLevel));
73 MOCK_METHOD1(GetStats, void(RTCStatsCollectorCallback*));
74 MOCK_METHOD2(GetStats,
75 void(rtc::scoped_refptr<RtpSenderInterface>,
76 rtc::scoped_refptr<RTCStatsCollectorCallback>));
77 MOCK_METHOD2(GetStats,
78 void(rtc::scoped_refptr<RtpReceiverInterface>,
79 rtc::scoped_refptr<RTCStatsCollectorCallback>));
80 MOCK_METHOD0(ClearStatsCache, void());
Harald Alvestrand15845af2019-03-05 09:50:57 +010081 MOCK_CONST_METHOD0(GetSctpTransport,
82 rtc::scoped_refptr<SctpTransportInterface>());
Jiawei Ou651b92e2018-06-29 15:46:44 -070083 MOCK_METHOD2(
84 CreateDataChannel,
85 rtc::scoped_refptr<DataChannelInterface>(const std::string&,
86 const DataChannelInit*));
87 MOCK_CONST_METHOD0(local_description, const SessionDescriptionInterface*());
88 MOCK_CONST_METHOD0(remote_description, const SessionDescriptionInterface*());
89 MOCK_CONST_METHOD0(current_local_description,
90 const SessionDescriptionInterface*());
91 MOCK_CONST_METHOD0(current_remote_description,
92 const SessionDescriptionInterface*());
93 MOCK_CONST_METHOD0(pending_local_description,
94 const SessionDescriptionInterface*());
95 MOCK_CONST_METHOD0(pending_remote_description,
96 const SessionDescriptionInterface*());
Niels Möller7b04a912019-09-13 15:41:21 +020097 MOCK_METHOD0(RestartIce, void());
Jiawei Ou651b92e2018-06-29 15:46:44 -070098 MOCK_METHOD2(CreateOffer,
99 void(CreateSessionDescriptionObserver*,
Jiawei Ou651b92e2018-06-29 15:46:44 -0700100 const RTCOfferAnswerOptions&));
101 MOCK_METHOD2(CreateAnswer,
102 void(CreateSessionDescriptionObserver*,
103 const RTCOfferAnswerOptions&));
Jiawei Ou651b92e2018-06-29 15:46:44 -0700104 MOCK_METHOD2(SetLocalDescription,
105 void(SetSessionDescriptionObserver*,
106 SessionDescriptionInterface*));
107 MOCK_METHOD2(SetRemoteDescription,
108 void(SetSessionDescriptionObserver*,
109 SessionDescriptionInterface*));
110 MOCK_METHOD2(SetRemoteDescription,
111 void(std::unique_ptr<SessionDescriptionInterface>,
112 rtc::scoped_refptr<SetRemoteDescriptionObserverInterface>));
113 MOCK_METHOD0(GetConfiguration, PeerConnectionInterface::RTCConfiguration());
Jiawei Ou651b92e2018-06-29 15:46:44 -0700114 MOCK_METHOD1(SetConfiguration,
Niels Möller2579f0c2019-08-19 09:58:17 +0200115 RTCError(const PeerConnectionInterface::RTCConfiguration&));
Jiawei Ou651b92e2018-06-29 15:46:44 -0700116 MOCK_METHOD1(AddIceCandidate, bool(const IceCandidateInterface*));
117 MOCK_METHOD1(RemoveIceCandidates,
118 bool(const std::vector<cricket::Candidate>&));
Jiawei Ou651b92e2018-06-29 15:46:44 -0700119 MOCK_METHOD1(SetBitrate, RTCError(const BitrateSettings&));
120 MOCK_METHOD1(SetBitrate, RTCError(const BitrateParameters&));
Jiawei Ou651b92e2018-06-29 15:46:44 -0700121 MOCK_METHOD1(SetAudioPlayout, void(bool));
122 MOCK_METHOD1(SetAudioRecording, void(bool));
Niels Möller7b04a912019-09-13 15:41:21 +0200123 MOCK_METHOD1(LookupDtlsTransportByMid,
124 rtc::scoped_refptr<DtlsTransportInterface>(const std::string&));
Jiawei Ou651b92e2018-06-29 15:46:44 -0700125 MOCK_METHOD0(signaling_state, SignalingState());
126 MOCK_METHOD0(ice_connection_state, IceConnectionState());
Niels Möller7b04a912019-09-13 15:41:21 +0200127 MOCK_METHOD0(standardized_ice_connection_state, IceConnectionState());
128 MOCK_METHOD0(peer_connection_state, PeerConnectionState());
Jiawei Ou651b92e2018-06-29 15:46:44 -0700129 MOCK_METHOD0(ice_gathering_state, IceGatheringState());
Jiawei Ou651b92e2018-06-29 15:46:44 -0700130 MOCK_METHOD2(StartRtcEventLog,
131 bool(std::unique_ptr<RtcEventLogOutput>, int64_t));
Niels Möller7b04a912019-09-13 15:41:21 +0200132 MOCK_METHOD1(StartRtcEventLog, bool(std::unique_ptr<RtcEventLogOutput>));
Jiawei Ou651b92e2018-06-29 15:46:44 -0700133 MOCK_METHOD0(StopRtcEventLog, void());
134 MOCK_METHOD0(Close, void());
135};
136
Niels Möller7b04a912019-09-13 15:41:21 +0200137static_assert(!std::is_abstract<MockPeerConnectionInterface>::value, "");
138
Jiawei Ou651b92e2018-06-29 15:46:44 -0700139} // namespace webrtc
140
141#endif // API_TEST_MOCK_PEERCONNECTIONINTERFACE_H_