Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: pc/test/mock_peerconnection.h

Issue 3007973002: Mark template class RefCountedObject as final.
Patch Set: Rebased. Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #ifndef PC_TEST_MOCK_PEERCONNECTION_H_ 11 #ifndef PC_TEST_MOCK_PEERCONNECTION_H_
12 #define PC_TEST_MOCK_PEERCONNECTION_H_ 12 #define PC_TEST_MOCK_PEERCONNECTION_H_
13 13
14 #include <vector> 14 #include <vector>
15 15
16 #include "call/call.h" 16 #include "call/call.h"
17 #include "logging/rtc_event_log/rtc_event_log.h" 17 #include "logging/rtc_event_log/rtc_event_log.h"
18 #include "pc/peerconnection.h" 18 #include "pc/peerconnection.h"
19 #include "rtc_base/thread.h" 19 #include "rtc_base/thread.h"
20 #include "test/gmock.h" 20 #include "test/gmock.h"
21 21
22 namespace webrtc { 22 namespace webrtc {
23 23
24 // The factory isn't really used; it just satisfies the base PeerConnection. 24 // The factory isn't really used; it just satisfies the base PeerConnection.
25 class FakePeerConnectionFactory 25 class FakePeerConnectionFactory : public webrtc::PeerConnectionFactory {
26 : public rtc::RefCountedObject<webrtc::PeerConnectionFactory> {
27 public: 26 public:
28 FakePeerConnectionFactory() 27 FakePeerConnectionFactory()
29 : rtc::RefCountedObject<webrtc::PeerConnectionFactory>( 28 : webrtc::PeerConnectionFactory(
30 rtc::Thread::Current(), 29 rtc::Thread::Current(),
31 rtc::Thread::Current(), 30 rtc::Thread::Current(),
32 rtc::Thread::Current(), 31 rtc::Thread::Current(),
33 nullptr, 32 nullptr,
34 nullptr, 33 nullptr,
35 nullptr, 34 nullptr,
36 nullptr, 35 nullptr,
37 nullptr, 36 nullptr,
38 nullptr, 37 nullptr,
39 std::unique_ptr<cricket::MediaEngineInterface>(), 38 std::unique_ptr<cricket::MediaEngineInterface>(),
40 std::unique_ptr<webrtc::CallFactoryInterface>(), 39 std::unique_ptr<webrtc::CallFactoryInterface>(),
41 std::unique_ptr<RtcEventLogFactoryInterface>()) {} 40 std::unique_ptr<RtcEventLogFactoryInterface>()) {}
42 }; 41 };
43 42
44 class MockPeerConnection 43 class MockPeerConnection : public webrtc::PeerConnection {
45 : public rtc::RefCountedObject<webrtc::PeerConnection> {
46 public: 44 public:
47 MockPeerConnection() 45 MockPeerConnection()
48 : rtc::RefCountedObject<webrtc::PeerConnection>( 46 : webrtc::PeerConnection(
49 new FakePeerConnectionFactory(), 47 new rtc::RefCountedObject<FakePeerConnectionFactory>(),
50 std::unique_ptr<RtcEventLog>(), 48 std::unique_ptr<RtcEventLog>(),
51 std::unique_ptr<Call>()) {} 49 std::unique_ptr<Call>()) {}
52 MOCK_METHOD0(local_streams, 50 MOCK_METHOD0(local_streams,
53 rtc::scoped_refptr<StreamCollectionInterface>()); 51 rtc::scoped_refptr<StreamCollectionInterface>());
54 MOCK_METHOD0(remote_streams, 52 MOCK_METHOD0(remote_streams,
55 rtc::scoped_refptr<StreamCollectionInterface>()); 53 rtc::scoped_refptr<StreamCollectionInterface>());
56 MOCK_METHOD0(session, WebRtcSession*()); 54 MOCK_METHOD0(session, WebRtcSession*());
57 MOCK_CONST_METHOD0(GetSenders, 55 MOCK_CONST_METHOD0(GetSenders,
58 std::vector<rtc::scoped_refptr<RtpSenderInterface>>()); 56 std::vector<rtc::scoped_refptr<RtpSenderInterface>>());
59 MOCK_CONST_METHOD0(GetReceivers, 57 MOCK_CONST_METHOD0(GetReceivers,
60 std::vector<rtc::scoped_refptr<RtpReceiverInterface>>()); 58 std::vector<rtc::scoped_refptr<RtpReceiverInterface>>());
61 MOCK_CONST_METHOD0(sctp_data_channels, 59 MOCK_CONST_METHOD0(sctp_data_channels,
62 const std::vector<rtc::scoped_refptr<DataChannel>>&()); 60 const std::vector<rtc::scoped_refptr<DataChannel>>&());
63 }; 61 };
64 62
65 } // namespace webrtc 63 } // namespace webrtc
66 64
67 #endif // PC_TEST_MOCK_PEERCONNECTION_H_ 65 #endif // PC_TEST_MOCK_PEERCONNECTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698