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

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

Issue 2015763002: Making peerconnection_unittest use the virtual socket server it creates. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 6 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 | « no previous file | no next file » | 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 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2012 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 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 // removed in the received SDP. 1021 // removed in the received SDP.
1022 bool remove_cvo_ = false; 1022 bool remove_cvo_ = false;
1023 1023
1024 rtc::scoped_refptr<DataChannelInterface> data_channel_; 1024 rtc::scoped_refptr<DataChannelInterface> data_channel_;
1025 std::unique_ptr<MockDataChannelObserver> data_observer_; 1025 std::unique_ptr<MockDataChannelObserver> data_observer_;
1026 }; 1026 };
1027 1027
1028 class P2PTestConductor : public testing::Test { 1028 class P2PTestConductor : public testing::Test {
1029 public: 1029 public:
1030 P2PTestConductor() 1030 P2PTestConductor()
1031 : network_thread_(rtc::Thread::CreateWithSocketServer()), 1031 : pss_(new rtc::PhysicalSocketServer),
1032 worker_thread_(rtc::Thread::Create()),
1033 pss_(new rtc::PhysicalSocketServer),
1034 ss_(new rtc::VirtualSocketServer(pss_.get())), 1032 ss_(new rtc::VirtualSocketServer(pss_.get())),
1035 ss_scope_(ss_.get()) { 1033 network_thread_(new rtc::Thread(ss_.get())),
1034 worker_thread_(rtc::Thread::Create()) {
1036 RTC_CHECK(network_thread_->Start()); 1035 RTC_CHECK(network_thread_->Start());
1037 RTC_CHECK(worker_thread_->Start()); 1036 RTC_CHECK(worker_thread_->Start());
1038 } 1037 }
1039 1038
1040 bool SessionActive() { 1039 bool SessionActive() {
1041 return initiating_client_->SessionActive() && 1040 return initiating_client_->SessionActive() &&
1042 receiving_client_->SessionActive(); 1041 receiving_client_->SessionActive();
1043 } 1042 }
1044 1043
1045 // Return true if the number of frames provided have been received 1044 // Return true if the number of frames provided have been received
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 // Set the |receiving_client_| to the |client| passed in and return the 1305 // Set the |receiving_client_| to the |client| passed in and return the
1307 // original |receiving_client_|. 1306 // original |receiving_client_|.
1308 PeerConnectionTestClient* set_receiving_client( 1307 PeerConnectionTestClient* set_receiving_client(
1309 PeerConnectionTestClient* client) { 1308 PeerConnectionTestClient* client) {
1310 PeerConnectionTestClient* old = receiving_client_.release(); 1309 PeerConnectionTestClient* old = receiving_client_.release();
1311 receiving_client_.reset(client); 1310 receiving_client_.reset(client);
1312 return old; 1311 return old;
1313 } 1312 }
1314 1313
1315 private: 1314 private:
1316 // |worker_thread_| is used by both |initiating_client_| and 1315 // |ss_| is used by |network_thread_| so it must be destroyed later.
1317 // |receiving_client_|. Must be destroyed last. 1316 std::unique_ptr<rtc::PhysicalSocketServer> pss_;
1317 std::unique_ptr<rtc::VirtualSocketServer> ss_;
1318 // |network_thread_| and |worker_thread_| are used by both
1319 // |initiating_client_| and |receiving_client_| so they must be destroyed
1320 // later.
1318 std::unique_ptr<rtc::Thread> network_thread_; 1321 std::unique_ptr<rtc::Thread> network_thread_;
1319 std::unique_ptr<rtc::Thread> worker_thread_; 1322 std::unique_ptr<rtc::Thread> worker_thread_;
1320 std::unique_ptr<rtc::PhysicalSocketServer> pss_;
1321 std::unique_ptr<rtc::VirtualSocketServer> ss_;
1322 rtc::SocketServerScope ss_scope_;
1323 std::unique_ptr<PeerConnectionTestClient> initiating_client_; 1323 std::unique_ptr<PeerConnectionTestClient> initiating_client_;
1324 std::unique_ptr<PeerConnectionTestClient> receiving_client_; 1324 std::unique_ptr<PeerConnectionTestClient> receiving_client_;
1325 bool prefer_constraint_apis_ = true; 1325 bool prefer_constraint_apis_ = true;
1326 }; 1326 };
1327 1327
1328 // Disable for TSan v2, see 1328 // Disable for TSan v2, see
1329 // https://code.google.com/p/webrtc/issues/detail?id=1205 for details. 1329 // https://code.google.com/p/webrtc/issues/detail?id=1205 for details.
1330 #if !defined(THREAD_SANITIZER) 1330 #if !defined(THREAD_SANITIZER)
1331 1331
1332 // This test sets up a Jsep call between two parties and test Dtmf. 1332 // This test sets up a Jsep call between two parties and test Dtmf.
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
2211 server.urls.push_back("turn:hostname2"); 2211 server.urls.push_back("turn:hostname2");
2212 servers.push_back(server); 2212 servers.push_back(server);
2213 EXPECT_TRUE(webrtc::ParseIceServers(servers, &stun_servers_, &turn_servers_)); 2213 EXPECT_TRUE(webrtc::ParseIceServers(servers, &stun_servers_, &turn_servers_));
2214 EXPECT_EQ(2U, turn_servers_.size()); 2214 EXPECT_EQ(2U, turn_servers_.size());
2215 EXPECT_NE(turn_servers_[0].priority, turn_servers_[1].priority); 2215 EXPECT_NE(turn_servers_[0].priority, turn_servers_[1].priority);
2216 } 2216 }
2217 2217
2218 #endif // if !defined(THREAD_SANITIZER) 2218 #endif // if !defined(THREAD_SANITIZER)
2219 2219
2220 } // namespace 2220 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698