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

Unified Diff: webrtc/p2p/client/basicportallocator_unittest.cc

Issue 2450983002: Do not rely on specific ordering on generated candidates in TestGetAllPortsPortRange (Closed)
Patch Set: Address comments Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/client/basicportallocator_unittest.cc
diff --git a/webrtc/p2p/client/basicportallocator_unittest.cc b/webrtc/p2p/client/basicportallocator_unittest.cc
index afd65a42c5e0b5ea9a626c9be04411956ffa8542..253a15aaf3b2900bec6f9af290cb1e2c81d1ec2a 100644
--- a/webrtc/p2p/client/basicportallocator_unittest.cc
+++ b/webrtc/p2p/client/basicportallocator_unittest.cc
@@ -920,15 +920,19 @@ TEST_F(BasicPortAllocatorTest, TestGetAllPortsPortRange) {
session_->StartGettingPorts();
ASSERT_EQ_WAIT(7U, candidates_.size(), kDefaultAllocationTimeout);
EXPECT_EQ(4U, ports_.size());
- // Check the port number for the UDP port object.
- EXPECT_PRED3(CheckPort, candidates_[0].address(), kMinPort, kMaxPort);
- // Check the port number for the STUN port object.
- EXPECT_PRED3(CheckPort, candidates_[1].address(), kMinPort, kMaxPort);
+
+ int num_nonrelay_candidates = 0;
+ for (const Candidate& candidate : candidates_) {
+ // Check the port number for the UDP/STUN/TCP port objects.
+ if (candidate.type() != RELAY_PORT_TYPE) {
+ EXPECT_PRED3(CheckPort, candidate.address(), kMinPort, kMaxPort);
+ ++num_nonrelay_candidates;
+ }
+ }
+ EXPECT_EQ(3, num_nonrelay_candidates);
// Check the port number used to connect to the relay server.
EXPECT_PRED3(CheckPort, relay_server_.GetConnection(0).source(), kMinPort,
kMaxPort);
- // Check the port number for the TCP port object.
- EXPECT_PRED3(CheckPort, candidates_[5].address(), kMinPort, kMaxPort);
EXPECT_TRUE(candidate_allocation_done_);
}
« 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