blob: d57ada82167ed7694e4bafb5f26b80900fc10e68 [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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef PC_TEST_MOCK_PEERCONNECTION_H_
12#define PC_TEST_MOCK_PEERCONNECTION_H_
hbosb24b1ce2016-08-16 01:19:43 -070013
Steve Anton36b29d12017-10-30 09:57:42 -070014#include <memory>
hbosb24b1ce2016-08-16 01:19:43 -070015#include <vector>
16
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020017#include "call/call.h"
18#include "logging/rtc_event_log/rtc_event_log.h"
19#include "pc/peerconnection.h"
20#include "rtc_base/thread.h"
21#include "test/gmock.h"
hbosb24b1ce2016-08-16 01:19:43 -070022
23namespace webrtc {
24
25// The factory isn't really used; it just satisfies the base PeerConnection.
26class FakePeerConnectionFactory
kwiberg1e4e8cb2017-01-31 01:48:08 -080027 : public rtc::RefCountedObject<webrtc::PeerConnectionFactory> {
28 public:
29 FakePeerConnectionFactory()
zhihuang38ede132017-06-15 12:52:32 -070030 : rtc::RefCountedObject<webrtc::PeerConnectionFactory>(
31 rtc::Thread::Current(),
32 rtc::Thread::Current(),
33 rtc::Thread::Current(),
zhihuang38ede132017-06-15 12:52:32 -070034 std::unique_ptr<cricket::MediaEngineInterface>(),
35 std::unique_ptr<webrtc::CallFactoryInterface>(),
36 std::unique_ptr<RtcEventLogFactoryInterface>()) {}
kwiberg1e4e8cb2017-01-31 01:48:08 -080037};
hbosb24b1ce2016-08-16 01:19:43 -070038
39class MockPeerConnection
40 : public rtc::RefCountedObject<webrtc::PeerConnection> {
41 public:
42 MockPeerConnection()
43 : rtc::RefCountedObject<webrtc::PeerConnection>(
zhihuang38ede132017-06-15 12:52:32 -070044 new FakePeerConnectionFactory(),
45 std::unique_ptr<RtcEventLog>(),
46 std::unique_ptr<Call>()) {}
hbos09bc1282016-11-08 06:29:22 -080047 MOCK_METHOD0(local_streams,
48 rtc::scoped_refptr<StreamCollectionInterface>());
49 MOCK_METHOD0(remote_streams,
50 rtc::scoped_refptr<StreamCollectionInterface>());
hbos84abeb12017-01-16 06:16:44 -080051 MOCK_CONST_METHOD0(GetSenders,
52 std::vector<rtc::scoped_refptr<RtpSenderInterface>>());
53 MOCK_CONST_METHOD0(GetReceivers,
54 std::vector<rtc::scoped_refptr<RtpReceiverInterface>>());
hbosb24b1ce2016-08-16 01:19:43 -070055 MOCK_CONST_METHOD0(sctp_data_channels,
56 const std::vector<rtc::scoped_refptr<DataChannel>>&());
57};
58
59} // namespace webrtc
60
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020061#endif // PC_TEST_MOCK_PEERCONNECTION_H_