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

Unified Diff: webrtc/p2p/base/p2ptransportchannel_unittest.cc

Issue 1857453002: Do not stop a session unless the candidate of a writable connection belongs to the (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Add variables to improve readability Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/p2p/base/p2ptransportchannel.cc ('k') | webrtc/p2p/client/fakeportallocator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/p2ptransportchannel_unittest.cc
diff --git a/webrtc/p2p/base/p2ptransportchannel_unittest.cc b/webrtc/p2p/base/p2ptransportchannel_unittest.cc
index 87e92a5b30d0756a6d644a649657eca1b6121553..beeddafd364bd1f9e0c030c6335b02447458f1d8 100644
--- a/webrtc/p2p/base/p2ptransportchannel_unittest.cc
+++ b/webrtc/p2p/base/p2ptransportchannel_unittest.cc
@@ -2532,9 +2532,10 @@ TEST_F(P2PTransportChannelPingTest, TestDeleteConnectionsIfAllWriteTimedout) {
EXPECT_TRUE_WAIT(ch.connections().empty(), 1000);
}
-// Test that after a port allocator session is started, it will be stopped
-// when a new connection becomes writable and receiving. Also test that this
-// holds even if the transport channel did not lose the writability.
+// Tests that after a port allocator session is started, it will be stopped
+// when a new connection becomes writable and receiving. Also tests that if a
+// connection belonging to an old session becomes writable, it won't stop
+// the current port allocator session.
TEST_F(P2PTransportChannelPingTest, TestStopPortAllocatorSessions) {
cricket::FakePortAllocator pa(rtc::Thread::Current(), nullptr);
cricket::P2PTransportChannel ch("test channel", 1, &pa);
@@ -2548,11 +2549,17 @@ TEST_F(P2PTransportChannelPingTest, TestStopPortAllocatorSessions) {
conn1->ReceivedPingResponse(); // Becomes writable and receiving
EXPECT_TRUE(!ch.allocator_session()->IsGettingPorts());
- // Restart gathering even if the transport channel is still writable.
- // It should stop getting ports after a new connection becomes strongly
- // connected.
+ // Start a new session. Even though conn1, which belongs to an older
+ // session, becomes unwritable and writable again, it should not stop the
+ // current session.
ch.SetIceCredentials(kIceUfrag[1], kIcePwd[1]);
ch.MaybeStartGathering();
+ conn1->Prune();
+ conn1->ReceivedPingResponse();
+ EXPECT_TRUE(ch.allocator_session()->IsGettingPorts());
+
+ // But if a new connection created from the new session becomes writable,
+ // it will stop the current session.
ch.AddRemoteCandidate(CreateHostCandidate("2.2.2.2", 2, 100));
cricket::Connection* conn2 = WaitForConnectionTo(&ch, "2.2.2.2", 2);
ASSERT_TRUE(conn2 != nullptr);
« no previous file with comments | « webrtc/p2p/base/p2ptransportchannel.cc ('k') | webrtc/p2p/client/fakeportallocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698