blob: e743cd85c8c7ae1e2fa7149365a81391815363b8 [file] [log] [blame]
hbosb24b1ce2016-08-16 01:19:43 -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
ossu7bb87ee2017-01-23 04:56:25 -080011#ifndef WEBRTC_PC_TEST_MOCK_PEERCONNECTION_H_
12#define WEBRTC_PC_TEST_MOCK_PEERCONNECTION_H_
hbosb24b1ce2016-08-16 01:19:43 -070013
14#include <vector>
15
zhihuang38ede132017-06-15 12:52:32 -070016#include "webrtc/call/call.h"
17#include "webrtc/logging/rtc_event_log/rtc_event_log.h"
ossu7bb87ee2017-01-23 04:56:25 -080018#include "webrtc/pc/peerconnection.h"
Edward Lemurc20978e2017-07-06 19:44:34 +020019#include "webrtc/rtc_base/thread.h"
kwiberg77eab702016-09-28 17:42:01 -070020#include "webrtc/test/gmock.h"
hbosb24b1ce2016-08-16 01:19:43 -070021
22namespace webrtc {
23
24// The factory isn't really used; it just satisfies the base PeerConnection.
25class FakePeerConnectionFactory
kwiberg1e4e8cb2017-01-31 01:48:08 -080026 : public rtc::RefCountedObject<webrtc::PeerConnectionFactory> {
27 public:
28 FakePeerConnectionFactory()
zhihuang38ede132017-06-15 12:52:32 -070029 : rtc::RefCountedObject<webrtc::PeerConnectionFactory>(
30 rtc::Thread::Current(),
31 rtc::Thread::Current(),
32 rtc::Thread::Current(),
33 nullptr,
34 nullptr,
35 nullptr,
36 nullptr,
37 nullptr,
38 nullptr,
39 std::unique_ptr<cricket::MediaEngineInterface>(),
40 std::unique_ptr<webrtc::CallFactoryInterface>(),
41 std::unique_ptr<RtcEventLogFactoryInterface>()) {}
kwiberg1e4e8cb2017-01-31 01:48:08 -080042};
hbosb24b1ce2016-08-16 01:19:43 -070043
44class MockPeerConnection
45 : public rtc::RefCountedObject<webrtc::PeerConnection> {
46 public:
47 MockPeerConnection()
48 : rtc::RefCountedObject<webrtc::PeerConnection>(
zhihuang38ede132017-06-15 12:52:32 -070049 new FakePeerConnectionFactory(),
50 std::unique_ptr<RtcEventLog>(),
51 std::unique_ptr<Call>()) {}
hbos09bc1282016-11-08 06:29:22 -080052 MOCK_METHOD0(local_streams,
53 rtc::scoped_refptr<StreamCollectionInterface>());
54 MOCK_METHOD0(remote_streams,
55 rtc::scoped_refptr<StreamCollectionInterface>());
hbosb24b1ce2016-08-16 01:19:43 -070056 MOCK_METHOD0(session, WebRtcSession*());
hbos84abeb12017-01-16 06:16:44 -080057 MOCK_CONST_METHOD0(GetSenders,
58 std::vector<rtc::scoped_refptr<RtpSenderInterface>>());
59 MOCK_CONST_METHOD0(GetReceivers,
60 std::vector<rtc::scoped_refptr<RtpReceiverInterface>>());
hbosb24b1ce2016-08-16 01:19:43 -070061 MOCK_CONST_METHOD0(sctp_data_channels,
62 const std::vector<rtc::scoped_refptr<DataChannel>>&());
63};
64
65} // namespace webrtc
66
ossu7bb87ee2017-01-23 04:56:25 -080067#endif // WEBRTC_PC_TEST_MOCK_PEERCONNECTION_H_