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

Side by Side Diff: webrtc/pc/rtcstats_integrationtest.cc

Issue 2979963002: Revert of Make the default ctor of rtc::Thread, protected (Closed)
Patch Set: Created 3 years, 5 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
« no previous file with comments | « webrtc/pc/proxy_unittest.cc ('k') | webrtc/pc/test/fakeaudiocapturemodule.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 16 matching lines...) Expand all
27 27
28 namespace webrtc { 28 namespace webrtc {
29 29
30 namespace { 30 namespace {
31 31
32 const int64_t kGetStatsTimeoutMs = 10000; 32 const int64_t kGetStatsTimeoutMs = 10000;
33 33
34 class RTCStatsIntegrationTest : public testing::Test { 34 class RTCStatsIntegrationTest : public testing::Test {
35 public: 35 public:
36 RTCStatsIntegrationTest() 36 RTCStatsIntegrationTest()
37 : network_thread_(new rtc::Thread(&virtual_socket_server_)), 37 : network_thread_(&virtual_socket_server_), worker_thread_() {
38 worker_thread_(rtc::Thread::Create()) { 38 RTC_CHECK(network_thread_.Start());
39 RTC_CHECK(network_thread_->Start()); 39 RTC_CHECK(worker_thread_.Start());
40 RTC_CHECK(worker_thread_->Start());
41 40
42 caller_ = new rtc::RefCountedObject<PeerConnectionTestWrapper>( 41 caller_ = new rtc::RefCountedObject<PeerConnectionTestWrapper>(
43 "caller", network_thread_.get(), worker_thread_.get()); 42 "caller", &network_thread_, &worker_thread_);
44 callee_ = new rtc::RefCountedObject<PeerConnectionTestWrapper>( 43 callee_ = new rtc::RefCountedObject<PeerConnectionTestWrapper>(
45 "callee", network_thread_.get(), worker_thread_.get()); 44 "callee", &network_thread_, &worker_thread_);
46 } 45 }
47 46
48 void StartCall() { 47 void StartCall() {
49 // Create PeerConnections and "connect" sigslots 48 // Create PeerConnections and "connect" sigslots
50 PeerConnectionInterface::RTCConfiguration config; 49 PeerConnectionInterface::RTCConfiguration config;
51 PeerConnectionInterface::IceServer ice_server; 50 PeerConnectionInterface::IceServer ice_server;
52 ice_server.uri = "stun:1.1.1.1:3478"; 51 ice_server.uri = "stun:1.1.1.1:3478";
53 config.servers.push_back(ice_server); 52 config.servers.push_back(ice_server);
54 EXPECT_TRUE(caller_->CreatePc(nullptr, config, 53 EXPECT_TRUE(caller_->CreatePc(nullptr, config,
55 CreateBuiltinAudioEncoderFactory(), 54 CreateBuiltinAudioEncoderFactory(),
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 rtc::scoped_refptr<RTCStatsObtainer> stats_obtainer = 89 rtc::scoped_refptr<RTCStatsObtainer> stats_obtainer =
91 RTCStatsObtainer::Create(); 90 RTCStatsObtainer::Create();
92 pc->GetStats(stats_obtainer); 91 pc->GetStats(stats_obtainer);
93 EXPECT_TRUE_WAIT(stats_obtainer->report(), kGetStatsTimeoutMs); 92 EXPECT_TRUE_WAIT(stats_obtainer->report(), kGetStatsTimeoutMs);
94 return stats_obtainer->report(); 93 return stats_obtainer->report();
95 } 94 }
96 95
97 // |network_thread_| uses |virtual_socket_server_| so they must be 96 // |network_thread_| uses |virtual_socket_server_| so they must be
98 // constructed/destructed in the correct order. 97 // constructed/destructed in the correct order.
99 rtc::VirtualSocketServer virtual_socket_server_; 98 rtc::VirtualSocketServer virtual_socket_server_;
100 std::unique_ptr<rtc::Thread> network_thread_; 99 rtc::Thread network_thread_;
101 std::unique_ptr<rtc::Thread> worker_thread_; 100 rtc::Thread worker_thread_;
102 rtc::scoped_refptr<PeerConnectionTestWrapper> caller_; 101 rtc::scoped_refptr<PeerConnectionTestWrapper> caller_;
103 rtc::scoped_refptr<PeerConnectionTestWrapper> callee_; 102 rtc::scoped_refptr<PeerConnectionTestWrapper> callee_;
104 }; 103 };
105 104
106 class RTCStatsVerifier { 105 class RTCStatsVerifier {
107 public: 106 public:
108 RTCStatsVerifier(const RTCStatsReport* report, const RTCStats* stats) 107 RTCStatsVerifier(const RTCStatsReport* report, const RTCStats* stats)
109 : report_(report), stats_(stats), all_tests_successful_(true) { 108 : report_(report), stats_(stats), all_tests_successful_(true) {
110 RTC_CHECK(report_); 109 RTC_CHECK(report_);
111 RTC_CHECK(stats_); 110 RTC_CHECK(stats_);
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 caller_ = nullptr; 643 caller_ = nullptr;
645 // Any pending stats requests should have completed in the act of destroying 644 // Any pending stats requests should have completed in the act of destroying
646 // the peer connection. 645 // the peer connection.
647 EXPECT_TRUE(stats_obtainer->report()); 646 EXPECT_TRUE(stats_obtainer->report());
648 } 647 }
649 #endif // HAVE_SCTP 648 #endif // HAVE_SCTP
650 649
651 } // namespace 650 } // namespace
652 651
653 } // namespace webrtc 652 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/pc/proxy_unittest.cc ('k') | webrtc/pc/test/fakeaudiocapturemodule.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698