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

Side by Side Diff: webrtc/p2p/base/stunport_unittest.cc

Issue 2677743002: Increase STUN RTOs (Closed)
Patch Set: Fix some comments Created 3 years, 10 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
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 12 matching lines...) Expand all
23 using cricket::ServerAddresses; 23 using cricket::ServerAddresses;
24 using rtc::SocketAddress; 24 using rtc::SocketAddress;
25 25
26 static const SocketAddress kLocalAddr("127.0.0.1", 0); 26 static const SocketAddress kLocalAddr("127.0.0.1", 0);
27 static const SocketAddress kStunAddr1("127.0.0.1", 5000); 27 static const SocketAddress kStunAddr1("127.0.0.1", 5000);
28 static const SocketAddress kStunAddr2("127.0.0.1", 4000); 28 static const SocketAddress kStunAddr2("127.0.0.1", 4000);
29 static const SocketAddress kStunAddr3("127.0.0.1", 3000); 29 static const SocketAddress kStunAddr3("127.0.0.1", 3000);
30 static const SocketAddress kBadAddr("0.0.0.1", 5000); 30 static const SocketAddress kBadAddr("0.0.0.1", 5000);
31 static const SocketAddress kStunHostnameAddr("localhost", 5000); 31 static const SocketAddress kStunHostnameAddr("localhost", 5000);
32 static const SocketAddress kBadHostnameAddr("not-a-real-hostname", 5000); 32 static const SocketAddress kBadHostnameAddr("not-a-real-hostname", 5000);
33 // STUN timeout (with all retries) is 9500ms.
34 // Add some margin of error for slow bots.
35 // TODO(deadbeef): Use simulated clock instead of just increasing timeouts to
36 // fix flaky tests.
37 static const int kTimeoutMs = 15000;
38 // stun prio = 100 << 24 | 30 (IPV4) << 8 | 256 - 0 33 // stun prio = 100 << 24 | 30 (IPV4) << 8 | 256 - 0
39 static const uint32_t kStunCandidatePriority = 1677729535; 34 static const uint32_t kStunCandidatePriority = 1677729535;
40 static const int kInfiniteLifetime = -1; 35 static const int kInfiniteLifetime = -1;
41 static const int kHighCostPortKeepaliveLifetimeMs = 2 * 60 * 1000; 36 static const int kHighCostPortKeepaliveLifetimeMs = 2 * 60 * 1000;
42 37
43 // Tests connecting a StunPort to a fake STUN server (cricket::StunServer) 38 // Tests connecting a StunPort to a fake STUN server (cricket::StunServer)
44 // TODO: Use a VirtualSocketServer here. We have to use a 39 // TODO: Use a VirtualSocketServer here. We have to use a
45 // PhysicalSocketServer right now since DNS is not part of SocketServer yet. 40 // PhysicalSocketServer right now since DNS is not part of SocketServer yet.
46 class StunPortTest : public testing::Test, 41 class StunPortTest : public testing::Test,
47 public sigslot::has_slots<> { 42 public sigslot::has_slots<> {
(...skipping 26 matching lines...) Expand all
74 stun_servers.insert(server_addr); 69 stun_servers.insert(server_addr);
75 CreateStunPort(stun_servers); 70 CreateStunPort(stun_servers);
76 } 71 }
77 72
78 void CreateStunPort(const ServerAddresses& stun_servers) { 73 void CreateStunPort(const ServerAddresses& stun_servers) {
79 stun_port_.reset(cricket::StunPort::Create( 74 stun_port_.reset(cricket::StunPort::Create(
80 rtc::Thread::Current(), &socket_factory_, &network_, 75 rtc::Thread::Current(), &socket_factory_, &network_,
81 kLocalAddr.ipaddr(), 0, 0, rtc::CreateRandomString(16), 76 kLocalAddr.ipaddr(), 0, 0, rtc::CreateRandomString(16),
82 rtc::CreateRandomString(22), stun_servers, std::string())); 77 rtc::CreateRandomString(22), stun_servers, std::string()));
83 stun_port_->set_stun_keepalive_delay(stun_keepalive_delay_); 78 stun_port_->set_stun_keepalive_delay(stun_keepalive_delay_);
79 stun_port_->set_timeout_delay(cricket::STUN_TOTAL_TIMEOUT);
84 // If |stun_keepalive_lifetime_| is negative, let the stun port 80 // If |stun_keepalive_lifetime_| is negative, let the stun port
85 // choose its lifetime from the network type. 81 // choose its lifetime from the network type.
86 if (stun_keepalive_lifetime_ >= 0) { 82 if (stun_keepalive_lifetime_ >= 0) {
87 stun_port_->set_stun_keepalive_lifetime(stun_keepalive_lifetime_); 83 stun_port_->set_stun_keepalive_lifetime(stun_keepalive_lifetime_);
88 } 84 }
89 stun_port_->SignalPortComplete.connect(this, 85 stun_port_->SignalPortComplete.connect(this,
90 &StunPortTest::OnPortComplete); 86 &StunPortTest::OnPortComplete);
91 stun_port_->SignalPortError.connect(this, 87 stun_port_->SignalPortError.connect(this,
92 &StunPortTest::OnPortError); 88 &StunPortTest::OnPortError);
93 } 89 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 stun_keepalive_lifetime_ = lifetime; 149 stun_keepalive_lifetime_ = lifetime;
154 } 150 }
155 151
156 cricket::TestStunServer* stun_server_1() { 152 cricket::TestStunServer* stun_server_1() {
157 return stun_server_1_.get(); 153 return stun_server_1_.get();
158 } 154 }
159 cricket::TestStunServer* stun_server_2() { 155 cricket::TestStunServer* stun_server_2() {
160 return stun_server_2_.get(); 156 return stun_server_2_.get();
161 } 157 }
162 158
159 rtc::FakeClock& fake_clock() { return fake_clock_; }
160
163 private: 161 private:
162 rtc::ScopedFakeClock fake_clock_;
164 std::unique_ptr<rtc::PhysicalSocketServer> pss_; 163 std::unique_ptr<rtc::PhysicalSocketServer> pss_;
165 std::unique_ptr<rtc::VirtualSocketServer> ss_; 164 std::unique_ptr<rtc::VirtualSocketServer> ss_;
166 rtc::SocketServerScope ss_scope_; 165 rtc::SocketServerScope ss_scope_;
167 rtc::Network network_; 166 rtc::Network network_;
168 rtc::BasicPacketSocketFactory socket_factory_; 167 rtc::BasicPacketSocketFactory socket_factory_;
169 std::unique_ptr<cricket::UDPPort> stun_port_; 168 std::unique_ptr<cricket::UDPPort> stun_port_;
170 std::unique_ptr<cricket::TestStunServer> stun_server_1_; 169 std::unique_ptr<cricket::TestStunServer> stun_server_1_;
171 std::unique_ptr<cricket::TestStunServer> stun_server_2_; 170 std::unique_ptr<cricket::TestStunServer> stun_server_2_;
172 std::unique_ptr<rtc::AsyncPacketSocket> socket_; 171 std::unique_ptr<rtc::AsyncPacketSocket> socket_;
173 bool done_; 172 bool done_;
(...skipping 13 matching lines...) Expand all
187 TEST_F(StunPortTest, TestCreateUdpPort) { 186 TEST_F(StunPortTest, TestCreateUdpPort) {
188 CreateSharedUdpPort(kStunAddr1); 187 CreateSharedUdpPort(kStunAddr1);
189 EXPECT_EQ("local", port()->Type()); 188 EXPECT_EQ("local", port()->Type());
190 EXPECT_EQ(0U, port()->Candidates().size()); 189 EXPECT_EQ(0U, port()->Candidates().size());
191 } 190 }
192 191
193 // Test that we can get an address from a STUN server. 192 // Test that we can get an address from a STUN server.
194 TEST_F(StunPortTest, TestPrepareAddress) { 193 TEST_F(StunPortTest, TestPrepareAddress) {
195 CreateStunPort(kStunAddr1); 194 CreateStunPort(kStunAddr1);
196 PrepareAddress(); 195 PrepareAddress();
197 EXPECT_TRUE_WAIT(done(), kTimeoutMs); 196 EXPECT_TRUE_SIMULATED_WAIT(done(), cricket::STUN_TOTAL_TIMEOUT, fake_clock());
198 ASSERT_EQ(1U, port()->Candidates().size()); 197 ASSERT_EQ(1U, port()->Candidates().size());
199 EXPECT_TRUE(kLocalAddr.EqualIPs(port()->Candidates()[0].address())); 198 EXPECT_TRUE(kLocalAddr.EqualIPs(port()->Candidates()[0].address()));
200 199
201 // TODO: Add IPv6 tests here, once either physicalsocketserver supports 200 // TODO: Add IPv6 tests here, once either physicalsocketserver supports
202 // IPv6, or this test is changed to use VirtualSocketServer. 201 // IPv6, or this test is changed to use VirtualSocketServer.
203 } 202 }
204 203
205 // Test that we fail properly if we can't get an address. 204 // Test that we fail properly if we can't get an address.
206 TEST_F(StunPortTest, TestPrepareAddressFail) { 205 TEST_F(StunPortTest, TestPrepareAddressFail) {
207 CreateStunPort(kBadAddr); 206 CreateStunPort(kBadAddr);
208 PrepareAddress(); 207 PrepareAddress();
209 EXPECT_TRUE_WAIT(done(), kTimeoutMs); 208 EXPECT_TRUE_SIMULATED_WAIT(done(), cricket::STUN_TOTAL_TIMEOUT, fake_clock());
210 EXPECT_TRUE(error()); 209 EXPECT_TRUE(error());
211 EXPECT_EQ(0U, port()->Candidates().size()); 210 EXPECT_EQ(0U, port()->Candidates().size());
212 } 211 }
213 212
214 // Test that we can get an address from a STUN server specified by a hostname. 213 // Test that we can get an address from a STUN server specified by a hostname.
215 TEST_F(StunPortTest, TestPrepareAddressHostname) { 214 TEST_F(StunPortTest, TestPrepareAddressHostname) {
216 CreateStunPort(kStunHostnameAddr); 215 CreateStunPort(kStunHostnameAddr);
217 PrepareAddress(); 216 PrepareAddress();
218 EXPECT_TRUE_WAIT(done(), kTimeoutMs); 217 EXPECT_TRUE_SIMULATED_WAIT(done(), cricket::STUN_TOTAL_TIMEOUT, fake_clock());
219 ASSERT_EQ(1U, port()->Candidates().size()); 218 ASSERT_EQ(1U, port()->Candidates().size());
220 EXPECT_TRUE(kLocalAddr.EqualIPs(port()->Candidates()[0].address())); 219 EXPECT_TRUE(kLocalAddr.EqualIPs(port()->Candidates()[0].address()));
221 EXPECT_EQ(kStunCandidatePriority, port()->Candidates()[0].priority()); 220 EXPECT_EQ(kStunCandidatePriority, port()->Candidates()[0].priority());
222 } 221 }
223 222
224 // Test that we handle hostname lookup failures properly. 223 // Test that we handle hostname lookup failures properly.
225 TEST_F(StunPortTest, TestPrepareAddressHostnameFail) { 224 TEST_F(StunPortTest, TestPrepareAddressHostnameFail) {
226 CreateStunPort(kBadHostnameAddr); 225 CreateStunPort(kBadHostnameAddr);
227 PrepareAddress(); 226 PrepareAddress();
228 EXPECT_TRUE_WAIT(done(), kTimeoutMs); 227 WAIT(false, 1000); // We have to wait for the lookup to fail, and
228 // we can't use a simulated clock for the lookup.
Taylor Brandstetter 2017/02/06 19:23:43 This is a sleep(1000) now... Is there a way to avo
229 EXPECT_TRUE_SIMULATED_WAIT(done(), cricket::STUN_TOTAL_TIMEOUT, fake_clock());
229 EXPECT_TRUE(error()); 230 EXPECT_TRUE(error());
230 EXPECT_EQ(0U, port()->Candidates().size()); 231 EXPECT_EQ(0U, port()->Candidates().size());
231 } 232 }
232 233
233 // This test verifies keepalive response messages don't result in 234 // This test verifies keepalive response messages don't result in
234 // additional candidate generation. 235 // additional candidate generation.
235 TEST_F(StunPortTest, TestKeepAliveResponse) { 236 TEST_F(StunPortTest, TestKeepAliveResponse) {
236 SetKeepaliveDelay(500); // 500ms of keepalive delay. 237 SetKeepaliveDelay(500); // 500ms of keepalive delay.
237 CreateStunPort(kStunHostnameAddr); 238 CreateStunPort(kStunHostnameAddr);
238 PrepareAddress(); 239 PrepareAddress();
239 EXPECT_TRUE_WAIT(done(), kTimeoutMs); 240 EXPECT_TRUE_SIMULATED_WAIT(done(), cricket::STUN_TOTAL_TIMEOUT, fake_clock());
240 ASSERT_EQ(1U, port()->Candidates().size()); 241 ASSERT_EQ(1U, port()->Candidates().size());
241 EXPECT_TRUE(kLocalAddr.EqualIPs(port()->Candidates()[0].address())); 242 EXPECT_TRUE(kLocalAddr.EqualIPs(port()->Candidates()[0].address()));
242 // Waiting for 1 seond, which will allow us to process 243 EXPECT_EQ_SIMULATED_WAIT(1U, port()->Candidates().size(), 500, fake_clock());
243 // response for keepalive binding request. 500 ms is the keepalive delay.
244 rtc::Thread::Current()->ProcessMessages(1000);
245 ASSERT_EQ(1U, port()->Candidates().size());
246 } 244 }
247 245
248 // Test that a local candidate can be generated using a shared socket. 246 // Test that a local candidate can be generated using a shared socket.
249 TEST_F(StunPortTest, TestSharedSocketPrepareAddress) { 247 TEST_F(StunPortTest, TestSharedSocketPrepareAddress) {
250 CreateSharedUdpPort(kStunAddr1); 248 CreateSharedUdpPort(kStunAddr1);
251 PrepareAddress(); 249 PrepareAddress();
252 EXPECT_TRUE_WAIT(done(), kTimeoutMs); 250 EXPECT_TRUE_SIMULATED_WAIT(done(), cricket::STUN_TOTAL_TIMEOUT, fake_clock());
253 ASSERT_EQ(1U, port()->Candidates().size()); 251 ASSERT_EQ(1U, port()->Candidates().size());
254 EXPECT_TRUE(kLocalAddr.EqualIPs(port()->Candidates()[0].address())); 252 EXPECT_TRUE(kLocalAddr.EqualIPs(port()->Candidates()[0].address()));
255 } 253 }
256 254
257 // Test that we still a get a local candidate with invalid stun server hostname. 255 // Test that we still a get a local candidate with invalid stun server hostname.
258 // Also verifing that UDPPort can receive packets when stun address can't be 256 // Also verifing that UDPPort can receive packets when stun address can't be
259 // resolved. 257 // resolved.
260 TEST_F(StunPortTest, TestSharedSocketPrepareAddressInvalidHostname) { 258 TEST_F(StunPortTest, TestSharedSocketPrepareAddressInvalidHostname) {
261 CreateSharedUdpPort(kBadHostnameAddr); 259 CreateSharedUdpPort(kBadHostnameAddr);
262 PrepareAddress(); 260 PrepareAddress();
263 EXPECT_TRUE_WAIT(done(), kTimeoutMs); 261 WAIT(false, 1000); // We have to wait for the lookup to fail, and
262 // we can't use a simulated clock for the lookup.
263 EXPECT_TRUE_SIMULATED_WAIT(done(), cricket::STUN_TOTAL_TIMEOUT, fake_clock());
264 ASSERT_EQ(1U, port()->Candidates().size()); 264 ASSERT_EQ(1U, port()->Candidates().size());
265 EXPECT_TRUE(kLocalAddr.EqualIPs(port()->Candidates()[0].address())); 265 EXPECT_TRUE(kLocalAddr.EqualIPs(port()->Candidates()[0].address()));
266 266
267 // Send data to port after it's ready. This is to make sure, UDP port can 267 // Send data to port after it's ready. This is to make sure, UDP port can
268 // handle data with unresolved stun server address. 268 // handle data with unresolved stun server address.
269 std::string data = "some random data, sending to cricket::Port."; 269 std::string data = "some random data, sending to cricket::Port.";
270 SendData(data.c_str(), data.length()); 270 SendData(data.c_str(), data.length());
271 // No crash is success. 271 // No crash is success.
272 } 272 }
273 273
274 // Test that the same address is added only once if two STUN servers are in use. 274 // Test that the same address is added only once if two STUN servers are in use.
275 TEST_F(StunPortTest, TestNoDuplicatedAddressWithTwoStunServers) { 275 TEST_F(StunPortTest, TestNoDuplicatedAddressWithTwoStunServers) {
276 ServerAddresses stun_servers; 276 ServerAddresses stun_servers;
277 stun_servers.insert(kStunAddr1); 277 stun_servers.insert(kStunAddr1);
278 stun_servers.insert(kStunAddr2); 278 stun_servers.insert(kStunAddr2);
279 CreateStunPort(stun_servers); 279 CreateStunPort(stun_servers);
280 EXPECT_EQ("stun", port()->Type()); 280 EXPECT_EQ("stun", port()->Type());
281 PrepareAddress(); 281 PrepareAddress();
282 EXPECT_TRUE_WAIT(done(), kTimeoutMs); 282 EXPECT_TRUE_SIMULATED_WAIT(done(), cricket::STUN_TOTAL_TIMEOUT, fake_clock());
283 EXPECT_EQ(1U, port()->Candidates().size()); 283 EXPECT_EQ(1U, port()->Candidates().size());
284 EXPECT_EQ(port()->Candidates()[0].relay_protocol(), ""); 284 EXPECT_EQ(port()->Candidates()[0].relay_protocol(), "");
285 } 285 }
286 286
287 // Test that candidates can be allocated for multiple STUN servers, one of which 287 // Test that candidates can be allocated for multiple STUN servers, one of which
288 // is not reachable. 288 // is not reachable.
289 TEST_F(StunPortTest, TestMultipleStunServersWithBadServer) { 289 TEST_F(StunPortTest, TestMultipleStunServersWithBadServer) {
290 ServerAddresses stun_servers; 290 ServerAddresses stun_servers;
291 stun_servers.insert(kStunAddr1); 291 stun_servers.insert(kStunAddr1);
292 stun_servers.insert(kBadAddr); 292 stun_servers.insert(kBadAddr);
293 CreateStunPort(stun_servers); 293 CreateStunPort(stun_servers);
294 EXPECT_EQ("stun", port()->Type()); 294 EXPECT_EQ("stun", port()->Type());
295 PrepareAddress(); 295 PrepareAddress();
296 EXPECT_TRUE_WAIT(done(), kTimeoutMs); 296 EXPECT_TRUE_SIMULATED_WAIT(done(), cricket::STUN_TOTAL_TIMEOUT, fake_clock());
297 EXPECT_EQ(1U, port()->Candidates().size()); 297 EXPECT_EQ(1U, port()->Candidates().size());
298 } 298 }
299 299
300 // Test that two candidates are allocated if the two STUN servers return 300 // Test that two candidates are allocated if the two STUN servers return
301 // different mapped addresses. 301 // different mapped addresses.
302 TEST_F(StunPortTest, TestTwoCandidatesWithTwoStunServersAcrossNat) { 302 TEST_F(StunPortTest, TestTwoCandidatesWithTwoStunServersAcrossNat) {
303 const SocketAddress kStunMappedAddr1("77.77.77.77", 0); 303 const SocketAddress kStunMappedAddr1("77.77.77.77", 0);
304 const SocketAddress kStunMappedAddr2("88.77.77.77", 0); 304 const SocketAddress kStunMappedAddr2("88.77.77.77", 0);
305 stun_server_1()->set_fake_stun_addr(kStunMappedAddr1); 305 stun_server_1()->set_fake_stun_addr(kStunMappedAddr1);
306 stun_server_2()->set_fake_stun_addr(kStunMappedAddr2); 306 stun_server_2()->set_fake_stun_addr(kStunMappedAddr2);
307 307
308 ServerAddresses stun_servers; 308 ServerAddresses stun_servers;
309 stun_servers.insert(kStunAddr1); 309 stun_servers.insert(kStunAddr1);
310 stun_servers.insert(kStunAddr2); 310 stun_servers.insert(kStunAddr2);
311 CreateStunPort(stun_servers); 311 CreateStunPort(stun_servers);
312 EXPECT_EQ("stun", port()->Type()); 312 EXPECT_EQ("stun", port()->Type());
313 PrepareAddress(); 313 PrepareAddress();
314 EXPECT_TRUE_WAIT(done(), kTimeoutMs); 314 EXPECT_TRUE_SIMULATED_WAIT(done(), cricket::STUN_TOTAL_TIMEOUT, fake_clock());
315 EXPECT_EQ(2U, port()->Candidates().size()); 315 EXPECT_EQ(2U, port()->Candidates().size());
316 EXPECT_EQ(port()->Candidates()[0].relay_protocol(), ""); 316 EXPECT_EQ(port()->Candidates()[0].relay_protocol(), "");
317 EXPECT_EQ(port()->Candidates()[1].relay_protocol(), ""); 317 EXPECT_EQ(port()->Candidates()[1].relay_protocol(), "");
318 } 318 }
319 319
320 // Test that the stun_keepalive_lifetime is set correctly based on the network 320 // Test that the stun_keepalive_lifetime is set correctly based on the network
321 // type on a STUN port. Also test that it will be updated if the network type 321 // type on a STUN port. Also test that it will be updated if the network type
322 // changes. 322 // changes.
323 TEST_F(StunPortTest, TestStunPortGetStunKeepaliveLifetime) { 323 TEST_F(StunPortTest, TestStunPortGetStunKeepaliveLifetime) {
324 // Lifetime for the default (unknown) network type is |kInfiniteLifetime|. 324 // Lifetime for the default (unknown) network type is |kInfiniteLifetime|.
(...skipping 28 matching lines...) Expand all
353 EXPECT_EQ(kInfiniteLifetime, port()->stun_keepalive_lifetime()); 353 EXPECT_EQ(kInfiniteLifetime, port()->stun_keepalive_lifetime());
354 } 354 }
355 355
356 // Test that STUN binding requests will be stopped shortly if the keep-alive 356 // Test that STUN binding requests will be stopped shortly if the keep-alive
357 // lifetime is short. 357 // lifetime is short.
358 TEST_F(StunPortTest, TestStunBindingRequestShortLifetime) { 358 TEST_F(StunPortTest, TestStunBindingRequestShortLifetime) {
359 SetKeepaliveDelay(101); 359 SetKeepaliveDelay(101);
360 SetKeepaliveLifetime(100); 360 SetKeepaliveLifetime(100);
361 CreateStunPort(kStunAddr1); 361 CreateStunPort(kStunAddr1);
362 PrepareAddress(); 362 PrepareAddress();
363 EXPECT_TRUE_WAIT(done(), kTimeoutMs); 363 EXPECT_TRUE_SIMULATED_WAIT(done(), cricket::STUN_TOTAL_TIMEOUT, fake_clock());
364 EXPECT_TRUE_WAIT(!port()->HasPendingRequest(cricket::STUN_BINDING_REQUEST), 364 EXPECT_TRUE_SIMULATED_WAIT(
365 2000); 365 !port()->HasPendingRequest(cricket::STUN_BINDING_REQUEST), 2000,
366 fake_clock());
366 } 367 }
367 368
368 // Test that by default, the STUN binding requests will last for a long time. 369 // Test that by default, the STUN binding requests will last for a long time.
369 TEST_F(StunPortTest, TestStunBindingRequestLongLifetime) { 370 TEST_F(StunPortTest, TestStunBindingRequestLongLifetime) {
370 SetKeepaliveDelay(101); 371 SetKeepaliveDelay(101);
371 CreateStunPort(kStunAddr1); 372 CreateStunPort(kStunAddr1);
372 PrepareAddress(); 373 PrepareAddress();
373 EXPECT_TRUE_WAIT(done(), kTimeoutMs); 374 EXPECT_TRUE_SIMULATED_WAIT(done(), cricket::STUN_TOTAL_TIMEOUT, fake_clock());
374 rtc::Thread::Current()->ProcessMessages(1000); 375 EXPECT_TRUE_SIMULATED_WAIT(
375 EXPECT_TRUE(port()->HasPendingRequest(cricket::STUN_BINDING_REQUEST)); 376 port()->HasPendingRequest(cricket::STUN_BINDING_REQUEST), 1000,
377 fake_clock());
376 } 378 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698