Index: webrtc/p2p/base/p2ptransportchannel_unittest.cc |
diff --git a/webrtc/p2p/base/p2ptransportchannel_unittest.cc b/webrtc/p2p/base/p2ptransportchannel_unittest.cc |
index 86f4ec3852300fd1043e4ab049a72d7e8514bc95..16883e2428bfad89935f25ae1452c2bc3f1864af 100644 |
--- a/webrtc/p2p/base/p2ptransportchannel_unittest.cc |
+++ b/webrtc/p2p/base/p2ptransportchannel_unittest.cc |
@@ -2159,3 +2159,25 @@ TEST_F(P2PTransportChannelPingTest, TestConnectionPrunedAgain) { |
EXPECT_TRUE_WAIT(!conn2->active(), 1000); |
EXPECT_EQ(cricket::TransportChannelState::STATE_COMPLETED, ch.GetState()); |
} |
+ |
+TEST_F(P2PTransportChannelPingTest, TestStopSessions) { |
pthatcher1
2015/10/24 00:39:04
Can you leave a comment about what this is testing
honghaiz3
2015/10/26 16:47:46
Done. Not sure what do you mean by "make TestStopS
|
+ cricket::FakePortAllocator pa(rtc::Thread::Current(), nullptr); |
+ cricket::P2PTransportChannel ch("test channel", 1, nullptr, &pa); |
+ PrepareChannel(&ch); |
+ ch.SetIceConfig(CreateIceConfig(2000, false)); |
+ ch.Connect(); |
+ ch.MaybeStartGathering(); |
+ ch.AddRemoteCandidate(CreateCandidate("1.1.1.1", 1, 100)); |
+ cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1); |
+ ASSERT_TRUE(conn1 != nullptr); |
+ conn1->ReceivedPingResponse(); // Becomes writable and receiving |
+ EXPECT_TRUE(!ch.allocator_session()->IsGettingPorts()); |
+ |
+ ch.SetIceCredentials(kIceUfrag[1], kIcePwd[1]); |
+ ch.MaybeStartGathering(); |
+ ch.AddRemoteCandidate(CreateCandidate("2.2.2.2", 2, 100)); |
+ cricket::Connection* conn2 = WaitForConnectionTo(&ch, "2.2.2.2", 2); |
+ ASSERT_TRUE(conn2 != nullptr); |
+ conn2->ReceivedPingResponse(); // Becomes writable and receiving |
+ EXPECT_TRUE(!ch.allocator_session()->IsGettingPorts()); |
+} |