blob: 397860cc7c9269db61efa813bafa132582524f0a [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
19#include "api/peerconnectioninterface.h"
20#include "test/gmock.h"
21
22namespace webrtc {
23
24class 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*,
93 const MediaConstraintsInterface*));
94 MOCK_METHOD2(CreateOffer,
95 void(CreateSessionDescriptionObserver*,
96 const RTCOfferAnswerOptions&));
97 MOCK_METHOD2(CreateAnswer,
98 void(CreateSessionDescriptionObserver*,
99 const RTCOfferAnswerOptions&));
100 MOCK_METHOD2(CreateAnswer,
101 void(CreateSessionDescriptionObserver*,
102 const MediaConstraintsInterface*));
103 MOCK_METHOD2(SetLocalDescription,
104 void(SetSessionDescriptionObserver*,
105 SessionDescriptionInterface*));
106 MOCK_METHOD2(SetRemoteDescription,
107 void(SetSessionDescriptionObserver*,
108 SessionDescriptionInterface*));
109 MOCK_METHOD2(SetRemoteDescription,
110 void(std::unique_ptr<SessionDescriptionInterface>,
111 rtc::scoped_refptr<SetRemoteDescriptionObserverInterface>));
112 MOCK_METHOD0(GetConfiguration, PeerConnectionInterface::RTCConfiguration());
113 MOCK_METHOD2(SetConfiguration,
114 bool(const PeerConnectionInterface::RTCConfiguration&,
115 RTCError*));
116 MOCK_METHOD1(SetConfiguration,
117 bool(const PeerConnectionInterface::RTCConfiguration&));
118 MOCK_METHOD1(AddIceCandidate, bool(const IceCandidateInterface*));
119 MOCK_METHOD1(RemoveIceCandidates,
120 bool(const std::vector<cricket::Candidate>&));
121 MOCK_METHOD1(RegisterUMAObserver, void(UMAObserver*));
122 MOCK_METHOD1(SetBitrate, RTCError(const BitrateSettings&));
123 MOCK_METHOD1(SetBitrate, RTCError(const BitrateParameters&));
124 MOCK_METHOD1(SetBitrateAllocationStrategy,
125 void(std::unique_ptr<rtc::BitrateAllocationStrategy>));
126 MOCK_METHOD1(SetAudioPlayout, void(bool));
127 MOCK_METHOD1(SetAudioRecording, void(bool));
128 MOCK_METHOD0(signaling_state, SignalingState());
129 MOCK_METHOD0(ice_connection_state, IceConnectionState());
130 MOCK_METHOD0(ice_gathering_state, IceGatheringState());
131 MOCK_METHOD2(StartRtcEventLog, bool(rtc::PlatformFile, int64_t));
132 MOCK_METHOD2(StartRtcEventLog,
133 bool(std::unique_ptr<RtcEventLogOutput>, int64_t));
134 MOCK_METHOD0(StopRtcEventLog, void());
135 MOCK_METHOD0(Close, void());
136};
137
138} // namespace webrtc
139
140#endif // API_TEST_MOCK_PEERCONNECTIONINTERFACE_H_