Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(561)

Side by Side Diff: webrtc/p2p/base/p2ptransportchannel_unittest.cc

Issue 2068263003: Do not delete a connection in the turn port with permission error or refresh error. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Address Taylor's comment and merge Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2244 matching lines...) Expand 10 before | Expand all | Expand 10 after
2255 conn1->ReceivedPingResponse(LOW_RTT); 2255 conn1->ReceivedPingResponse(LOW_RTT);
2256 ASSERT_TRUE(conn1->writable()); 2256 ASSERT_TRUE(conn1->writable());
2257 conn1->ReceivedPing(); 2257 conn1->ReceivedPing();
2258 2258
2259 // Ping received, but the connection is already writable, so no 2259 // Ping received, but the connection is already writable, so no
2260 // "triggered check" and conn2 is pinged before conn1 because it has 2260 // "triggered check" and conn2 is pinged before conn1 because it has
2261 // a higher priority. 2261 // a higher priority.
2262 EXPECT_EQ(conn2, FindNextPingableConnectionAndPingIt(&ch)); 2262 EXPECT_EQ(conn2, FindNextPingableConnectionAndPingIt(&ch));
2263 } 2263 }
2264 2264
2265 TEST_F(P2PTransportChannelPingTest, TestFailedConnectionNotPingable) {
2266 cricket::FakePortAllocator pa(rtc::Thread::Current(), nullptr);
2267 cricket::P2PTransportChannel ch("Do not ping failed connections", 1, &pa);
2268 PrepareChannel(&ch);
2269 ch.Connect();
2270 ch.MaybeStartGathering();
2271 ch.AddRemoteCandidate(CreateHostCandidate("1.1.1.1", 1, 1));
2272
2273 cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1);
2274 ASSERT_TRUE(conn1 != nullptr);
2275
2276 EXPECT_EQ(conn1, ch.FindNextPingableConnection());
2277 conn1->Prune(); // A pruned connection may still be pingable.
2278 EXPECT_EQ(conn1, ch.FindNextPingableConnection());
2279 conn1->FailAndPrune();
2280 EXPECT_TRUE(nullptr == ch.FindNextPingableConnection());
2281 }
2282
2265 TEST_F(P2PTransportChannelPingTest, TestSignalStateChanged) { 2283 TEST_F(P2PTransportChannelPingTest, TestSignalStateChanged) {
2266 cricket::FakePortAllocator pa(rtc::Thread::Current(), nullptr); 2284 cricket::FakePortAllocator pa(rtc::Thread::Current(), nullptr);
2267 cricket::P2PTransportChannel ch("state change", 1, &pa); 2285 cricket::P2PTransportChannel ch("state change", 1, &pa);
2268 PrepareChannel(&ch); 2286 PrepareChannel(&ch);
2269 ch.Connect(); 2287 ch.Connect();
2270 ch.MaybeStartGathering(); 2288 ch.MaybeStartGathering();
2271 ch.AddRemoteCandidate(CreateHostCandidate("1.1.1.1", 1, 1)); 2289 ch.AddRemoteCandidate(CreateHostCandidate("1.1.1.1", 1, 1));
2272 cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1); 2290 cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1);
2273 ASSERT_TRUE(conn1 != nullptr); 2291 ASSERT_TRUE(conn1 != nullptr);
2274 // Pruning the connection reduces the set of active connections and changes 2292 // Pruning the connection reduces the set of active connections and changes
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after
3155 3173
3156 // TCP Relay/Relay is the next. 3174 // TCP Relay/Relay is the next.
3157 VerifyNextPingableConnection(cricket::RELAY_PORT_TYPE, 3175 VerifyNextPingableConnection(cricket::RELAY_PORT_TYPE,
3158 cricket::RELAY_PORT_TYPE, 3176 cricket::RELAY_PORT_TYPE,
3159 cricket::TCP_PROTOCOL_NAME); 3177 cricket::TCP_PROTOCOL_NAME);
3160 3178
3161 // Finally, Local/Relay will be pinged. 3179 // Finally, Local/Relay will be pinged.
3162 VerifyNextPingableConnection(cricket::LOCAL_PORT_TYPE, 3180 VerifyNextPingableConnection(cricket::LOCAL_PORT_TYPE,
3163 cricket::RELAY_PORT_TYPE); 3181 cricket::RELAY_PORT_TYPE);
3164 } 3182 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698