Do not rely on specific ordering on generated candidates in TestGetAllPortsPortRange

This fixes another WebRTC swarming tests.

BUG=webrtc:6500

Review-Url: https://codereview.webrtc.org/2450983002
Cr-Commit-Position: refs/heads/master@{#14804}
This commit is contained in:
honghaiz
2016-10-27 11:44:17 -07:00
committed by Commit bot
parent 45d18eb034
commit a73df559d6

View File

@ -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_);
}