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

Side by Side Diff: webrtc/p2p/client/portallocator_unittest.cc

Issue 1359363003: Make it possible to keep the port allocator session running (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 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 2009 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2009 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 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after
1272 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "udp", 1272 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "udp",
1273 kClientAddr); 1273 kClientAddr);
1274 EXPECT_PRED5(CheckCandidate, candidates_[2], 1274 EXPECT_PRED5(CheckCandidate, candidates_[2],
1275 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "tcp", 1275 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "tcp",
1276 kClientIPv6Addr); 1276 kClientIPv6Addr);
1277 EXPECT_PRED5(CheckCandidate, candidates_[3], 1277 EXPECT_PRED5(CheckCandidate, candidates_[3],
1278 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "tcp", 1278 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "tcp",
1279 kClientAddr); 1279 kClientAddr);
1280 EXPECT_EQ(4U, candidates_.size()); 1280 EXPECT_EQ(4U, candidates_.size());
1281 } 1281 }
1282
1283 TEST_F(PortAllocatorTest, TestStopGettingPorts) {
1284 AddInterface(kClientAddr);
1285 allocator_->set_step_delay(cricket::kDefaultStepDelay);
1286 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP));
1287 session_->StartGettingPorts();
1288 ASSERT_EQ_WAIT(2U, candidates_.size(), 1000);
1289 EXPECT_EQ(2U, ports_.size());
1290 session_->StopGettingPorts();
1291 EXPECT_TRUE_WAIT(candidate_allocation_done_, 1000);
1292
1293 // After stopping getting ports, adding a new interface will not start
1294 // getting ports again.
1295 candidates_.clear();
1296 ports_.clear();
1297 candidate_allocation_done_ = false;
1298 network_manager_.AddInterface(kClientAddr2);
1299 rtc::Thread::Current()->ProcessMessages(1000);
1300 EXPECT_EQ(0U, candidates_.size());
1301 EXPECT_EQ(0U, ports_.size());
1302 }
1303
1304 TEST_F(PortAllocatorTest, TestClearGettingPorts) {
1305 AddInterface(kClientAddr);
1306 allocator_->set_step_delay(cricket::kDefaultStepDelay);
1307 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP));
1308 session_->StartGettingPorts();
1309 ASSERT_EQ_WAIT(2U, candidates_.size(), 1000);
1310 EXPECT_EQ(2U, ports_.size());
1311 session_->ClearGettingPorts();
1312 WAIT(candidate_allocation_done_, 1000);
1313 EXPECT_FALSE(candidate_allocation_done_);
1314
1315 // After clearing getting ports, adding a new interface will start getting
1316 // ports again.
1317 candidates_.clear();
1318 ports_.clear();
1319 candidate_allocation_done_ = false;
1320 network_manager_.AddInterface(kClientAddr2);
1321 ASSERT_EQ_WAIT(2U, candidates_.size(), 1000);
1322 EXPECT_EQ(2U, ports_.size());
1323 }
OLDNEW
« webrtc/p2p/base/p2ptransportchannel.cc ('K') | « webrtc/p2p/client/fakeportallocator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698