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

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

Issue 2001093003: Attempting to fix flaky tests that deal with STUN timeout. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 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 | « webrtc/p2p/base/stunrequest.cc ('k') | 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 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 static const char kIceUfrag0[] = "TESTICEUFRAG0000"; 68 static const char kIceUfrag0[] = "TESTICEUFRAG0000";
69 // Based on ICE_PWD_LENGTH 69 // Based on ICE_PWD_LENGTH
70 static const char kIcePwd0[] = "TESTICEPWD00000000000000"; 70 static const char kIcePwd0[] = "TESTICEPWD00000000000000";
71 71
72 static const char kContentName[] = "test content"; 72 static const char kContentName[] = "test content";
73 73
74 static const int kDefaultAllocationTimeout = 1000; 74 static const int kDefaultAllocationTimeout = 1000;
75 static const char kTurnUsername[] = "test"; 75 static const char kTurnUsername[] = "test";
76 static const char kTurnPassword[] = "test"; 76 static const char kTurnPassword[] = "test";
77 77
78 // STUN timeout (with all retries) is 9500ms.
79 // Add some margin of error for slow bots.
80 // TODO(deadbeef): Use simulated clock instead of just increasing timeouts to
81 // fix flaky tests.
82 static const int kStunTimeoutMs = 15000;
83
78 namespace cricket { 84 namespace cricket {
79 85
80 // Helper for dumping candidates 86 // Helper for dumping candidates
81 std::ostream& operator<<(std::ostream& os, const cricket::Candidate& c) { 87 std::ostream& operator<<(std::ostream& os, const cricket::Candidate& c) {
82 os << c.ToString(); 88 os << c.ToString();
83 return os; 89 return os;
84 } 90 }
85 91
86 } // namespace cricket 92 } // namespace cricket
87 93
(...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after
1351 cricket::PORTALLOCATOR_ENABLE_SHARED_SOCKET); 1357 cricket::PORTALLOCATOR_ENABLE_SHARED_SOCKET);
1352 fss_->AddRule(false, rtc::FP_UDP, rtc::FD_ANY, kClientAddr); 1358 fss_->AddRule(false, rtc::FP_UDP, rtc::FD_ANY, kClientAddr);
1353 AddInterface(kClientAddr); 1359 AddInterface(kClientAddr);
1354 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP)); 1360 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP));
1355 session_->StartGettingPorts(); 1361 session_->StartGettingPorts();
1356 ASSERT_EQ_WAIT(1U, ports_.size(), kDefaultAllocationTimeout); 1362 ASSERT_EQ_WAIT(1U, ports_.size(), kDefaultAllocationTimeout);
1357 EXPECT_EQ(1U, candidates_.size()); 1363 EXPECT_EQ(1U, candidates_.size());
1358 EXPECT_PRED5(CheckCandidate, candidates_[0], 1364 EXPECT_PRED5(CheckCandidate, candidates_[0],
1359 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "udp", 1365 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "udp",
1360 kClientAddr); 1366 kClientAddr);
1361 // STUN timeout is 9sec. We need to wait to get candidate done signal. 1367 // STUN timeout is 9.5sec. We need to wait to get candidate done signal.
1362 EXPECT_TRUE_WAIT(candidate_allocation_done_, 10000); 1368 EXPECT_TRUE_WAIT(candidate_allocation_done_, kStunTimeoutMs);
1363 EXPECT_EQ(1U, candidates_.size()); 1369 EXPECT_EQ(1U, candidates_.size());
1364 } 1370 }
1365 1371
1366 // Test that when the NetworkManager doesn't have permission to enumerate 1372 // Test that when the NetworkManager doesn't have permission to enumerate
1367 // adapters, the PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION is specified 1373 // adapters, the PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION is specified
1368 // automatically. 1374 // automatically.
1369 TEST_F(BasicPortAllocatorTest, TestNetworkPermissionBlocked) { 1375 TEST_F(BasicPortAllocatorTest, TestNetworkPermissionBlocked) {
1370 network_manager_.set_default_local_addresses(kPrivateAddr.ipaddr(), 1376 network_manager_.set_default_local_addresses(kPrivateAddr.ipaddr(),
1371 rtc::IPAddress()); 1377 rtc::IPAddress());
1372 network_manager_.set_enumeration_permission( 1378 network_manager_.set_enumeration_permission(
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1491 EXPECT_EQ(1, port->component()); 1497 EXPECT_EQ(1, port->component());
1492 EXPECT_EQ(kIceUfrag0, port->username_fragment()); 1498 EXPECT_EQ(kIceUfrag0, port->username_fragment());
1493 EXPECT_EQ(kIcePwd0, port->password()); 1499 EXPECT_EQ(kIcePwd0, port->password());
1494 } 1500 }
1495 for (const cricket::Candidate& candidate : candidates) { 1501 for (const cricket::Candidate& candidate : candidates) {
1496 EXPECT_EQ(1, candidate.component()); 1502 EXPECT_EQ(1, candidate.component());
1497 EXPECT_EQ(kIceUfrag0, candidate.username()); 1503 EXPECT_EQ(kIceUfrag0, candidate.username());
1498 EXPECT_EQ(kIcePwd0, candidate.password()); 1504 EXPECT_EQ(kIcePwd0, candidate.password());
1499 } 1505 }
1500 } 1506 }
OLDNEW
« no previous file with comments | « webrtc/p2p/base/stunrequest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698