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

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

Issue 2009763002: Ping connections with the fast rate until each connection is pinged at least three times. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 4 years, 7 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 e2c50031268a8dd5025bc252a8b532317dfc5ced..30b1e452a6d73cc39fb3c6560bad75bf72e2ff7e 100644
--- a/webrtc/p2p/base/p2ptransportchannel_unittest.cc
+++ b/webrtc/p2p/base/p2ptransportchannel_unittest.cc
@@ -37,6 +37,7 @@ using cricket::kMinimumStepDelay;
using cricket::kDefaultStepDelay;
using cricket::PORTALLOCATOR_ENABLE_SHARED_SOCKET;
using cricket::ServerAddresses;
+using cricket::kMinNumPingsSent;
using rtc::SocketAddress;
static const int kDefaultTimeout = 1000;
@@ -2126,6 +2127,28 @@ TEST_F(P2PTransportChannelPingTest, TestTriggeredChecks) {
EXPECT_EQ(conn1, FindNextPingableConnectionAndPingIt(&ch));
}
+TEST_F(P2PTransportChannelPingTest, TestAllConnectionsPingedSufficiently) {
+ cricket::FakePortAllocator pa(rtc::Thread::Current(), nullptr);
+ cricket::P2PTransportChannel ch("ping sufficiently", 1, &pa);
+ PrepareChannel(&ch);
+ ch.Connect();
+ ch.MaybeStartGathering();
+ ch.AddRemoteCandidate(CreateHostCandidate("1.1.1.1", 1, 1));
+ ch.AddRemoteCandidate(CreateHostCandidate("2.2.2.2", 2, 2));
+
+ cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1);
+ cricket::Connection* conn2 = WaitForConnectionTo(&ch, "2.2.2.2", 2);
+ ASSERT_TRUE(conn1 != nullptr);
+ ASSERT_TRUE(conn2 != nullptr);
+
+ // Low-priority connection becomes writable so that the other connection
+ // is not pruned.
+ conn1->ReceivedPingResponse();
+ EXPECT_TRUE_WAIT(conn1->num_pings_sent() >= kMinNumPingsSent &&
+ conn2->num_pings_sent() >= kMinNumPingsSent,
+ kDefaultTimeout);
+}
+
TEST_F(P2PTransportChannelPingTest, TestNoTriggeredChecksWhenWritable) {
cricket::FakePortAllocator pa(rtc::Thread::Current(), nullptr);
cricket::P2PTransportChannel ch("trigger checks", 1, &pa);
@@ -2807,11 +2830,17 @@ TEST_F(P2PTransportChannelMostLikelyToWorkFirstTest,
// Verify that conn3 will be the "best connection" since it is readable and
// writable. After |MAX_CURRENT_STRONG_INTERVAL|, it should be the next
// pingable connection.
+ /*
+ * We now ping the connection with fast rates until all connections
+ * are pinged three times. The following test becomes flaky because the
+ * best connection may have been pinged before |max_strong_interval|.
+ * Temporarily disable this until we use fake clock for the test.
pthatcher1 2016/05/25 17:29:13 We should have a TODO to re-enable it. And coul
honghaiz3 2016/05/25 18:40:02 Done for both.
EXPECT_TRUE_WAIT(conn3 == ch.best_connection(), 5000);
WAIT(false, max_strong_interval + 100);
conn3->ReceivedPingResponse();
ASSERT_TRUE(conn3->writable());
EXPECT_EQ(conn3, FindNextPingableConnectionAndPingIt(&ch));
+ */
}
// Test that Relay/Relay connections will be pinged first when everything has

Powered by Google App Engine
This is Rietveld 408576698