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

Side by Side Diff: webrtc/api/rtcstatscollector_unittest.cc

Issue 2353033005: Refactoring: move ownership of RtcEventLog from Call to PeerConnection (Closed)
Patch Set: Moved the constructor Created 4 years, 2 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
(...skipping 10 matching lines...) Expand all
21 #include "webrtc/api/test/mock_peerconnection.h" 21 #include "webrtc/api/test/mock_peerconnection.h"
22 #include "webrtc/api/test/mock_webrtcsession.h" 22 #include "webrtc/api/test/mock_webrtcsession.h"
23 #include "webrtc/base/checks.h" 23 #include "webrtc/base/checks.h"
24 #include "webrtc/base/fakeclock.h" 24 #include "webrtc/base/fakeclock.h"
25 #include "webrtc/base/fakesslidentity.h" 25 #include "webrtc/base/fakesslidentity.h"
26 #include "webrtc/base/gunit.h" 26 #include "webrtc/base/gunit.h"
27 #include "webrtc/base/logging.h" 27 #include "webrtc/base/logging.h"
28 #include "webrtc/base/thread_checker.h" 28 #include "webrtc/base/thread_checker.h"
29 #include "webrtc/base/timedelta.h" 29 #include "webrtc/base/timedelta.h"
30 #include "webrtc/base/timeutils.h" 30 #include "webrtc/base/timeutils.h"
31 #include "webrtc/logging/rtc_event_log/rtc_event_log.h"
31 #include "webrtc/media/base/fakemediaengine.h" 32 #include "webrtc/media/base/fakemediaengine.h"
32 33
33 using testing::_; 34 using testing::_;
34 using testing::Invoke; 35 using testing::Invoke;
35 using testing::Return; 36 using testing::Return;
36 using testing::ReturnRef; 37 using testing::ReturnRef;
37 38
38 namespace webrtc { 39 namespace webrtc {
39 40
40 namespace { 41 namespace {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 } 90 }
90 EXPECT_EQ(info->ders.size(), info->fingerprints.size()); 91 EXPECT_EQ(info->ders.size(), info->fingerprints.size());
91 return info; 92 return info;
92 } 93 }
93 94
94 class RTCStatsCollectorTestHelper : public SetSessionDescriptionObserver { 95 class RTCStatsCollectorTestHelper : public SetSessionDescriptionObserver {
95 public: 96 public:
96 RTCStatsCollectorTestHelper() 97 RTCStatsCollectorTestHelper()
97 : worker_thread_(rtc::Thread::Current()), 98 : worker_thread_(rtc::Thread::Current()),
98 network_thread_(rtc::Thread::Current()), 99 network_thread_(rtc::Thread::Current()),
99 channel_manager_(new cricket::ChannelManager( 100 channel_manager_(
100 new cricket::FakeMediaEngine(), 101 new cricket::ChannelManager(new cricket::FakeMediaEngine(),
101 worker_thread_, 102 worker_thread_,
102 network_thread_)), 103 network_thread_)),
103 media_controller_( 104 media_controller_(
104 MediaControllerInterface::Create(cricket::MediaConfig(), 105 MediaControllerInterface::Create(cricket::MediaConfig(),
105 worker_thread_, 106 worker_thread_,
106 channel_manager_.get())), 107 channel_manager_.get(),
108 &event_log_)),
107 session_(media_controller_.get()), 109 session_(media_controller_.get()),
108 pc_() { 110 pc_() {
109 // Default return values for mocks. 111 // Default return values for mocks.
110 EXPECT_CALL(pc_, session()).WillRepeatedly(Return(&session_)); 112 EXPECT_CALL(pc_, session()).WillRepeatedly(Return(&session_));
111 EXPECT_CALL(pc_, sctp_data_channels()).WillRepeatedly( 113 EXPECT_CALL(pc_, sctp_data_channels()).WillRepeatedly(
112 ReturnRef(data_channels_)); 114 ReturnRef(data_channels_));
113 EXPECT_CALL(session_, GetTransportStats(_)).WillRepeatedly(Return(false)); 115 EXPECT_CALL(session_, GetTransportStats(_)).WillRepeatedly(Return(false));
114 } 116 }
115 117
116 rtc::ScopedFakeClock& fake_clock() { return fake_clock_; } 118 rtc::ScopedFakeClock& fake_clock() { return fake_clock_; }
117 MockWebRtcSession& session() { return session_; } 119 MockWebRtcSession& session() { return session_; }
118 MockPeerConnection& pc() { return pc_; } 120 MockPeerConnection& pc() { return pc_; }
119 std::vector<rtc::scoped_refptr<DataChannel>>& data_channels() { 121 std::vector<rtc::scoped_refptr<DataChannel>>& data_channels() {
120 return data_channels_; 122 return data_channels_;
121 } 123 }
122 124
123 // SetSessionDescriptionObserver overrides. 125 // SetSessionDescriptionObserver overrides.
124 void OnSuccess() override {} 126 void OnSuccess() override {}
125 void OnFailure(const std::string& error) override { 127 void OnFailure(const std::string& error) override {
126 RTC_NOTREACHED() << error; 128 RTC_NOTREACHED() << error;
127 } 129 }
128 130
129 private: 131 private:
130 rtc::ScopedFakeClock fake_clock_; 132 rtc::ScopedFakeClock fake_clock_;
133 webrtc::RtcEventLogNullImpl event_log_;
131 rtc::Thread* const worker_thread_; 134 rtc::Thread* const worker_thread_;
132 rtc::Thread* const network_thread_; 135 rtc::Thread* const network_thread_;
133 std::unique_ptr<cricket::ChannelManager> channel_manager_; 136 std::unique_ptr<cricket::ChannelManager> channel_manager_;
134 std::unique_ptr<webrtc::MediaControllerInterface> media_controller_; 137 std::unique_ptr<webrtc::MediaControllerInterface> media_controller_;
135 MockWebRtcSession session_; 138 MockWebRtcSession session_;
136 MockPeerConnection pc_; 139 MockPeerConnection pc_;
137 140
138 std::vector<rtc::scoped_refptr<DataChannel>> data_channels_; 141 std::vector<rtc::scoped_refptr<DataChannel>> data_channels_;
139 }; 142 };
140 143
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 rtc::scoped_refptr<FakeRTCStatsCollector> collector_; 596 rtc::scoped_refptr<FakeRTCStatsCollector> collector_;
594 }; 597 };
595 598
596 TEST_F(RTCStatsCollectorTestWithFakeCollector, ThreadUsageAndResultsMerging) { 599 TEST_F(RTCStatsCollectorTestWithFakeCollector, ThreadUsageAndResultsMerging) {
597 collector_->VerifyThreadUsageAndResultsMerging(); 600 collector_->VerifyThreadUsageAndResultsMerging();
598 } 601 }
599 602
600 } // namespace 603 } // namespace
601 604
602 } // namespace webrtc 605 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/api/peerconnectioninterface_unittest.cc ('k') | webrtc/api/rtpsenderreceiver_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698