Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 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 2392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2403 // Set up channels and ensure both ports will be deleted. | 2403 // Set up channels and ensure both ports will be deleted. |
| 2404 TestChannel ch1(port1); | 2404 TestChannel ch1(port1); |
| 2405 TestChannel ch2(port2); | 2405 TestChannel ch2(port2); |
| 2406 | 2406 |
| 2407 // Simulate a connection that succeeds, and then is destroyed. | 2407 // Simulate a connection that succeeds, and then is destroyed. |
| 2408 StartConnectAndStopChannels(&ch1, &ch2); | 2408 StartConnectAndStopChannels(&ch1, &ch2); |
| 2409 | 2409 |
| 2410 // The controlled port should be destroyed after 10 milliseconds. | 2410 // The controlled port should be destroyed after 10 milliseconds. |
| 2411 EXPECT_TRUE_WAIT(destroyed(), kTimeout); | 2411 EXPECT_TRUE_WAIT(destroyed(), kTimeout); |
| 2412 } | 2412 } |
| 2413 | |
| 2414 // This test case verifies that if the role of a port changes from controlled | |
| 2415 // to controlling after all connections fail, the port will not time out. | |
|
pthatcher1
2015/09/30 17:08:03
will not timeout => will not be destroyed
honghaiz3
2015/09/30 17:17:53
Done.
| |
| 2416 TEST_F(PortTest, TestControlledToControllingNoTimeout) { | |
|
pthatcher1
2015/09/30 17:08:03
NoTimeout => NotDestroyed
honghaiz3
2015/09/30 17:17:53
Done.
| |
| 2417 UDPPort* port1 = CreateUdpPort(kLocalAddr1); | |
| 2418 port1->SetIceRole(cricket::ICEROLE_CONTROLLING); | |
| 2419 port1->SetIceTiebreaker(kTiebreaker1); | |
| 2420 | |
| 2421 UDPPort* port2 = CreateUdpPort(kLocalAddr2); | |
| 2422 ConnectToSignalDestroyed(port2); | |
| 2423 port2->set_timeout_delay(10); // milliseconds | |
| 2424 port2->SetIceRole(cricket::ICEROLE_CONTROLLED); | |
| 2425 port2->SetIceTiebreaker(kTiebreaker2); | |
| 2426 | |
| 2427 // The connection must not be destroyed before a connection is attempted. | |
| 2428 EXPECT_FALSE(destroyed()); | |
| 2429 | |
| 2430 port1->set_component(cricket::ICE_CANDIDATE_COMPONENT_DEFAULT); | |
| 2431 port2->set_component(cricket::ICE_CANDIDATE_COMPONENT_DEFAULT); | |
| 2432 | |
| 2433 // Set up channels and ensure both ports will be deleted. | |
| 2434 TestChannel ch1(port1); | |
| 2435 TestChannel ch2(port2); | |
| 2436 | |
| 2437 // Simulate a connection that succeeds, and then is destroyed. | |
| 2438 StartConnectAndStopChannels(&ch1, &ch2); | |
| 2439 // Switch the role after all connections are destroyed. | |
| 2440 EXPECT_TRUE_WAIT(ch2.conn() == nullptr, kTimeout); | |
| 2441 port1->SetIceRole(cricket::ICEROLE_CONTROLLED); | |
| 2442 port2->SetIceRole(cricket::ICEROLE_CONTROLLING); | |
| 2443 | |
| 2444 // After the connection is destroyed, the port should not be destroyed. | |
| 2445 rtc::Thread::Current()->ProcessMessages(kTimeout); | |
| 2446 EXPECT_FALSE(destroyed()); | |
| 2447 } | |
| OLD | NEW |