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 2172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2183 conn2->ReceivedPing(); // Becomes receiving | 2183 conn2->ReceivedPing(); // Becomes receiving |
2184 ch.AddRemoteCandidate(CreateCandidate("3.3.3.3", 3, 2)); | 2184 ch.AddRemoteCandidate(CreateCandidate("3.3.3.3", 3, 2)); |
2185 cricket::Connection* conn3 = WaitForConnectionTo(&ch, "3.3.3.3", 3); | 2185 cricket::Connection* conn3 = WaitForConnectionTo(&ch, "3.3.3.3", 3); |
2186 ASSERT_TRUE(conn3 != nullptr); | 2186 ASSERT_TRUE(conn3 != nullptr); |
2187 conn3->ReceivedPing(); // Becomes receiving | 2187 conn3->ReceivedPing(); // Becomes receiving |
2188 // Now prune both conn2 and conn3; they will be deleted soon. | 2188 // Now prune both conn2 and conn3; they will be deleted soon. |
2189 conn2->Prune(); | 2189 conn2->Prune(); |
2190 conn3->Prune(); | 2190 conn3->Prune(); |
2191 EXPECT_TRUE_WAIT(ch.connections().empty(), 1000); | 2191 EXPECT_TRUE_WAIT(ch.connections().empty(), 1000); |
2192 } | 2192 } |
2193 | |
2194 // Test that after a port allocator session is started, it will be stopped | |
2195 // when a new connection becomes writable and receiving. Also test that this | |
2196 // holds even if the transport channel did not lose the writability. | |
2197 TEST_F(P2PTransportChannelPingTest, TestStopPortAllocatorSessions) { | |
2198 cricket::FakePortAllocator pa(rtc::Thread::Current(), nullptr); | |
2199 cricket::P2PTransportChannel ch("test channel", 1, nullptr, &pa); | |
2200 PrepareChannel(&ch); | |
2201 ch.SetIceConfig(CreateIceConfig(2000, false)); | |
2202 ch.Connect(); | |
2203 ch.MaybeStartGathering(); | |
2204 ch.AddRemoteCandidate(CreateCandidate("1.1.1.1", 1, 100)); | |
2205 cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1); | |
2206 ASSERT_TRUE(conn1 != nullptr); | |
2207 conn1->ReceivedPingResponse(); // Becomes writable and receiving | |
2208 EXPECT_TRUE(!ch.allocator_session()->IsGettingPorts()); | |
2209 | |
2210 // Restart gathering even if the transport channel is still writable. | |
2211 // It should stop getting ports after a new connection becomes strong. | |
pthatcher1
2015/11/04 15:06:14
strong => strongly connected
honghaiz3
2015/11/04 18:27:12
Done.
| |
2212 ch.SetIceCredentials(kIceUfrag[1], kIcePwd[1]); | |
2213 ch.MaybeStartGathering(); | |
2214 ch.AddRemoteCandidate(CreateCandidate("2.2.2.2", 2, 100)); | |
2215 cricket::Connection* conn2 = WaitForConnectionTo(&ch, "2.2.2.2", 2); | |
2216 ASSERT_TRUE(conn2 != nullptr); | |
2217 conn2->ReceivedPingResponse(); // Becomes writable and receiving | |
2218 EXPECT_TRUE(!ch.allocator_session()->IsGettingPorts()); | |
2219 } | |
OLD | NEW |