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

Unified Diff: net/quic/quic_connection_test.cc

Issue 1613513003: Early connection migration in QUIC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@home
Patch Set: Style nit fixed. Created 4 years, 11 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: net/quic/quic_connection_test.cc
diff --git a/net/quic/quic_connection_test.cc b/net/quic/quic_connection_test.cc
index 00a48cf85c36ffafa498bbe3aae91d3746735a79..0d1482be0646f39b8a3e6d715b3f7d98ef4fea22 100644
--- a/net/quic/quic_connection_test.cc
+++ b/net/quic/quic_connection_test.cc
@@ -3483,6 +3483,7 @@ TEST_P(QuicConnectionTest, TestRetransmitOrder) {
clock_.AdvanceTime(QuicTime::Delta::FromSeconds(20));
{
InSequence s;
+ EXPECT_CALL(visitor_, MaybeMigrateConnection());
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, first_packet_size, _));
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, second_packet_size, _));
}
@@ -5686,6 +5687,31 @@ TEST_P(QuicConnectionTest, BadMultipathFlag) {
EXPECT_FALSE(connection_.connected());
}
+TEST_P(QuicConnectionTest, MaybeMigrateConnection) {
+ QuicByteCount packet_size;
+ const size_t kMinTimeoutsWhenPeerUnreachable = 2;
+
+ EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
+ .WillOnce(DoAll(SaveArg<3>(&packet_size), Return(true)));
+ connection_.SendStreamDataWithString(3, "packet", 0, !kFin, nullptr);
+ for (size_t i = 1; i < kMinTimeoutsWhenPeerUnreachable; ++i) {
+ // Advance the clock by huge time; packet will be retransmitted.
+ clock_.AdvanceTime(QuicTime::Delta::FromSeconds(10 * i));
+ EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, packet_size, _));
+ connection_.GetRetransmissionAlarm()->Fire();
+ }
+ // Next RTO should cause early migration to be triggered before
+ // retransmission is sent out.
+ clock_.AdvanceTime(
+ QuicTime::Delta::FromSeconds(kMinTimeoutsWhenPeerUnreachable * 10));
+ {
+ InSequence s;
+ EXPECT_CALL(visitor_, MaybeMigrateConnection());
+ EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, packet_size, _));
+ }
+ connection_.GetRetransmissionAlarm()->Fire();
+}
+
} // namespace
} // namespace test
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698