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 1752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1763 // Create channels and let them go writable, as usual. | 1763 // Create channels and let them go writable, as usual. |
1764 CreateChannels(1); | 1764 CreateChannels(1); |
1765 | 1765 |
1766 // Both transport channels will reach STATE_COMPLETED quickly. | 1766 // Both transport channels will reach STATE_COMPLETED quickly. |
1767 EXPECT_EQ_WAIT(cricket::TransportChannelState::STATE_COMPLETED, | 1767 EXPECT_EQ_WAIT(cricket::TransportChannelState::STATE_COMPLETED, |
1768 ep1_ch1()->GetState(), 1000); | 1768 ep1_ch1()->GetState(), 1000); |
1769 EXPECT_EQ_WAIT(cricket::TransportChannelState::STATE_COMPLETED, | 1769 EXPECT_EQ_WAIT(cricket::TransportChannelState::STATE_COMPLETED, |
1770 ep2_ch1()->GetState(), 1000); | 1770 ep2_ch1()->GetState(), 1000); |
1771 } | 1771 } |
1772 | 1772 |
| 1773 // Tests that when a network interface becomes inactive, the ports associated |
| 1774 // with that network will be removed from the port list of the channel if |
| 1775 // and only if Continual Gathering is enabled. |
| 1776 TEST_F(P2PTransportChannelMultihomedTest, TestNetworkBecomesInactive) { |
| 1777 AddAddress(0, kPublicAddrs[0]); |
| 1778 AddAddress(1, kPublicAddrs[1]); |
| 1779 // Create channels and let them go writable, as usual. |
| 1780 CreateChannels(1); |
| 1781 ep1_ch1()->SetIceConfig(CreateIceConfig(2000, true)); |
| 1782 ep2_ch1()->SetIceConfig(CreateIceConfig(2000, false)); |
| 1783 |
| 1784 SetAllocatorFlags(0, kOnlyLocalPorts); |
| 1785 SetAllocatorFlags(1, kOnlyLocalPorts); |
| 1786 EXPECT_TRUE_WAIT_MARGIN(ep1_ch1()->receiving() && ep1_ch1()->writable() && |
| 1787 ep2_ch1()->receiving() && ep2_ch1()->writable(), |
| 1788 1000, 1000); |
| 1789 // More than one port has been created. |
| 1790 EXPECT_LE(1U, ep1_ch1()->ports().size()); |
| 1791 // Endpoint 1 enabled continual gathering; the port will be removed |
| 1792 // when the interface is removed. |
| 1793 RemoveAddress(0, kPublicAddrs[0]); |
| 1794 EXPECT_EQ(0U, ep1_ch1()->ports().size()); |
| 1795 |
| 1796 size_t num_ports = ep2_ch1()->ports().size(); |
| 1797 EXPECT_LE(1U, num_ports); |
| 1798 // Endpoint 2 did not enable continual gathering; the port will not be removed |
| 1799 // when the interface is removed. |
| 1800 RemoveAddress(1, kPublicAddrs[1]); |
| 1801 EXPECT_EQ(num_ports, ep2_ch1()->ports().size()); |
| 1802 } |
| 1803 |
1773 /* | 1804 /* |
1774 | 1805 |
1775 TODO(pthatcher): Once have a way to handle network interfaces changes | 1806 TODO(pthatcher): Once have a way to handle network interfaces changes |
1776 without signalling an ICE restart, put a test like this back. In the | 1807 without signalling an ICE restart, put a test like this back. In the |
1777 mean time, this test only worked for GICE. With ICE, it's currently | 1808 mean time, this test only worked for GICE. With ICE, it's currently |
1778 not possible without an ICE restart. | 1809 not possible without an ICE restart. |
1779 | 1810 |
1780 // Test that we can switch links in a coordinated fashion. | 1811 // Test that we can switch links in a coordinated fashion. |
1781 TEST_F(P2PTransportChannelMultihomedTest, TestDrain) { | 1812 TEST_F(P2PTransportChannelMultihomedTest, TestDrain) { |
1782 AddAddress(0, kPublicAddrs[0]); | 1813 AddAddress(0, kPublicAddrs[0]); |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2418 // It should stop getting ports after a new connection becomes strongly | 2449 // It should stop getting ports after a new connection becomes strongly |
2419 // connected. | 2450 // connected. |
2420 ch.SetIceCredentials(kIceUfrag[1], kIcePwd[1]); | 2451 ch.SetIceCredentials(kIceUfrag[1], kIcePwd[1]); |
2421 ch.MaybeStartGathering(); | 2452 ch.MaybeStartGathering(); |
2422 ch.AddRemoteCandidate(CreateCandidate("2.2.2.2", 2, 100)); | 2453 ch.AddRemoteCandidate(CreateCandidate("2.2.2.2", 2, 100)); |
2423 cricket::Connection* conn2 = WaitForConnectionTo(&ch, "2.2.2.2", 2); | 2454 cricket::Connection* conn2 = WaitForConnectionTo(&ch, "2.2.2.2", 2); |
2424 ASSERT_TRUE(conn2 != nullptr); | 2455 ASSERT_TRUE(conn2 != nullptr); |
2425 conn2->ReceivedPingResponse(); // Becomes writable and receiving | 2456 conn2->ReceivedPingResponse(); // Becomes writable and receiving |
2426 EXPECT_TRUE(!ch.allocator_session()->IsGettingPorts()); | 2457 EXPECT_TRUE(!ch.allocator_session()->IsGettingPorts()); |
2427 } | 2458 } |
OLD | NEW |