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 2260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2271 conn1->ReceivedPingResponse(LOW_RTT); | 2271 conn1->ReceivedPingResponse(LOW_RTT); |
2272 ASSERT_TRUE(conn1->writable()); | 2272 ASSERT_TRUE(conn1->writable()); |
2273 conn1->ReceivedPing(); | 2273 conn1->ReceivedPing(); |
2274 | 2274 |
2275 // Ping received, but the connection is already writable, so no | 2275 // Ping received, but the connection is already writable, so no |
2276 // "triggered check" and conn2 is pinged before conn1 because it has | 2276 // "triggered check" and conn2 is pinged before conn1 because it has |
2277 // a higher priority. | 2277 // a higher priority. |
2278 EXPECT_EQ(conn2, FindNextPingableConnectionAndPingIt(&ch)); | 2278 EXPECT_EQ(conn2, FindNextPingableConnectionAndPingIt(&ch)); |
2279 } | 2279 } |
2280 | 2280 |
2281 TEST_F(P2PTransportChannelPingTest, TestFailedConnectionNotPingable) { | |
2282 cricket::FakePortAllocator pa(rtc::Thread::Current(), nullptr); | |
2283 cricket::P2PTransportChannel ch("Do not ping failed connections", 1, &pa); | |
2284 PrepareChannel(&ch); | |
2285 ch.Connect(); | |
2286 ch.MaybeStartGathering(); | |
2287 ch.AddRemoteCandidate(CreateHostCandidate("1.1.1.1", 1, 1)); | |
2288 | |
2289 cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1); | |
2290 ASSERT_TRUE(conn1 != nullptr); | |
2291 | |
2292 EXPECT_EQ(conn1, ch.FindNextPingableConnection()); | |
2293 conn1->Prune(); // A pruned connection may still be pingable. | |
2294 EXPECT_EQ(conn1, ch.FindNextPingableConnection()); | |
2295 conn1->FailAndPrune(); | |
2296 EXPECT_TRUE(nullptr == ch.FindNextPingableConnection()); | |
2297 } | |
2298 | |
2299 TEST_F(P2PTransportChannelPingTest, TestSignalStateChanged) { | 2281 TEST_F(P2PTransportChannelPingTest, TestSignalStateChanged) { |
2300 cricket::FakePortAllocator pa(rtc::Thread::Current(), nullptr); | 2282 cricket::FakePortAllocator pa(rtc::Thread::Current(), nullptr); |
2301 cricket::P2PTransportChannel ch("state change", 1, &pa); | 2283 cricket::P2PTransportChannel ch("state change", 1, &pa); |
2302 PrepareChannel(&ch); | 2284 PrepareChannel(&ch); |
2303 ch.Connect(); | 2285 ch.Connect(); |
2304 ch.MaybeStartGathering(); | 2286 ch.MaybeStartGathering(); |
2305 ch.AddRemoteCandidate(CreateHostCandidate("1.1.1.1", 1, 1)); | 2287 ch.AddRemoteCandidate(CreateHostCandidate("1.1.1.1", 1, 1)); |
2306 cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1); | 2288 cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1); |
2307 ASSERT_TRUE(conn1 != nullptr); | 2289 ASSERT_TRUE(conn1 != nullptr); |
2308 // Pruning the connection reduces the set of active connections and changes | 2290 // Pruning the connection reduces the set of active connections and changes |
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3189 | 3171 |
3190 // TCP Relay/Relay is the next. | 3172 // TCP Relay/Relay is the next. |
3191 VerifyNextPingableConnection(cricket::RELAY_PORT_TYPE, | 3173 VerifyNextPingableConnection(cricket::RELAY_PORT_TYPE, |
3192 cricket::RELAY_PORT_TYPE, | 3174 cricket::RELAY_PORT_TYPE, |
3193 cricket::TCP_PROTOCOL_NAME); | 3175 cricket::TCP_PROTOCOL_NAME); |
3194 | 3176 |
3195 // Finally, Local/Relay will be pinged. | 3177 // Finally, Local/Relay will be pinged. |
3196 VerifyNextPingableConnection(cricket::LOCAL_PORT_TYPE, | 3178 VerifyNextPingableConnection(cricket::LOCAL_PORT_TYPE, |
3197 cricket::RELAY_PORT_TYPE); | 3179 cricket::RELAY_PORT_TYPE); |
3198 } | 3180 } |
OLD | NEW |