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

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 and add tests 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
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..1b5fc627d62041eb14a89cff5f97e236fd9bc187 100644
--- a/webrtc/p2p/base/p2ptransportchannel_unittest.cc
+++ b/webrtc/p2p/base/p2ptransportchannel_unittest.cc
@@ -1861,3 +1861,20 @@ 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.set_receiving_timeout(500);
+ 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);
+}
pthatcher1 2015/07/07 20:49:55 Can you add a test for when set_receiving_timeout
honghaiz3 2015/08/05 23:56:57 Done.

Powered by Google App Engine
This is Rietveld 408576698