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 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #ifndef PC_TEST_MOCK_PEERCONNECTION_H_ |
| 12 | #define PC_TEST_MOCK_PEERCONNECTION_H_ |
hbos | b24b1ce | 2016-08-16 01:19:43 -0700 | [diff] [blame] | 13 | |
Steve Anton | 36b29d1 | 2017-10-30 09:57:42 -0700 | [diff] [blame] | 14 | #include <memory> |
hbos | b24b1ce | 2016-08-16 01:19:43 -0700 | [diff] [blame] | 15 | #include <vector> |
| 16 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 17 | #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" |
hbos | b24b1ce | 2016-08-16 01:19:43 -0700 | [diff] [blame] | 22 | |
| 23 | namespace webrtc { |
| 24 | |
| 25 | // The factory isn't really used; it just satisfies the base PeerConnection. |
| 26 | class FakePeerConnectionFactory |
kwiberg | 1e4e8cb | 2017-01-31 01:48:08 -0800 | [diff] [blame] | 27 | : public rtc::RefCountedObject<webrtc::PeerConnectionFactory> { |
| 28 | public: |
| 29 | FakePeerConnectionFactory() |
zhihuang | 38ede13 | 2017-06-15 12:52:32 -0700 | [diff] [blame] | 30 | : rtc::RefCountedObject<webrtc::PeerConnectionFactory>( |
| 31 | rtc::Thread::Current(), |
| 32 | rtc::Thread::Current(), |
| 33 | rtc::Thread::Current(), |
zhihuang | 38ede13 | 2017-06-15 12:52:32 -0700 | [diff] [blame] | 34 | std::unique_ptr<cricket::MediaEngineInterface>(), |
| 35 | std::unique_ptr<webrtc::CallFactoryInterface>(), |
| 36 | std::unique_ptr<RtcEventLogFactoryInterface>()) {} |
kwiberg | 1e4e8cb | 2017-01-31 01:48:08 -0800 | [diff] [blame] | 37 | }; |
hbos | b24b1ce | 2016-08-16 01:19:43 -0700 | [diff] [blame] | 38 | |
| 39 | class MockPeerConnection |
| 40 | : public rtc::RefCountedObject<webrtc::PeerConnection> { |
| 41 | public: |
| 42 | MockPeerConnection() |
| 43 | : rtc::RefCountedObject<webrtc::PeerConnection>( |
zhihuang | 38ede13 | 2017-06-15 12:52:32 -0700 | [diff] [blame] | 44 | new FakePeerConnectionFactory(), |
| 45 | std::unique_ptr<RtcEventLog>(), |
| 46 | std::unique_ptr<Call>()) {} |
hbos | 09bc128 | 2016-11-08 06:29:22 -0800 | [diff] [blame] | 47 | MOCK_METHOD0(local_streams, |
| 48 | rtc::scoped_refptr<StreamCollectionInterface>()); |
| 49 | MOCK_METHOD0(remote_streams, |
| 50 | rtc::scoped_refptr<StreamCollectionInterface>()); |
hbos | 84abeb1 | 2017-01-16 06:16:44 -0800 | [diff] [blame] | 51 | MOCK_CONST_METHOD0(GetSenders, |
| 52 | std::vector<rtc::scoped_refptr<RtpSenderInterface>>()); |
| 53 | MOCK_CONST_METHOD0(GetReceivers, |
| 54 | std::vector<rtc::scoped_refptr<RtpReceiverInterface>>()); |
hbos | b24b1ce | 2016-08-16 01:19:43 -0700 | [diff] [blame] | 55 | MOCK_CONST_METHOD0(sctp_data_channels, |
| 56 | const std::vector<rtc::scoped_refptr<DataChannel>>&()); |
| 57 | }; |
| 58 | |
| 59 | } // namespace webrtc |
| 60 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 61 | #endif // PC_TEST_MOCK_PEERCONNECTION_H_ |