| Index: webrtc/p2p/client/basicportallocator_unittest.cc
|
| diff --git a/webrtc/p2p/client/basicportallocator_unittest.cc b/webrtc/p2p/client/basicportallocator_unittest.cc
|
| index 4ace7c8a3c20496f7038b7300888bca6db7d6c38..5c15df2aade9de37715e5cd9dd587557da2c42d2 100644
|
| --- a/webrtc/p2p/client/basicportallocator_unittest.cc
|
| +++ b/webrtc/p2p/client/basicportallocator_unittest.cc
|
| @@ -18,6 +18,7 @@
|
| #include "webrtc/p2p/base/teststunserver.h"
|
| #include "webrtc/p2p/base/testturnserver.h"
|
| #include "webrtc/p2p/client/basicportallocator.h"
|
| +#include "webrtc/base/fakeclock.h"
|
| #include "webrtc/base/fakenetwork.h"
|
| #include "webrtc/base/firewallsocketserver.h"
|
| #include "webrtc/base/gunit.h"
|
| @@ -83,12 +84,6 @@ static const int kDefaultAllocationTimeout = 3000;
|
| static const char kTurnUsername[] = "test";
|
| static const char kTurnPassword[] = "test";
|
|
|
| -// STUN timeout (with all retries) is 9500ms.
|
| -// Add some margin of error for slow bots.
|
| -// TODO(deadbeef): Use simulated clock instead of just increasing timeouts to
|
| -// fix flaky tests.
|
| -static const int kStunTimeoutMs = 15000;
|
| -
|
| namespace cricket {
|
|
|
| // Helper for dumping candidates
|
| @@ -388,7 +383,8 @@ class BasicPortAllocatorTest : public testing::Test,
|
| PORTALLOCATOR_ENABLE_SHARED_SOCKET);
|
| allocator().set_allow_tcp_listen(false);
|
| session_->StartGettingPorts();
|
| - EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
|
| + EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
|
| + kDefaultAllocationTimeout, fake_clock);
|
|
|
| uint32_t total_candidates = 0;
|
| if (!host_candidate_addr.IsNil()) {
|
| @@ -528,7 +524,8 @@ class BasicPortAllocatorTest : public testing::Test,
|
|
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
|
| session_->StartGettingPorts();
|
| - EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
|
| + EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
|
| + kDefaultAllocationTimeout, fake_clock);
|
| // Only 2 ports (one STUN and one TURN) are actually being used.
|
| EXPECT_EQ(2U, session_->ReadyPorts().size());
|
| // We have verified that each port, when it is added to |ports_|, it is
|
| @@ -571,7 +568,8 @@ class BasicPortAllocatorTest : public testing::Test,
|
|
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
|
| session_->StartGettingPorts();
|
| - EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
|
| + EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
|
| + kDefaultAllocationTimeout, fake_clock);
|
| // Three ports (one IPv4 STUN, one IPv6 STUN and one TURN) will be ready.
|
| EXPECT_EQ(3U, session_->ReadyPorts().size());
|
| EXPECT_EQ(3U, ports_.size());
|
| @@ -613,7 +611,8 @@ class BasicPortAllocatorTest : public testing::Test,
|
| PORTALLOCATOR_ENABLE_IPV6);
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
|
| session_->StartGettingPorts();
|
| - EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
|
| + EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
|
| + kDefaultAllocationTimeout, fake_clock);
|
| // 10 ports (4 STUN and 1 TURN ports on each interface) will be ready to
|
| // use.
|
| EXPECT_EQ(10U, session_->ReadyPorts().size());
|
| @@ -651,6 +650,7 @@ class BasicPortAllocatorTest : public testing::Test,
|
| rtc::SocketAddress(kTurnUdpExtAddr.ipaddr(), 0));
|
| }
|
|
|
| + rtc::ScopedFakeClock fake_clock;
|
| std::unique_ptr<rtc::PhysicalSocketServer> pss_;
|
| std::unique_ptr<rtc::VirtualSocketServer> vss_;
|
| std::unique_ptr<rtc::FirewallSocketServer> fss_;
|
| @@ -702,7 +702,8 @@ TEST_F(BasicPortAllocatorTest, TestIgnoreOnlyLoopbackNetworkByDefault) {
|
| session_->set_flags(PORTALLOCATOR_DISABLE_STUN | PORTALLOCATOR_DISABLE_RELAY |
|
| PORTALLOCATOR_DISABLE_TCP);
|
| session_->StartGettingPorts();
|
| - EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
|
| + EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
|
| + kDefaultAllocationTimeout, fake_clock);
|
| EXPECT_EQ(4U, candidates_.size());
|
| for (Candidate candidate : candidates_) {
|
| EXPECT_LT(candidate.address().ip(), 0x12345604U);
|
| @@ -723,7 +724,8 @@ TEST_F(BasicPortAllocatorTest, TestIgnoreNetworksAccordingToIgnoreMask) {
|
| session_->set_flags(PORTALLOCATOR_DISABLE_STUN | PORTALLOCATOR_DISABLE_RELAY |
|
| PORTALLOCATOR_DISABLE_TCP);
|
| session_->StartGettingPorts();
|
| - EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
|
| + EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
|
| + kDefaultAllocationTimeout, fake_clock);
|
| EXPECT_EQ(1U, candidates_.size());
|
| EXPECT_EQ(0x12345602U, candidates_[0].address().ip());
|
| }
|
| @@ -745,7 +747,8 @@ TEST_F(BasicPortAllocatorTest, TestGatherLowCostNetworkOnly) {
|
| cricket::PORTALLOCATOR_DISABLE_COSTLY_NETWORKS);
|
| EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP));
|
| session_->StartGettingPorts();
|
| - EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
|
| + EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
|
| + kDefaultAllocationTimeout, fake_clock);
|
| EXPECT_EQ(1U, candidates_.size());
|
| EXPECT_TRUE(addr_wifi.EqualIPs(candidates_[0].address()));
|
|
|
| @@ -757,7 +760,8 @@ TEST_F(BasicPortAllocatorTest, TestGatherLowCostNetworkOnly) {
|
| AddInterface(addr_unknown1, "test_unknown0", rtc::ADAPTER_TYPE_UNKNOWN);
|
| AddInterface(addr_unknown2, "test_unknown1", rtc::ADAPTER_TYPE_UNKNOWN);
|
| session_->StartGettingPorts();
|
| - EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
|
| + EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
|
| + kDefaultAllocationTimeout, fake_clock);
|
| EXPECT_EQ(2U, candidates_.size());
|
| EXPECT_TRUE((addr_unknown1.EqualIPs(candidates_[0].address()) &&
|
| addr_unknown2.EqualIPs(candidates_[1].address())) ||
|
| @@ -770,7 +774,8 @@ TEST_F(BasicPortAllocatorTest, TestGatherLowCostNetworkOnly) {
|
| candidate_allocation_done_ = false;
|
| AddInterface(addr_wifi, "test_wlan0", rtc::ADAPTER_TYPE_WIFI);
|
| session_->StartGettingPorts();
|
| - EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
|
| + EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
|
| + kDefaultAllocationTimeout, fake_clock);
|
| EXPECT_EQ(1U, candidates_.size());
|
| EXPECT_TRUE(addr_wifi.EqualIPs(candidates_[0].address()));
|
| }
|
| @@ -783,7 +788,8 @@ TEST_F(BasicPortAllocatorTest, TestLoopbackNetworkInterface) {
|
| session_->set_flags(PORTALLOCATOR_DISABLE_STUN | PORTALLOCATOR_DISABLE_RELAY |
|
| PORTALLOCATOR_DISABLE_TCP);
|
| session_->StartGettingPorts();
|
| - EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
|
| + EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
|
| + kDefaultAllocationTimeout, fake_clock);
|
| EXPECT_EQ(1U, candidates_.size());
|
| }
|
|
|
| @@ -792,7 +798,8 @@ TEST_F(BasicPortAllocatorTest, TestGetAllPortsWithMinimumStepDelay) {
|
| AddInterface(kClientAddr);
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
|
| session_->StartGettingPorts();
|
| - ASSERT_EQ_WAIT(7U, candidates_.size(), kDefaultAllocationTimeout);
|
| + ASSERT_EQ_SIMULATED_WAIT(7U, candidates_.size(), kDefaultAllocationTimeout,
|
| + fake_clock);
|
| EXPECT_EQ(4U, ports_.size());
|
| EXPECT_PRED4(HasCandidate, candidates_, "local", "udp", kClientAddr);
|
| EXPECT_PRED4(HasCandidate, candidates_, "stun", "udp", kClientAddr);
|
| @@ -813,7 +820,8 @@ TEST_F(BasicPortAllocatorTest, TestSameNetworkDownAndUpWhenSessionNotStopped) {
|
| AddInterface(kClientAddr, if_name);
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
|
| session_->StartGettingPorts();
|
| - ASSERT_EQ_WAIT(7U, candidates_.size(), kDefaultAllocationTimeout);
|
| + ASSERT_EQ_SIMULATED_WAIT(7U, candidates_.size(), kDefaultAllocationTimeout,
|
| + fake_clock);
|
| EXPECT_EQ(4U, ports_.size());
|
| EXPECT_TRUE(candidate_allocation_done_);
|
| candidate_allocation_done_ = false;
|
| @@ -821,14 +829,16 @@ TEST_F(BasicPortAllocatorTest, TestSameNetworkDownAndUpWhenSessionNotStopped) {
|
| ports_.clear();
|
|
|
| RemoveInterface(kClientAddr);
|
| - ASSERT_EQ_WAIT(0U, candidates_.size(), kDefaultAllocationTimeout);
|
| + ASSERT_EQ_SIMULATED_WAIT(0U, candidates_.size(), kDefaultAllocationTimeout,
|
| + fake_clock);
|
| EXPECT_EQ(0U, ports_.size());
|
| EXPECT_FALSE(candidate_allocation_done_);
|
|
|
| // When the same interfaces are added again, new candidates/ports should be
|
| // generated.
|
| AddInterface(kClientAddr, if_name);
|
| - ASSERT_EQ_WAIT(7U, candidates_.size(), kDefaultAllocationTimeout);
|
| + ASSERT_EQ_SIMULATED_WAIT(7U, candidates_.size(), kDefaultAllocationTimeout,
|
| + fake_clock);
|
| EXPECT_EQ(4U, ports_.size());
|
| EXPECT_TRUE(candidate_allocation_done_);
|
| }
|
| @@ -841,7 +851,8 @@ TEST_F(BasicPortAllocatorTest, TestSameNetworkDownAndUpWhenSessionStopped) {
|
| AddInterface(kClientAddr, if_name);
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
|
| session_->StartGettingPorts();
|
| - ASSERT_EQ_WAIT(7U, candidates_.size(), kDefaultAllocationTimeout);
|
| + ASSERT_EQ_SIMULATED_WAIT(7U, candidates_.size(), kDefaultAllocationTimeout,
|
| + fake_clock);
|
| EXPECT_EQ(4U, ports_.size());
|
| EXPECT_TRUE(candidate_allocation_done_);
|
| session_->StopGettingPorts();
|
| @@ -849,13 +860,15 @@ TEST_F(BasicPortAllocatorTest, TestSameNetworkDownAndUpWhenSessionStopped) {
|
| ports_.clear();
|
|
|
| RemoveInterface(kClientAddr);
|
| - ASSERT_EQ_WAIT(0U, candidates_.size(), kDefaultAllocationTimeout);
|
| + ASSERT_EQ_SIMULATED_WAIT(0U, candidates_.size(), kDefaultAllocationTimeout,
|
| + fake_clock);
|
| EXPECT_EQ(0U, ports_.size());
|
|
|
| // When the same interfaces are added again, new candidates/ports should not
|
| // be generated because the session has stopped.
|
| AddInterface(kClientAddr, if_name);
|
| - ASSERT_EQ_WAIT(0U, candidates_.size(), kDefaultAllocationTimeout);
|
| + ASSERT_EQ_SIMULATED_WAIT(0U, candidates_.size(), kDefaultAllocationTimeout,
|
| + fake_clock);
|
| EXPECT_EQ(0U, ports_.size());
|
| EXPECT_TRUE(candidate_allocation_done_);
|
| }
|
| @@ -866,17 +879,17 @@ TEST_F(BasicPortAllocatorTest, TestGetAllPortsWithOneSecondStepDelay) {
|
| allocator_->set_step_delay(kDefaultStepDelay);
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
|
| session_->StartGettingPorts();
|
| - ASSERT_EQ_WAIT(2U, candidates_.size(), 1000);
|
| + ASSERT_EQ_SIMULATED_WAIT(2U, candidates_.size(), 1000, fake_clock);
|
| EXPECT_EQ(2U, ports_.size());
|
| - ASSERT_EQ_WAIT(4U, candidates_.size(), 2000);
|
| + ASSERT_EQ_SIMULATED_WAIT(4U, candidates_.size(), 2000, fake_clock);
|
| EXPECT_EQ(3U, ports_.size());
|
| EXPECT_PRED4(HasCandidate, candidates_, "relay", "udp", kRelayUdpIntAddr);
|
| EXPECT_PRED4(HasCandidate, candidates_, "relay", "udp", kRelayUdpExtAddr);
|
| - ASSERT_EQ_WAIT(6U, candidates_.size(), 1500);
|
| + ASSERT_EQ_SIMULATED_WAIT(6U, candidates_.size(), 1500, fake_clock);
|
| EXPECT_PRED4(HasCandidate, candidates_, "relay", "tcp", kRelayTcpIntAddr);
|
| EXPECT_PRED4(HasCandidate, candidates_, "local", "tcp", kClientAddr);
|
| EXPECT_EQ(4U, ports_.size());
|
| - ASSERT_EQ_WAIT(7U, candidates_.size(), 2000);
|
| + ASSERT_EQ_SIMULATED_WAIT(7U, candidates_.size(), 2000, fake_clock);
|
| EXPECT_PRED4(HasCandidate, candidates_, "relay", "ssltcp",
|
| kRelaySslTcpIntAddr);
|
| EXPECT_EQ(4U, ports_.size());
|
| @@ -889,7 +902,8 @@ TEST_F(BasicPortAllocatorTest, TestSetupVideoRtpPortsWithNormalSendBuffers) {
|
| AddInterface(kClientAddr);
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP, CN_VIDEO));
|
| session_->StartGettingPorts();
|
| - ASSERT_EQ_WAIT(7U, candidates_.size(), kDefaultAllocationTimeout);
|
| + ASSERT_EQ_SIMULATED_WAIT(7U, candidates_.size(), kDefaultAllocationTimeout,
|
| + fake_clock);
|
| EXPECT_TRUE(candidate_allocation_done_);
|
| // If we Stop gathering now, we shouldn't get a second "done" callback.
|
| session_->StopGettingPorts();
|
| @@ -903,10 +917,12 @@ TEST_F(BasicPortAllocatorTest, TestStopGetAllPorts) {
|
| AddInterface(kClientAddr);
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
|
| session_->StartGettingPorts();
|
| - ASSERT_EQ_WAIT(2U, candidates_.size(), kDefaultAllocationTimeout);
|
| + ASSERT_EQ_SIMULATED_WAIT(2U, candidates_.size(), kDefaultAllocationTimeout,
|
| + fake_clock);
|
| EXPECT_EQ(2U, ports_.size());
|
| session_->StopGettingPorts();
|
| - EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
|
| + EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
|
| + kDefaultAllocationTimeout, fake_clock);
|
| }
|
|
|
| // Test that we restrict client ports appropriately when a port range is set.
|
| @@ -922,7 +938,8 @@ TEST_F(BasicPortAllocatorTest, TestGetAllPortsPortRange) {
|
| EXPECT_TRUE(SetPortRange(kMinPort, kMaxPort));
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
|
| session_->StartGettingPorts();
|
| - ASSERT_EQ_WAIT(7U, candidates_.size(), kDefaultAllocationTimeout);
|
| + ASSERT_EQ_SIMULATED_WAIT(7U, candidates_.size(), kDefaultAllocationTimeout,
|
| + fake_clock);
|
| EXPECT_EQ(4U, ports_.size());
|
|
|
| int num_nonrelay_candidates = 0;
|
| @@ -955,7 +972,8 @@ TEST_F(BasicPortAllocatorTest, TestGetAllPortsNoAdapters) {
|
| network_manager_.set_ipv6_enabled(false);
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
|
| session_->StartGettingPorts();
|
| - EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
|
| + EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
|
| + kDefaultAllocationTimeout, fake_clock);
|
| EXPECT_EQ(4U, ports_.size());
|
| EXPECT_EQ(1, CountPorts(ports_, "stun", PROTO_UDP, kAnyAddr));
|
| EXPECT_EQ(1, CountPorts(ports_, "local", PROTO_TCP, kAnyAddr));
|
| @@ -1092,7 +1110,8 @@ TEST_F(BasicPortAllocatorTest, TestDisableUdpTurn) {
|
| PORTALLOCATOR_ENABLE_SHARED_SOCKET);
|
|
|
| session_->StartGettingPorts();
|
| - EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
|
| + EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
|
| + kDefaultAllocationTimeout, fake_clock);
|
|
|
| // Expect to see 2 ports and 2 candidates - TURN/TCP and TCP ports, TCP and
|
| // TURN/TCP candidates.
|
| @@ -1118,9 +1137,8 @@ TEST_F(BasicPortAllocatorTest, TestDisableAllPorts) {
|
| session_->set_flags(PORTALLOCATOR_DISABLE_UDP | PORTALLOCATOR_DISABLE_STUN |
|
| PORTALLOCATOR_DISABLE_RELAY | PORTALLOCATOR_DISABLE_TCP);
|
| session_->StartGettingPorts();
|
| - rtc::Thread::Current()->ProcessMessages(100);
|
| + EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_, 1000, fake_clock);
|
| EXPECT_EQ(0U, candidates_.size());
|
| - EXPECT_TRUE(candidate_allocation_done_);
|
| }
|
|
|
| // Test that we don't crash or malfunction if we can't create UDP sockets.
|
| @@ -1129,7 +1147,8 @@ TEST_F(BasicPortAllocatorTest, TestGetAllPortsNoUdpSockets) {
|
| fss_->set_udp_sockets_enabled(false);
|
| EXPECT_TRUE(CreateSession(1));
|
| session_->StartGettingPorts();
|
| - ASSERT_EQ_WAIT(5U, candidates_.size(), kDefaultAllocationTimeout);
|
| + ASSERT_EQ_SIMULATED_WAIT(5U, candidates_.size(), kDefaultAllocationTimeout,
|
| + fake_clock);
|
| EXPECT_EQ(2U, ports_.size());
|
| EXPECT_PRED4(HasCandidate, candidates_, "relay", "udp", kRelayUdpIntAddr);
|
| EXPECT_PRED4(HasCandidate, candidates_, "relay", "udp", kRelayUdpExtAddr);
|
| @@ -1151,7 +1170,8 @@ TEST_F(BasicPortAllocatorTest, TestGetAllPortsNoUdpSocketsNoTcpListen) {
|
| fss_->set_tcp_listen_enabled(false);
|
| EXPECT_TRUE(CreateSession(1));
|
| session_->StartGettingPorts();
|
| - ASSERT_EQ_WAIT(5U, candidates_.size(), kDefaultAllocationTimeout);
|
| + ASSERT_EQ_SIMULATED_WAIT(5U, candidates_.size(), kDefaultAllocationTimeout,
|
| + fake_clock);
|
| EXPECT_EQ(2U, ports_.size());
|
| EXPECT_PRED4(HasCandidate, candidates_, "relay", "udp", kRelayUdpIntAddr);
|
| EXPECT_PRED4(HasCandidate, candidates_, "relay", "udp", kRelayUdpExtAddr);
|
| @@ -1182,23 +1202,22 @@ TEST_F(BasicPortAllocatorTest, TestGetAllPortsNoUdpAllowed) {
|
| AddInterface(kClientAddr);
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
|
| session_->StartGettingPorts();
|
| - EXPECT_EQ_WAIT(2U, candidates_.size(), kDefaultAllocationTimeout);
|
| + EXPECT_EQ_SIMULATED_WAIT(2U, candidates_.size(), kDefaultAllocationTimeout,
|
| + fake_clock);
|
| EXPECT_EQ(2U, ports_.size());
|
| EXPECT_PRED4(HasCandidate, candidates_, "local", "udp", kClientAddr);
|
| EXPECT_PRED4(HasCandidate, candidates_, "local", "tcp", kClientAddr);
|
| // RelayPort connection timeout is 3sec. TCP connection with RelayServer
|
| - // will be tried after 3 seconds.
|
| - // TODO(deadbeef): Use simulated clock here, waiting for exactly 3 seconds.
|
| - EXPECT_EQ_WAIT(6U, candidates_.size(), kStunTimeoutMs);
|
| + // will be tried after about 3 seconds.
|
| + EXPECT_EQ_SIMULATED_WAIT(6U, candidates_.size(), 3500, fake_clock);
|
| EXPECT_EQ(3U, ports_.size());
|
| EXPECT_PRED4(HasCandidate, candidates_, "relay", "udp", kRelayUdpIntAddr);
|
| EXPECT_PRED4(HasCandidate, candidates_, "relay", "tcp", kRelayTcpIntAddr);
|
| EXPECT_PRED4(HasCandidate, candidates_, "relay", "ssltcp",
|
| kRelaySslTcpIntAddr);
|
| EXPECT_PRED4(HasCandidate, candidates_, "relay", "udp", kRelayUdpExtAddr);
|
| - // Stun Timeout is 9.5sec.
|
| - // TODO(deadbeef): Use simulated clock here, waiting exactly 6.5 seconds.
|
| - EXPECT_TRUE_WAIT(candidate_allocation_done_, kStunTimeoutMs);
|
| + EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
|
| + cricket::STUN_TOTAL_TIMEOUT, fake_clock);
|
| }
|
|
|
| TEST_F(BasicPortAllocatorTest, TestCandidatePriorityOfMultipleInterfaces) {
|
| @@ -1210,7 +1229,8 @@ TEST_F(BasicPortAllocatorTest, TestCandidatePriorityOfMultipleInterfaces) {
|
| PORTALLOCATOR_DISABLE_RELAY);
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
|
| session_->StartGettingPorts();
|
| - EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
|
| + EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
|
| + kDefaultAllocationTimeout, fake_clock);
|
| ASSERT_EQ(2U, candidates_.size());
|
| EXPECT_EQ(2U, ports_.size());
|
| // Candidates priorities should be different.
|
| @@ -1222,7 +1242,8 @@ TEST_F(BasicPortAllocatorTest, TestGetAllPortsRestarts) {
|
| AddInterface(kClientAddr);
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
|
| session_->StartGettingPorts();
|
| - EXPECT_EQ_WAIT(7U, candidates_.size(), kDefaultAllocationTimeout);
|
| + EXPECT_EQ_SIMULATED_WAIT(7U, candidates_.size(), kDefaultAllocationTimeout,
|
| + fake_clock);
|
| EXPECT_EQ(4U, ports_.size());
|
| EXPECT_TRUE(candidate_allocation_done_);
|
| // TODO(deadbeef): Extend this to verify ICE restart.
|
| @@ -1240,7 +1261,8 @@ TEST_F(BasicPortAllocatorTest, TestSessionUsesOwnCandidateFilter) {
|
| session_->StartGettingPorts();
|
| // 7 candidates and 4 ports is what we would normally get (see the
|
| // TestGetAllPorts* tests).
|
| - EXPECT_EQ_WAIT(7U, candidates_.size(), kDefaultAllocationTimeout);
|
| + EXPECT_EQ_SIMULATED_WAIT(7U, candidates_.size(), kDefaultAllocationTimeout,
|
| + fake_clock);
|
| EXPECT_EQ(4U, ports_.size());
|
| EXPECT_TRUE(candidate_allocation_done_);
|
| }
|
| @@ -1257,7 +1279,8 @@ TEST_F(BasicPortAllocatorTest, TestCandidateFilterWithRelayOnly) {
|
| allocator().set_candidate_filter(CF_RELAY);
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
|
| session_->StartGettingPorts();
|
| - EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
|
| + EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
|
| + kDefaultAllocationTimeout, fake_clock);
|
| EXPECT_PRED4(HasCandidate, candidates_, "relay", "udp",
|
| rtc::SocketAddress(kTurnUdpExtAddr.ipaddr(), 0));
|
|
|
| @@ -1275,7 +1298,8 @@ TEST_F(BasicPortAllocatorTest, TestCandidateFilterWithHostOnly) {
|
| allocator().set_candidate_filter(CF_HOST);
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
|
| session_->StartGettingPorts();
|
| - EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
|
| + EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
|
| + kDefaultAllocationTimeout, fake_clock);
|
| EXPECT_EQ(2U, candidates_.size()); // Host UDP/TCP candidates only.
|
| EXPECT_EQ(2U, ports_.size()); // UDP/TCP ports only.
|
| for (const Candidate& candidate : candidates_) {
|
| @@ -1292,7 +1316,8 @@ TEST_F(BasicPortAllocatorTest, TestCandidateFilterWithReflexiveOnly) {
|
| allocator().set_candidate_filter(CF_REFLEXIVE);
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
|
| session_->StartGettingPorts();
|
| - EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
|
| + EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
|
| + kDefaultAllocationTimeout, fake_clock);
|
| // Host is behind NAT, no private address will be exposed. Hence only UDP
|
| // port with STUN candidate will be sent outside.
|
| EXPECT_EQ(1U, candidates_.size()); // Only STUN candidate.
|
| @@ -1310,7 +1335,8 @@ TEST_F(BasicPortAllocatorTest, TestCandidateFilterWithReflexiveOnlyAndNoNAT) {
|
| allocator().set_candidate_filter(CF_REFLEXIVE);
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
|
| session_->StartGettingPorts();
|
| - EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
|
| + EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
|
| + kDefaultAllocationTimeout, fake_clock);
|
| // Host has a public address, both UDP and TCP candidates will be exposed.
|
| EXPECT_EQ(2U, candidates_.size()); // Local UDP + TCP candidate.
|
| EXPECT_EQ(2U, ports_.size()); // UDP and TCP ports will be in ready state.
|
| @@ -1324,7 +1350,8 @@ TEST_F(BasicPortAllocatorTest, TestEnableSharedUfrag) {
|
| AddInterface(kClientAddr);
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
|
| session_->StartGettingPorts();
|
| - ASSERT_EQ_WAIT(7U, candidates_.size(), kDefaultAllocationTimeout);
|
| + ASSERT_EQ_SIMULATED_WAIT(7U, candidates_.size(), kDefaultAllocationTimeout,
|
| + fake_clock);
|
| EXPECT_PRED4(HasCandidate, candidates_, "local", "udp", kClientAddr);
|
| EXPECT_PRED4(HasCandidate, candidates_, "stun", "udp", kClientAddr);
|
| EXPECT_PRED4(HasCandidate, candidates_, "local", "tcp", kClientAddr);
|
| @@ -1346,10 +1373,12 @@ TEST_F(BasicPortAllocatorTest, TestSharedSocketWithoutNat) {
|
| PORTALLOCATOR_ENABLE_SHARED_SOCKET);
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
|
| session_->StartGettingPorts();
|
| - ASSERT_EQ_WAIT(6U, candidates_.size(), kDefaultAllocationTimeout);
|
| + ASSERT_EQ_SIMULATED_WAIT(6U, candidates_.size(), kDefaultAllocationTimeout,
|
| + fake_clock);
|
| EXPECT_EQ(3U, ports_.size());
|
| EXPECT_PRED4(HasCandidate, candidates_, "local", "udp", kClientAddr);
|
| - EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
|
| + EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
|
| + kDefaultAllocationTimeout, fake_clock);
|
| }
|
|
|
| // Test that when PORTALLOCATOR_ENABLE_SHARED_SOCKET is enabled only one port
|
| @@ -1363,12 +1392,14 @@ TEST_F(BasicPortAllocatorTest, TestSharedSocketWithNat) {
|
| PORTALLOCATOR_ENABLE_SHARED_SOCKET);
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
|
| session_->StartGettingPorts();
|
| - ASSERT_EQ_WAIT(3U, candidates_.size(), kDefaultAllocationTimeout);
|
| + ASSERT_EQ_SIMULATED_WAIT(3U, candidates_.size(), kDefaultAllocationTimeout,
|
| + fake_clock);
|
| ASSERT_EQ(2U, ports_.size());
|
| EXPECT_PRED4(HasCandidate, candidates_, "local", "udp", kClientAddr);
|
| EXPECT_PRED4(HasCandidate, candidates_, "stun", "udp",
|
| rtc::SocketAddress(kNatUdpAddr.ipaddr(), 0));
|
| - EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
|
| + EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
|
| + kDefaultAllocationTimeout, fake_clock);
|
| EXPECT_EQ(3U, candidates_.size());
|
| }
|
|
|
| @@ -1388,14 +1419,16 @@ TEST_F(BasicPortAllocatorTest, TestSharedSocketWithoutNatUsingTurn) {
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
|
| session_->StartGettingPorts();
|
|
|
| - ASSERT_EQ_WAIT(3U, candidates_.size(), kDefaultAllocationTimeout);
|
| + ASSERT_EQ_SIMULATED_WAIT(3U, candidates_.size(), kDefaultAllocationTimeout,
|
| + fake_clock);
|
| ASSERT_EQ(3U, ports_.size());
|
| EXPECT_PRED4(HasCandidate, candidates_, "local", "udp", kClientAddr);
|
| EXPECT_PRED4(HasCandidate, candidates_, "relay", "udp",
|
| rtc::SocketAddress(kTurnUdpExtAddr.ipaddr(), 0));
|
| EXPECT_PRED4(HasCandidate, candidates_, "relay", "udp",
|
| rtc::SocketAddress(kTurnUdpExtAddr.ipaddr(), 0));
|
| - EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
|
| + EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
|
| + kDefaultAllocationTimeout, fake_clock);
|
| EXPECT_EQ(3U, candidates_.size());
|
| }
|
|
|
| @@ -1489,7 +1522,8 @@ TEST_F(BasicPortAllocatorTest, TestSharedSocketWithServerAddressResolve) {
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
|
| session_->StartGettingPorts();
|
|
|
| - EXPECT_EQ_WAIT(2U, ports_.size(), kDefaultAllocationTimeout);
|
| + EXPECT_EQ_SIMULATED_WAIT(2U, ports_.size(), kDefaultAllocationTimeout,
|
| + fake_clock);
|
| }
|
|
|
| // Test that when PORTALLOCATOR_ENABLE_SHARED_SOCKET is enabled only one port
|
| @@ -1508,14 +1542,16 @@ TEST_F(BasicPortAllocatorTest, TestSharedSocketWithNatUsingTurn) {
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
|
| session_->StartGettingPorts();
|
|
|
| - ASSERT_EQ_WAIT(3U, candidates_.size(), kDefaultAllocationTimeout);
|
| + ASSERT_EQ_SIMULATED_WAIT(3U, candidates_.size(), kDefaultAllocationTimeout,
|
| + fake_clock);
|
| ASSERT_EQ(2U, ports_.size());
|
| EXPECT_PRED4(HasCandidate, candidates_, "local", "udp", kClientAddr);
|
| EXPECT_PRED4(HasCandidate, candidates_, "stun", "udp",
|
| rtc::SocketAddress(kNatUdpAddr.ipaddr(), 0));
|
| EXPECT_PRED4(HasCandidate, candidates_, "relay", "udp",
|
| rtc::SocketAddress(kTurnUdpExtAddr.ipaddr(), 0));
|
| - EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
|
| + EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
|
| + kDefaultAllocationTimeout, fake_clock);
|
| EXPECT_EQ(3U, candidates_.size());
|
| // Local port will be created first and then TURN port.
|
| EXPECT_EQ(2U, ports_[0]->Candidates().size());
|
| @@ -1543,7 +1579,8 @@ TEST_F(BasicPortAllocatorTest, TestSharedSocketWithNatUsingTurnAsStun) {
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
|
| session_->StartGettingPorts();
|
|
|
| - ASSERT_EQ_WAIT(3U, candidates_.size(), kDefaultAllocationTimeout);
|
| + ASSERT_EQ_SIMULATED_WAIT(3U, candidates_.size(), kDefaultAllocationTimeout,
|
| + fake_clock);
|
| EXPECT_PRED4(HasCandidate, candidates_, "local", "udp", kClientAddr);
|
| Candidate stun_candidate;
|
| EXPECT_PRED5(FindCandidate, candidates_, "stun", "udp",
|
| @@ -1552,7 +1589,8 @@ TEST_F(BasicPortAllocatorTest, TestSharedSocketWithNatUsingTurnAsStun) {
|
| rtc::SocketAddress(kTurnUdpExtAddr.ipaddr(), 0),
|
| stun_candidate.address());
|
|
|
| - EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
|
| + EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
|
| + kDefaultAllocationTimeout, fake_clock);
|
| EXPECT_EQ(3U, candidates_.size());
|
| // Local port will be created first and then TURN port.
|
| EXPECT_EQ(2U, ports_[0]->Candidates().size());
|
| @@ -1575,12 +1613,14 @@ TEST_F(BasicPortAllocatorTest, TestSharedSocketWithNatUsingTurnTcpOnly) {
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
|
| session_->StartGettingPorts();
|
|
|
| - ASSERT_EQ_WAIT(2U, candidates_.size(), kDefaultAllocationTimeout);
|
| + ASSERT_EQ_SIMULATED_WAIT(2U, candidates_.size(), kDefaultAllocationTimeout,
|
| + fake_clock);
|
| ASSERT_EQ(2U, ports_.size());
|
| EXPECT_PRED4(HasCandidate, candidates_, "local", "udp", kClientAddr);
|
| EXPECT_PRED4(HasCandidate, candidates_, "relay", "udp",
|
| rtc::SocketAddress(kTurnUdpExtAddr.ipaddr(), 0));
|
| - EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
|
| + EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
|
| + kDefaultAllocationTimeout, fake_clock);
|
| EXPECT_EQ(2U, candidates_.size());
|
| EXPECT_EQ(1U, ports_[0]->Candidates().size());
|
| EXPECT_EQ(1U, ports_[1]->Candidates().size());
|
| @@ -1602,7 +1642,8 @@ TEST_F(BasicPortAllocatorTest, TestNonSharedSocketWithNatUsingTurnAsStun) {
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
|
| session_->StartGettingPorts();
|
|
|
| - ASSERT_EQ_WAIT(3U, candidates_.size(), kDefaultAllocationTimeout);
|
| + ASSERT_EQ_SIMULATED_WAIT(3U, candidates_.size(), kDefaultAllocationTimeout,
|
| + fake_clock);
|
| ASSERT_EQ(3U, ports_.size());
|
| EXPECT_PRED4(HasCandidate, candidates_, "local", "udp", kClientAddr);
|
| Candidate stun_candidate;
|
| @@ -1616,7 +1657,8 @@ TEST_F(BasicPortAllocatorTest, TestNonSharedSocketWithNatUsingTurnAsStun) {
|
| // should be different than the TURN request's server reflexive address.
|
| EXPECT_NE(turn_candidate.related_address(), stun_candidate.address());
|
|
|
| - EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
|
| + EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
|
| + kDefaultAllocationTimeout, fake_clock);
|
| EXPECT_EQ(3U, candidates_.size());
|
| EXPECT_EQ(1U, ports_[0]->Candidates().size());
|
| EXPECT_EQ(1U, ports_[1]->Candidates().size());
|
| @@ -1640,7 +1682,8 @@ TEST_F(BasicPortAllocatorTest, TestSharedSocketWithNatUsingTurnAndStun) {
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
|
| session_->StartGettingPorts();
|
|
|
| - ASSERT_EQ_WAIT(3U, candidates_.size(), kDefaultAllocationTimeout);
|
| + ASSERT_EQ_SIMULATED_WAIT(3U, candidates_.size(), kDefaultAllocationTimeout,
|
| + fake_clock);
|
| EXPECT_PRED4(HasCandidate, candidates_, "local", "udp", kClientAddr);
|
| Candidate stun_candidate;
|
| EXPECT_PRED5(FindCandidate, candidates_, "stun", "udp",
|
| @@ -1664,11 +1707,12 @@ TEST_F(BasicPortAllocatorTest, TestSharedSocketNoUdpAllowed) {
|
| AddInterface(kClientAddr);
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
|
| session_->StartGettingPorts();
|
| - ASSERT_EQ_WAIT(1U, ports_.size(), kDefaultAllocationTimeout);
|
| + ASSERT_EQ_SIMULATED_WAIT(1U, ports_.size(), kDefaultAllocationTimeout,
|
| + fake_clock);
|
| EXPECT_EQ(1U, candidates_.size());
|
| EXPECT_PRED4(HasCandidate, candidates_, "local", "udp", kClientAddr);
|
| - // STUN timeout is 9.5sec. We need to wait to get candidate done signal.
|
| - EXPECT_TRUE_WAIT(candidate_allocation_done_, kStunTimeoutMs);
|
| + EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
|
| + cricket::STUN_TOTAL_TIMEOUT, fake_clock);
|
| EXPECT_EQ(1U, candidates_.size());
|
| }
|
|
|
| @@ -1688,7 +1732,8 @@ TEST_F(BasicPortAllocatorTest, TestNetworkPermissionBlocked) {
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
|
| EXPECT_EQ(0U, session_->flags() & PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION);
|
| session_->StartGettingPorts();
|
| - EXPECT_EQ_WAIT(1U, ports_.size(), kDefaultAllocationTimeout);
|
| + EXPECT_EQ_SIMULATED_WAIT(1U, ports_.size(), kDefaultAllocationTimeout,
|
| + fake_clock);
|
| EXPECT_EQ(1U, candidates_.size());
|
| EXPECT_PRED4(HasCandidate, candidates_, "local", "udp", kPrivateAddr);
|
| EXPECT_NE(0U, session_->flags() & PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION);
|
| @@ -1704,9 +1749,11 @@ TEST_F(BasicPortAllocatorTest, TestEnableIPv6Addresses) {
|
| allocator_->set_step_delay(kMinimumStepDelay);
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
|
| session_->StartGettingPorts();
|
| - ASSERT_EQ_WAIT(4U, ports_.size(), kDefaultAllocationTimeout);
|
| + ASSERT_EQ_SIMULATED_WAIT(4U, ports_.size(), kDefaultAllocationTimeout,
|
| + fake_clock);
|
| EXPECT_EQ(4U, candidates_.size());
|
| - EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
|
| + EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
|
| + kDefaultAllocationTimeout, fake_clock);
|
| EXPECT_PRED4(HasCandidate, candidates_, "local", "udp", kClientIPv6Addr);
|
| EXPECT_PRED4(HasCandidate, candidates_, "local", "udp", kClientAddr);
|
| EXPECT_PRED4(HasCandidate, candidates_, "local", "tcp", kClientIPv6Addr);
|
| @@ -1719,10 +1766,10 @@ TEST_F(BasicPortAllocatorTest, TestStopGettingPorts) {
|
| allocator_->set_step_delay(kDefaultStepDelay);
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
|
| session_->StartGettingPorts();
|
| - ASSERT_EQ_WAIT(2U, candidates_.size(), 1000);
|
| + ASSERT_EQ_SIMULATED_WAIT(2U, candidates_.size(), 1000, fake_clock);
|
| EXPECT_EQ(2U, ports_.size());
|
| session_->StopGettingPorts();
|
| - EXPECT_TRUE_WAIT(candidate_allocation_done_, 1000);
|
| + EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_, 1000, fake_clock);
|
|
|
| // After stopping getting ports, adding a new interface will not start
|
| // getting ports again.
|
| @@ -1731,7 +1778,7 @@ TEST_F(BasicPortAllocatorTest, TestStopGettingPorts) {
|
| ports_.clear();
|
| candidate_allocation_done_ = false;
|
| network_manager_.AddInterface(kClientAddr2);
|
| - rtc::Thread::Current()->ProcessMessages(1000);
|
| + fake_clock.AdvanceTime(rtc::TimeDelta::FromMilliseconds(1000));
|
| EXPECT_EQ(0U, candidates_.size());
|
| EXPECT_EQ(0U, ports_.size());
|
| }
|
| @@ -1741,10 +1788,10 @@ TEST_F(BasicPortAllocatorTest, TestClearGettingPorts) {
|
| allocator_->set_step_delay(kDefaultStepDelay);
|
| EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
|
| session_->StartGettingPorts();
|
| - ASSERT_EQ_WAIT(2U, candidates_.size(), 1000);
|
| + ASSERT_EQ_SIMULATED_WAIT(2U, candidates_.size(), 1000, fake_clock);
|
| EXPECT_EQ(2U, ports_.size());
|
| session_->ClearGettingPorts();
|
| - EXPECT_TRUE_WAIT(candidate_allocation_done_, 1000);
|
| + EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_, 1000, fake_clock);
|
|
|
| // After clearing getting ports, adding a new interface will start getting
|
| // ports again.
|
| @@ -1753,9 +1800,10 @@ TEST_F(BasicPortAllocatorTest, TestClearGettingPorts) {
|
| ports_.clear();
|
| candidate_allocation_done_ = false;
|
| network_manager_.AddInterface(kClientAddr2);
|
| - ASSERT_EQ_WAIT(2U, candidates_.size(), 1000);
|
| + ASSERT_EQ_SIMULATED_WAIT(2U, candidates_.size(), 1000, fake_clock);
|
| EXPECT_EQ(2U, ports_.size());
|
| - EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
|
| + EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
|
| + kDefaultAllocationTimeout, fake_clock);
|
| }
|
|
|
| // Test that the ports and candidates are updated with new ufrag/pwd/etc. when
|
| @@ -1767,8 +1815,8 @@ TEST_F(BasicPortAllocatorTest, TestTransportInformationUpdated) {
|
| allocator_->turn_servers(), pool_size, false);
|
| const PortAllocatorSession* peeked_session = allocator_->GetPooledSession();
|
| ASSERT_NE(nullptr, peeked_session);
|
| - EXPECT_EQ_WAIT(true, peeked_session->CandidatesAllocationDone(),
|
| - kDefaultAllocationTimeout);
|
| + EXPECT_EQ_SIMULATED_WAIT(true, peeked_session->CandidatesAllocationDone(),
|
| + kDefaultAllocationTimeout, fake_clock);
|
| // Expect that when TakePooledSession is called,
|
| // UpdateTransportInformationInternal will be called and the
|
| // BasicPortAllocatorSession will update the ufrag/pwd of ports and
|
| @@ -1803,8 +1851,8 @@ TEST_F(BasicPortAllocatorTest, TestSetCandidateFilterAfterCandidatesGathered) {
|
| allocator_->turn_servers(), pool_size, false);
|
| const PortAllocatorSession* peeked_session = allocator_->GetPooledSession();
|
| ASSERT_NE(nullptr, peeked_session);
|
| - EXPECT_EQ_WAIT(true, peeked_session->CandidatesAllocationDone(),
|
| - kDefaultAllocationTimeout);
|
| + EXPECT_EQ_SIMULATED_WAIT(true, peeked_session->CandidatesAllocationDone(),
|
| + kDefaultAllocationTimeout, fake_clock);
|
| size_t initial_candidates_size = peeked_session->ReadyCandidates().size();
|
| size_t initial_ports_size = peeked_session->ReadyPorts().size();
|
| allocator_->set_candidate_filter(CF_RELAY);
|
|
|