OLD | NEW |
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 2252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2263 AddAddress(1, kPublicAddrs[1]); | 2263 AddAddress(1, kPublicAddrs[1]); |
2264 AddAddress(1, kAlternateAddrs[1]); | 2264 AddAddress(1, kAlternateAddrs[1]); |
2265 Test(kLocalUdpToLocalUdp); | 2265 Test(kLocalUdpToLocalUdp); |
2266 } | 2266 } |
2267 | 2267 |
2268 // Test that we can quickly switch links if an interface goes down. | 2268 // Test that we can quickly switch links if an interface goes down. |
2269 // The controlled side has two interfaces and one will die. | 2269 // The controlled side has two interfaces and one will die. |
2270 TEST_F(P2PTransportChannelMultihomedTest, TestFailoverControlledSide) { | 2270 TEST_F(P2PTransportChannelMultihomedTest, TestFailoverControlledSide) { |
2271 rtc::ScopedFakeClock clock; | 2271 rtc::ScopedFakeClock clock; |
2272 AddAddress(0, kPublicAddrs[0]); | 2272 AddAddress(0, kPublicAddrs[0]); |
2273 // Simulate failing over from Wi-Fi to cell interface. | 2273 // Adding alternate address will make sure |kPublicAddrs| has the higher |
2274 AddAddress(1, kPublicAddrs[1], "eth0", rtc::ADAPTER_TYPE_WIFI); | 2274 // priority than others. This is due to FakeNetwork::AddInterface method. |
2275 AddAddress(1, kAlternateAddrs[1], "wlan0", rtc::ADAPTER_TYPE_CELLULAR); | 2275 AddAddress(1, kAlternateAddrs[1]); |
| 2276 AddAddress(1, kPublicAddrs[1]); |
2276 | 2277 |
2277 // Use only local ports for simplicity. | 2278 // Use only local ports for simplicity. |
2278 SetAllocatorFlags(0, kOnlyLocalPorts); | 2279 SetAllocatorFlags(0, kOnlyLocalPorts); |
2279 SetAllocatorFlags(1, kOnlyLocalPorts); | 2280 SetAllocatorFlags(1, kOnlyLocalPorts); |
2280 | 2281 |
2281 // Make the receiving timeout shorter for testing. | 2282 // Make the receiving timeout shorter for testing. |
2282 IceConfig config = CreateIceConfig(1000, GATHER_ONCE); | 2283 IceConfig config = CreateIceConfig(1000, GATHER_ONCE); |
2283 // Create channels and let them go writable, as usual. | 2284 // Create channels and let them go writable, as usual. |
2284 CreateChannels(config, config); | 2285 CreateChannels(config, config); |
2285 | 2286 |
(...skipping 28 matching lines...) Expand all Loading... |
2314 EXPECT_TRUE( | 2315 EXPECT_TRUE( |
2315 LocalCandidate(ep2_ch1())->address().EqualIPs(kAlternateAddrs[1])); | 2316 LocalCandidate(ep2_ch1())->address().EqualIPs(kAlternateAddrs[1])); |
2316 | 2317 |
2317 DestroyChannels(); | 2318 DestroyChannels(); |
2318 } | 2319 } |
2319 | 2320 |
2320 // Test that we can quickly switch links if an interface goes down. | 2321 // Test that we can quickly switch links if an interface goes down. |
2321 // The controlling side has two interfaces and one will die. | 2322 // The controlling side has two interfaces and one will die. |
2322 TEST_F(P2PTransportChannelMultihomedTest, TestFailoverControllingSide) { | 2323 TEST_F(P2PTransportChannelMultihomedTest, TestFailoverControllingSide) { |
2323 rtc::ScopedFakeClock clock; | 2324 rtc::ScopedFakeClock clock; |
2324 // Simulate failing over from Wi-Fi to cell interface. | 2325 // Adding alternate address will make sure |kPublicAddrs| has the higher |
2325 AddAddress(0, kPublicAddrs[0], "eth0", rtc::ADAPTER_TYPE_WIFI); | 2326 // priority than others. This is due to FakeNetwork::AddInterface method. |
2326 AddAddress(0, kAlternateAddrs[0], "wlan0", rtc::ADAPTER_TYPE_CELLULAR); | 2327 AddAddress(0, kAlternateAddrs[0]); |
| 2328 AddAddress(0, kPublicAddrs[0]); |
2327 AddAddress(1, kPublicAddrs[1]); | 2329 AddAddress(1, kPublicAddrs[1]); |
2328 | 2330 |
2329 // Use only local ports for simplicity. | 2331 // Use only local ports for simplicity. |
2330 SetAllocatorFlags(0, kOnlyLocalPorts); | 2332 SetAllocatorFlags(0, kOnlyLocalPorts); |
2331 SetAllocatorFlags(1, kOnlyLocalPorts); | 2333 SetAllocatorFlags(1, kOnlyLocalPorts); |
2332 | 2334 |
2333 // Make the receiving timeout shorter for testing. | 2335 // Make the receiving timeout shorter for testing. |
2334 IceConfig config = CreateIceConfig(1000, GATHER_ONCE); | 2336 IceConfig config = CreateIceConfig(1000, GATHER_ONCE); |
2335 // Create channels and let them go writable, as usual. | 2337 // Create channels and let them go writable, as usual. |
2336 CreateChannels(config, config); | 2338 CreateChannels(config, config); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2460 kMediumTimeout, clock); | 2462 kMediumTimeout, clock); |
2461 | 2463 |
2462 DestroyChannels(); | 2464 DestroyChannels(); |
2463 } | 2465 } |
2464 | 2466 |
2465 // Test that when the controlling side switches the selected connection, | 2467 // Test that when the controlling side switches the selected connection, |
2466 // the nomination of the selected connection on the controlled side will | 2468 // the nomination of the selected connection on the controlled side will |
2467 // increase. | 2469 // increase. |
2468 TEST_F(P2PTransportChannelMultihomedTest, TestIceRenomination) { | 2470 TEST_F(P2PTransportChannelMultihomedTest, TestIceRenomination) { |
2469 rtc::ScopedFakeClock clock; | 2471 rtc::ScopedFakeClock clock; |
2470 // Simulate failing over from Wi-Fi to cell interface. | 2472 // Adding alternate address will make sure |kPublicAddrs| has the higher |
2471 AddAddress(0, kPublicAddrs[0], "eth0", rtc::ADAPTER_TYPE_WIFI); | 2473 // priority than others. This is due to FakeNetwork::AddInterface method. |
2472 AddAddress(0, kAlternateAddrs[0], "wlan0", rtc::ADAPTER_TYPE_CELLULAR); | 2474 AddAddress(0, kAlternateAddrs[0]); |
| 2475 AddAddress(0, kPublicAddrs[0]); |
2473 AddAddress(1, kPublicAddrs[1]); | 2476 AddAddress(1, kPublicAddrs[1]); |
2474 | 2477 |
2475 // Use only local ports for simplicity. | 2478 // Use only local ports for simplicity. |
2476 SetAllocatorFlags(0, kOnlyLocalPorts); | 2479 SetAllocatorFlags(0, kOnlyLocalPorts); |
2477 SetAllocatorFlags(1, kOnlyLocalPorts); | 2480 SetAllocatorFlags(1, kOnlyLocalPorts); |
2478 | 2481 |
2479 // We want it to set the remote ICE parameters when creating channels. | 2482 // We want it to set the remote ICE parameters when creating channels. |
2480 set_remote_ice_parameter_source(FROM_SETICEPARAMETERS); | 2483 set_remote_ice_parameter_source(FROM_SETICEPARAMETERS); |
2481 // Make the receiving timeout shorter for testing. | 2484 // Make the receiving timeout shorter for testing. |
2482 IceConfig config = CreateIceConfig(1000, GATHER_ONCE); | 2485 IceConfig config = CreateIceConfig(1000, GATHER_ONCE); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2520 | 2523 |
2521 // Test that if an interface fails temporarily and then recovers quickly, | 2524 // Test that if an interface fails temporarily and then recovers quickly, |
2522 // the selected connection will not switch. | 2525 // the selected connection will not switch. |
2523 // The case that it will switch over to the backup connection if the selected | 2526 // The case that it will switch over to the backup connection if the selected |
2524 // connection does not recover after enough time is covered in | 2527 // connection does not recover after enough time is covered in |
2525 // TestFailoverControlledSide and TestFailoverControllingSide. | 2528 // TestFailoverControlledSide and TestFailoverControllingSide. |
2526 TEST_F(P2PTransportChannelMultihomedTest, | 2529 TEST_F(P2PTransportChannelMultihomedTest, |
2527 TestConnectionSwitchDampeningControlledSide) { | 2530 TestConnectionSwitchDampeningControlledSide) { |
2528 rtc::ScopedFakeClock clock; | 2531 rtc::ScopedFakeClock clock; |
2529 AddAddress(0, kPublicAddrs[0]); | 2532 AddAddress(0, kPublicAddrs[0]); |
2530 // Simulate failing over from Wi-Fi to cell interface. | 2533 // Adding alternate address will make sure |kPublicAddrs| has the higher |
2531 AddAddress(1, kPublicAddrs[1], "eth0", rtc::ADAPTER_TYPE_WIFI); | 2534 // priority than others. This is due to FakeNetwork::AddInterface method. |
2532 AddAddress(1, kAlternateAddrs[1], "wlan0", rtc::ADAPTER_TYPE_CELLULAR); | 2535 AddAddress(1, kAlternateAddrs[1]); |
| 2536 AddAddress(1, kPublicAddrs[1]); |
2533 | 2537 |
2534 // Use only local ports for simplicity. | 2538 // Use only local ports for simplicity. |
2535 SetAllocatorFlags(0, kOnlyLocalPorts); | 2539 SetAllocatorFlags(0, kOnlyLocalPorts); |
2536 SetAllocatorFlags(1, kOnlyLocalPorts); | 2540 SetAllocatorFlags(1, kOnlyLocalPorts); |
2537 | 2541 |
2538 // Create channels and let them go writable, as usual. | 2542 // Create channels and let them go writable, as usual. |
2539 CreateChannels(); | 2543 CreateChannels(); |
2540 | 2544 |
2541 EXPECT_TRUE_SIMULATED_WAIT(ep1_ch1()->receiving() && ep1_ch1()->writable() && | 2545 EXPECT_TRUE_SIMULATED_WAIT(ep1_ch1()->receiving() && ep1_ch1()->writable() && |
2542 ep2_ch1()->receiving() && | 2546 ep2_ch1()->receiving() && |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2578 EXPECT_EQ(0, reset_selected_candidate_pair_switches()); | 2582 EXPECT_EQ(0, reset_selected_candidate_pair_switches()); |
2579 | 2583 |
2580 DestroyChannels(); | 2584 DestroyChannels(); |
2581 } | 2585 } |
2582 | 2586 |
2583 // Test that if an interface fails temporarily and then recovers quickly, | 2587 // Test that if an interface fails temporarily and then recovers quickly, |
2584 // the selected connection will not switch. | 2588 // the selected connection will not switch. |
2585 TEST_F(P2PTransportChannelMultihomedTest, | 2589 TEST_F(P2PTransportChannelMultihomedTest, |
2586 TestConnectionSwitchDampeningControllingSide) { | 2590 TestConnectionSwitchDampeningControllingSide) { |
2587 rtc::ScopedFakeClock clock; | 2591 rtc::ScopedFakeClock clock; |
2588 // Simulate failing over from Wi-Fi to cell interface. | 2592 // Adding alternate address will make sure |kPublicAddrs| has the higher |
2589 AddAddress(0, kPublicAddrs[0], "eth0", rtc::ADAPTER_TYPE_WIFI); | 2593 // priority than others. This is due to FakeNetwork::AddInterface method. |
2590 AddAddress(0, kAlternateAddrs[0], "wlan0", rtc::ADAPTER_TYPE_CELLULAR); | 2594 AddAddress(0, kAlternateAddrs[0]); |
| 2595 AddAddress(0, kPublicAddrs[0]); |
2591 AddAddress(1, kPublicAddrs[1]); | 2596 AddAddress(1, kPublicAddrs[1]); |
2592 | 2597 |
2593 // Use only local ports for simplicity. | 2598 // Use only local ports for simplicity. |
2594 SetAllocatorFlags(0, kOnlyLocalPorts); | 2599 SetAllocatorFlags(0, kOnlyLocalPorts); |
2595 SetAllocatorFlags(1, kOnlyLocalPorts); | 2600 SetAllocatorFlags(1, kOnlyLocalPorts); |
2596 | 2601 |
2597 // Create channels and let them go writable, as usual. | 2602 // Create channels and let them go writable, as usual. |
2598 CreateChannels(); | 2603 CreateChannels(); |
2599 EXPECT_TRUE_SIMULATED_WAIT(ep1_ch1()->receiving() && ep1_ch1()->writable() && | 2604 EXPECT_TRUE_SIMULATED_WAIT(ep1_ch1()->receiving() && ep1_ch1()->writable() && |
2600 ep2_ch1()->receiving() && | 2605 ep2_ch1()->receiving() && |
(...skipping 1906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4507 | 4512 |
4508 // TCP Relay/Relay is the next. | 4513 // TCP Relay/Relay is the next. |
4509 VerifyNextPingableConnection(RELAY_PORT_TYPE, RELAY_PORT_TYPE, | 4514 VerifyNextPingableConnection(RELAY_PORT_TYPE, RELAY_PORT_TYPE, |
4510 TCP_PROTOCOL_NAME); | 4515 TCP_PROTOCOL_NAME); |
4511 | 4516 |
4512 // Finally, Local/Relay will be pinged. | 4517 // Finally, Local/Relay will be pinged. |
4513 VerifyNextPingableConnection(LOCAL_PORT_TYPE, RELAY_PORT_TYPE); | 4518 VerifyNextPingableConnection(LOCAL_PORT_TYPE, RELAY_PORT_TYPE); |
4514 } | 4519 } |
4515 | 4520 |
4516 } // namespace cricket { | 4521 } // namespace cricket { |
OLD | NEW |