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