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

Unified 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, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/p2p/client/fakeportallocator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/client/portallocator_unittest.cc
diff --git a/webrtc/p2p/client/portallocator_unittest.cc b/webrtc/p2p/client/portallocator_unittest.cc
index 28938075756328e5d9a2cdf319195101f4eb6f08..92f995a3d7787550753eec544550b8fcb2371c24 100644
--- a/webrtc/p2p/client/portallocator_unittest.cc
+++ b/webrtc/p2p/client/portallocator_unittest.cc
@@ -1279,3 +1279,45 @@ TEST_F(PortAllocatorTest, TestEnableIPv6Addresses) {
kClientAddr);
EXPECT_EQ(4U, candidates_.size());
}
+
+TEST_F(PortAllocatorTest, TestStopGettingPorts) {
+ AddInterface(kClientAddr);
+ allocator_->set_step_delay(cricket::kDefaultStepDelay);
+ EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP));
+ session_->StartGettingPorts();
+ ASSERT_EQ_WAIT(2U, candidates_.size(), 1000);
+ EXPECT_EQ(2U, ports_.size());
+ session_->StopGettingPorts();
+ EXPECT_TRUE_WAIT(candidate_allocation_done_, 1000);
+
+ // After stopping getting ports, adding a new interface will not start
+ // getting ports again.
+ candidates_.clear();
+ ports_.clear();
+ candidate_allocation_done_ = false;
+ network_manager_.AddInterface(kClientAddr2);
+ rtc::Thread::Current()->ProcessMessages(1000);
+ EXPECT_EQ(0U, candidates_.size());
+ EXPECT_EQ(0U, ports_.size());
+}
+
+TEST_F(PortAllocatorTest, TestClearGettingPorts) {
+ AddInterface(kClientAddr);
+ allocator_->set_step_delay(cricket::kDefaultStepDelay);
+ EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP));
+ session_->StartGettingPorts();
+ ASSERT_EQ_WAIT(2U, candidates_.size(), 1000);
+ EXPECT_EQ(2U, ports_.size());
+ session_->ClearGettingPorts();
+ WAIT(candidate_allocation_done_, 1000);
+ EXPECT_FALSE(candidate_allocation_done_);
+
+ // After clearing getting ports, adding a new interface will start getting
+ // ports again.
+ candidates_.clear();
+ ports_.clear();
+ candidate_allocation_done_ = false;
+ network_manager_.AddInterface(kClientAddr2);
+ ASSERT_EQ_WAIT(2U, candidates_.size(), 1000);
+ EXPECT_EQ(2U, ports_.size());
+}
« no previous file with comments | « webrtc/p2p/client/fakeportallocator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698