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

Unified Diff: net/quic/quic_sent_packet_manager_test.cc

Issue 1665303003: Adds plumbing for QUIC early connection migration. No behavior change. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@home
Patch Set: Created 4 years, 10 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 | « net/quic/quic_sent_packet_manager.cc ('k') | net/quic/quic_session.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 0fe84fb1fece3412c563f817f2df0a6e087f0a05..e2f6be34eda1bb811d9513548c9bfd4ea45778aa 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, "") {
@@ -1170,6 +1173,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,
@@ -1203,6 +1207,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,
@@ -1224,6 +1229,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());
}
@@ -1357,6 +1377,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_));
@@ -1381,6 +1402,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_));
« no previous file with comments | « net/quic/quic_sent_packet_manager.cc ('k') | net/quic/quic_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698