hbos | b24b1ce | 2016-08-16 01:19:43 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 11 | #ifndef WEBRTC_PC_TEST_MOCK_PEERCONNECTION_H_ |
| 12 | #define WEBRTC_PC_TEST_MOCK_PEERCONNECTION_H_ |
hbos | b24b1ce | 2016-08-16 01:19:43 -0700 | [diff] [blame] | 13 | |
| 14 | #include <vector> |
| 15 | |
zhihuang | 38ede13 | 2017-06-15 12:52:32 -0700 | [diff] [blame] | 16 | #include "webrtc/call/call.h" |
| 17 | #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 18 | #include "webrtc/pc/peerconnection.h" |
Edward Lemur | c20978e | 2017-07-06 19:44:34 +0200 | [diff] [blame] | 19 | #include "webrtc/rtc_base/thread.h" |
kwiberg | 77eab70 | 2016-09-28 17:42:01 -0700 | [diff] [blame] | 20 | #include "webrtc/test/gmock.h" |
hbos | b24b1ce | 2016-08-16 01:19:43 -0700 | [diff] [blame] | 21 | |
| 22 | namespace webrtc { |
| 23 | |
| 24 | // The factory isn't really used; it just satisfies the base PeerConnection. |
| 25 | class FakePeerConnectionFactory |
kwiberg | 1e4e8cb | 2017-01-31 01:48:08 -0800 | [diff] [blame] | 26 | : public rtc::RefCountedObject<webrtc::PeerConnectionFactory> { |
| 27 | public: |
| 28 | FakePeerConnectionFactory() |
zhihuang | 38ede13 | 2017-06-15 12:52:32 -0700 | [diff] [blame] | 29 | : 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>()) {} |
kwiberg | 1e4e8cb | 2017-01-31 01:48:08 -0800 | [diff] [blame] | 42 | }; |
hbos | b24b1ce | 2016-08-16 01:19:43 -0700 | [diff] [blame] | 43 | |
| 44 | class MockPeerConnection |
| 45 | : public rtc::RefCountedObject<webrtc::PeerConnection> { |
| 46 | public: |
| 47 | MockPeerConnection() |
| 48 | : rtc::RefCountedObject<webrtc::PeerConnection>( |
zhihuang | 38ede13 | 2017-06-15 12:52:32 -0700 | [diff] [blame] | 49 | new FakePeerConnectionFactory(), |
| 50 | std::unique_ptr<RtcEventLog>(), |
| 51 | std::unique_ptr<Call>()) {} |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 52 | MOCK_METHOD0(local_streams, |
| 53 | rtc::scoped_refptr<StreamCollectionInterface>()); |
| 54 | MOCK_METHOD0(remote_streams, |
| 55 | rtc::scoped_refptr<StreamCollectionInterface>()); |
hbos | b24b1ce | 2016-08-16 01:19:43 -0700 | [diff] [blame] | 56 | MOCK_METHOD0(session, WebRtcSession*()); |
hbos | 84abeb1 | 2017-01-16 06:16:44 -0800 | [diff] [blame] | 57 | MOCK_CONST_METHOD0(GetSenders, |
| 58 | std::vector<rtc::scoped_refptr<RtpSenderInterface>>()); |
| 59 | MOCK_CONST_METHOD0(GetReceivers, |
| 60 | std::vector<rtc::scoped_refptr<RtpReceiverInterface>>()); |
hbos | b24b1ce | 2016-08-16 01:19:43 -0700 | [diff] [blame] | 61 | MOCK_CONST_METHOD0(sctp_data_channels, |
| 62 | const std::vector<rtc::scoped_refptr<DataChannel>>&()); |
| 63 | }; |
| 64 | |
| 65 | } // namespace webrtc |
| 66 | |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 67 | #endif // WEBRTC_PC_TEST_MOCK_PEERCONNECTION_H_ |