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

Unified Diff: net/quic/quic_connection_test.cc

Issue 1466153002: Clear the connection's send alarm when a new ack is received. Flag protected by gfe2_reloadable_fl… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@107691686
Patch Set: Created 5 years, 1 month 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_connection.cc ('k') | net/quic/quic_flags.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_connection_test.cc
diff --git a/net/quic/quic_connection_test.cc b/net/quic/quic_connection_test.cc
index 15dd943af32a4fed8b3a515587788beb850b2b9f..1f67691b147ec8f97f08f23c7a9ea385fe64eddc 100644
--- a/net/quic/quic_connection_test.cc
+++ b/net/quic/quic_connection_test.cc
@@ -5249,6 +5249,35 @@ TEST_P(QuicConnectionTest, DoNotSendGoAwayTwice) {
connection_.SendGoAway(QUIC_PEER_GOING_AWAY, kHeadersStreamId, "Going Away.");
}
+TEST_P(QuicConnectionTest, ReevaluateTimeUntilSendOnAck) {
+ FLAGS_quic_respect_send_alarm = true;
+ EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
+ connection_.SendStreamDataWithString(kClientDataStreamId1, "foo", 0, !kFin,
+ nullptr);
+
+ // Evaluate CanWrite, and have it return a non-Zero value.
+ EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _))
+ .WillRepeatedly(Return(QuicTime::Delta::FromMilliseconds(1)));
+ connection_.OnCanWrite();
+ EXPECT_TRUE(connection_.GetSendAlarm()->IsSet());
+ EXPECT_EQ(clock_.Now().Add(QuicTime::Delta::FromMilliseconds(1)),
+ connection_.GetSendAlarm()->deadline());
+
+ // Process an ack and the send alarm will be set to the new 2ms delay.
+ QuicAckFrame ack = InitAckFrame(1);
+ EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _));
+ EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
+ EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _))
+ .WillRepeatedly(Return(QuicTime::Delta::FromMilliseconds(2)));
+ ProcessAckPacket(&ack);
+ EXPECT_EQ(1u, writer_->frame_count());
+ EXPECT_EQ(1u, writer_->stream_frames().size());
+ EXPECT_TRUE(connection_.GetSendAlarm()->IsSet());
+ EXPECT_EQ(clock_.Now().Add(QuicTime::Delta::FromMilliseconds(2)),
+ connection_.GetSendAlarm()->deadline());
+ writer_->Reset();
+}
+
} // namespace
} // namespace test
} // namespace net
« no previous file with comments | « net/quic/quic_connection.cc ('k') | net/quic/quic_flags.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698