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

Unified Diff: net/quic/quic_sent_packet_manager_test.cc

Issue 1613513003: Early connection migration in QUIC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@home
Patch Set: Typo 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_sent_packet_manager_test.cc
diff --git a/net/quic/quic_sent_packet_manager_test.cc b/net/quic/quic_sent_packet_manager_test.cc
index 66222aa9ecc99dcfab4ec2c850a3206e0233513c..82c76fe25effaa09903b8af3e5edc9de9af635a5 100644
--- a/net/quic/quic_sent_packet_manager_test.cc
+++ b/net/quic/quic_sent_packet_manager_test.cc
@@ -33,6 +33,9 @@ const uint32_t kDefaultLength = 1000;
// Stream ID for data sent in CreatePacket().
const QuicStreamId kStreamId = 7;
+// Minimum number of consecutive RTOs before path is considered to be degrading.
+const size_t kMinTimeoutsBeforePathDegrading = 2;
+
// Matcher to check the key of the key-value pair it receives as first argument
// equals its second argument.
MATCHER(KeyEq, "") {
@@ -1171,6 +1174,7 @@ TEST_F(QuicSentPacketManagerTest, TwoRetransmissionTimeoutsAckSecond) {
EXPECT_FALSE(manager_.HasPendingRetransmissions());
// Rto a second time.
+ EXPECT_CALL(*network_change_visitor_, OnPathDegrading());
manager_.OnRetransmissionTimeout();
EXPECT_TRUE(manager_.HasPendingRetransmissions());
EXPECT_EQ(2 * kDefaultLength,
@@ -1204,6 +1208,7 @@ TEST_F(QuicSentPacketManagerTest, TwoRetransmissionTimeoutsAckFirst) {
EXPECT_FALSE(manager_.HasPendingRetransmissions());
// Rto a second time.
+ EXPECT_CALL(*network_change_visitor_, OnPathDegrading());
manager_.OnRetransmissionTimeout();
EXPECT_TRUE(manager_.HasPendingRetransmissions());
EXPECT_EQ(2 * kDefaultLength,
@@ -1225,6 +1230,21 @@ TEST_F(QuicSentPacketManagerTest, TwoRetransmissionTimeoutsAckFirst) {
QuicSentPacketManagerPeer::GetBytesInFlight(&manager_));
}
+TEST_F(QuicSentPacketManagerTest, OnPathDegrading) {
+ SendDataPacket(1);
+ QuicTime::Delta delay = QuicTime::Delta::FromMilliseconds(500);
+ EXPECT_CALL(*send_algorithm_, RetransmissionDelay())
+ .WillRepeatedly(Return(delay));
+ for (size_t i = 1; i < kMinTimeoutsBeforePathDegrading; ++i) {
+ manager_.OnRetransmissionTimeout();
+ RetransmitNextPacket(i + 2);
+ }
+ // Next RTO should cause network_change_visitor_'s OnPathDegrading method
+ // to be called.
+ EXPECT_CALL(*network_change_visitor_, OnPathDegrading());
+ manager_.OnRetransmissionTimeout();
+}
+
TEST_F(QuicSentPacketManagerTest, GetTransmissionTime) {
EXPECT_EQ(QuicTime::Zero(), manager_.GetRetransmissionTime());
}
@@ -1358,6 +1378,7 @@ TEST_F(QuicSentPacketManagerTest, GetTransmissionDelayMin) {
// If the delay is smaller than the min, ensure it exponentially backs off
// from the min.
+ EXPECT_CALL(*network_change_visitor_, OnPathDegrading());
for (int i = 0; i < 5; ++i) {
EXPECT_EQ(delay,
QuicSentPacketManagerPeer::GetRetransmissionDelay(&manager_));
@@ -1382,6 +1403,7 @@ TEST_F(QuicSentPacketManagerTest, GetTransmissionDelay) {
.WillRepeatedly(Return(delay));
// Delay should back off exponentially.
+ EXPECT_CALL(*network_change_visitor_, OnPathDegrading());
for (int i = 0; i < 5; ++i) {
EXPECT_EQ(delay,
QuicSentPacketManagerPeer::GetRetransmissionDelay(&manager_));

Powered by Google App Engine
This is Rietveld 408576698