| OLD | NEW |
| 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 Loading... |
| 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_(&virtual_socket_server_), worker_thread_() { | 37 : network_thread_(new rtc::Thread(&virtual_socket_server_)), |
| 38 RTC_CHECK(network_thread_.Start()); | 38 worker_thread_(rtc::Thread::Create()) { |
| 39 RTC_CHECK(worker_thread_.Start()); | 39 RTC_CHECK(network_thread_->Start()); |
| 40 RTC_CHECK(worker_thread_->Start()); |
| 40 | 41 |
| 41 caller_ = new rtc::RefCountedObject<PeerConnectionTestWrapper>( | 42 caller_ = new rtc::RefCountedObject<PeerConnectionTestWrapper>( |
| 42 "caller", &network_thread_, &worker_thread_); | 43 "caller", network_thread_.get(), worker_thread_.get()); |
| 43 callee_ = new rtc::RefCountedObject<PeerConnectionTestWrapper>( | 44 callee_ = new rtc::RefCountedObject<PeerConnectionTestWrapper>( |
| 44 "callee", &network_thread_, &worker_thread_); | 45 "callee", network_thread_.get(), worker_thread_.get()); |
| 45 } | 46 } |
| 46 | 47 |
| 47 void StartCall() { | 48 void StartCall() { |
| 48 // Create PeerConnections and "connect" sigslots | 49 // Create PeerConnections and "connect" sigslots |
| 49 PeerConnectionInterface::RTCConfiguration config; | 50 PeerConnectionInterface::RTCConfiguration config; |
| 50 PeerConnectionInterface::IceServer ice_server; | 51 PeerConnectionInterface::IceServer ice_server; |
| 51 ice_server.uri = "stun:1.1.1.1:3478"; | 52 ice_server.uri = "stun:1.1.1.1:3478"; |
| 52 config.servers.push_back(ice_server); | 53 config.servers.push_back(ice_server); |
| 53 EXPECT_TRUE(caller_->CreatePc(nullptr, config, | 54 EXPECT_TRUE(caller_->CreatePc(nullptr, config, |
| 54 CreateBuiltinAudioEncoderFactory(), | 55 CreateBuiltinAudioEncoderFactory(), |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 rtc::scoped_refptr<RTCStatsObtainer> stats_obtainer = | 90 rtc::scoped_refptr<RTCStatsObtainer> stats_obtainer = |
| 90 RTCStatsObtainer::Create(); | 91 RTCStatsObtainer::Create(); |
| 91 pc->GetStats(stats_obtainer); | 92 pc->GetStats(stats_obtainer); |
| 92 EXPECT_TRUE_WAIT(stats_obtainer->report(), kGetStatsTimeoutMs); | 93 EXPECT_TRUE_WAIT(stats_obtainer->report(), kGetStatsTimeoutMs); |
| 93 return stats_obtainer->report(); | 94 return stats_obtainer->report(); |
| 94 } | 95 } |
| 95 | 96 |
| 96 // |network_thread_| uses |virtual_socket_server_| so they must be | 97 // |network_thread_| uses |virtual_socket_server_| so they must be |
| 97 // constructed/destructed in the correct order. | 98 // constructed/destructed in the correct order. |
| 98 rtc::VirtualSocketServer virtual_socket_server_; | 99 rtc::VirtualSocketServer virtual_socket_server_; |
| 99 rtc::Thread network_thread_; | 100 std::unique_ptr<rtc::Thread> network_thread_; |
| 100 rtc::Thread worker_thread_; | 101 std::unique_ptr<rtc::Thread> worker_thread_; |
| 101 rtc::scoped_refptr<PeerConnectionTestWrapper> caller_; | 102 rtc::scoped_refptr<PeerConnectionTestWrapper> caller_; |
| 102 rtc::scoped_refptr<PeerConnectionTestWrapper> callee_; | 103 rtc::scoped_refptr<PeerConnectionTestWrapper> callee_; |
| 103 }; | 104 }; |
| 104 | 105 |
| 105 class RTCStatsVerifier { | 106 class RTCStatsVerifier { |
| 106 public: | 107 public: |
| 107 RTCStatsVerifier(const RTCStatsReport* report, const RTCStats* stats) | 108 RTCStatsVerifier(const RTCStatsReport* report, const RTCStats* stats) |
| 108 : report_(report), stats_(stats), all_tests_successful_(true) { | 109 : report_(report), stats_(stats), all_tests_successful_(true) { |
| 109 RTC_CHECK(report_); | 110 RTC_CHECK(report_); |
| 110 RTC_CHECK(stats_); | 111 RTC_CHECK(stats_); |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 caller_ = nullptr; | 644 caller_ = nullptr; |
| 644 // Any pending stats requests should have completed in the act of destroying | 645 // Any pending stats requests should have completed in the act of destroying |
| 645 // the peer connection. | 646 // the peer connection. |
| 646 EXPECT_TRUE(stats_obtainer->report()); | 647 EXPECT_TRUE(stats_obtainer->report()); |
| 647 } | 648 } |
| 648 #endif // HAVE_SCTP | 649 #endif // HAVE_SCTP |
| 649 | 650 |
| 650 } // namespace | 651 } // namespace |
| 651 | 652 |
| 652 } // namespace webrtc | 653 } // namespace webrtc |
| OLD | NEW |