From eff5b854ad54281cfef5aeecbbbeb8faebb55c97 Mon Sep 17 00:00:00 2001 From: deadbeef Date: Fri, 27 May 2016 14:18:01 -0700 Subject: [PATCH] Making peerconnection_unittest use the virtual socket server it creates. When this test was updated to use separate worker/signaling threads, the virtual socket server wasn't moved over to the worker thread. So it was set on the signaling thread and wasn't being used. Review-Url: https://codereview.webrtc.org/2015763002 Cr-Commit-Position: refs/heads/master@{#12951} --- webrtc/api/peerconnection_unittest.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/webrtc/api/peerconnection_unittest.cc b/webrtc/api/peerconnection_unittest.cc index 24411ab729..d6506703f0 100644 --- a/webrtc/api/peerconnection_unittest.cc +++ b/webrtc/api/peerconnection_unittest.cc @@ -1028,11 +1028,10 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver, class P2PTestConductor : public testing::Test { public: P2PTestConductor() - : network_thread_(rtc::Thread::CreateWithSocketServer()), - worker_thread_(rtc::Thread::Create()), - pss_(new rtc::PhysicalSocketServer), + : pss_(new rtc::PhysicalSocketServer), ss_(new rtc::VirtualSocketServer(pss_.get())), - ss_scope_(ss_.get()) { + network_thread_(new rtc::Thread(ss_.get())), + worker_thread_(rtc::Thread::Create()) { RTC_CHECK(network_thread_->Start()); RTC_CHECK(worker_thread_->Start()); } @@ -1313,13 +1312,14 @@ class P2PTestConductor : public testing::Test { } private: - // |worker_thread_| is used by both |initiating_client_| and - // |receiving_client_|. Must be destroyed last. - std::unique_ptr network_thread_; - std::unique_ptr worker_thread_; + // |ss_| is used by |network_thread_| so it must be destroyed later. std::unique_ptr pss_; std::unique_ptr ss_; - rtc::SocketServerScope ss_scope_; + // |network_thread_| and |worker_thread_| are used by both + // |initiating_client_| and |receiving_client_| so they must be destroyed + // later. + std::unique_ptr network_thread_; + std::unique_ptr worker_thread_; std::unique_ptr initiating_client_; std::unique_ptr receiving_client_; bool prefer_constraint_apis_ = true;