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

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

Issue 1207563002: Add flakiness check if there is no received packets in a certain period. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Address comments Created 5 years, 5 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/base/port.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 13f19ae0a54272cb39fb7786162dc761e7277e9a..8213f0d9da3295f862c72b843e1c02ec8aeb6cd2 100644
--- a/webrtc/p2p/base/p2ptransportchannel_unittest.cc
+++ b/webrtc/p2p/base/p2ptransportchannel_unittest.cc
@@ -1861,3 +1861,38 @@ TEST_F(P2PTransportChannelPingTest, ConnectionResurrection) {
ASSERT_TRUE(conn3 != nullptr);
EXPECT_EQ(conn3->remote_candidate().priority(), prflx_priority);
}
+
+TEST_F(P2PTransportChannelPingTest, TestReceivingStateChange) {
+ cricket::FakePortAllocator pa(rtc::Thread::Current(), nullptr);
+ cricket::P2PTransportChannel ch("receiving state change", 1, nullptr, &pa);
+ PrepareChannel(&ch);
+ ch.Connect();
+ ch.OnCandidate(CreateCandidate("1.1.1.1", 1, 1));
+ cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1);
+ ASSERT_TRUE(conn1 != nullptr);
+
+ conn1->ReceivedPing();
+ conn1->OnReadPacket("ABC", 3, rtc::CreatePacketTime(0));
+ EXPECT_TRUE_WAIT(ch.best_connection() != nullptr, 1000)
+ EXPECT_TRUE_WAIT(ch.receiving(), 1000);
+ // The default receiving timeout value is 2500ms.
+ EXPECT_TRUE_WAIT(!ch.receiving(), 4000);
+}
+
+TEST_F(P2PTransportChannelPingTest,
+ TestReceivingStateChangeSetReceivingTimeout) {
+ cricket::FakePortAllocator pa(rtc::Thread::Current(), nullptr);
+ cricket::P2PTransportChannel ch("receiving state change", 1, nullptr, &pa);
+ PrepareChannel(&ch);
+ ch.set_receiving_timeout(500);
pthatcher1 2015/07/07 22:01:40 On second though, just delete the previous test an
honghaiz3 2015/08/05 23:56:57 Done.
+ ch.Connect();
+ ch.OnCandidate(CreateCandidate("1.1.1.1", 1, 1));
+ cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1);
+ ASSERT_TRUE(conn1 != nullptr);
+
+ conn1->ReceivedPing();
+ conn1->OnReadPacket("ABC", 3, rtc::CreatePacketTime(0));
+ EXPECT_TRUE_WAIT(ch.best_connection() != nullptr, 1000)
+ EXPECT_TRUE_WAIT(ch.receiving(), 1000);
+ EXPECT_TRUE_WAIT(!ch.receiving(), 1000);
+}
« no previous file with comments | « webrtc/p2p/base/p2ptransportchannel.cc ('k') | webrtc/p2p/base/port.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698