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

Unified Diff: net/quic/quic_connection_test.cc

Issue 1470713003: Landing Recent QUIC changes until and including Mon Nov 16 14:15:48 2015 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding NET_EXPORT_PRIVATE to DelegateInterface. 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
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..c503b515774dec2b6ef45e7eb91c59527330eecd 100644
--- a/net/quic/quic_connection_test.cc
+++ b/net/quic/quic_connection_test.cc
@@ -676,7 +676,10 @@ class QuicConnectionTest : public ::testing::TestWithParam<TestParams> {
framer_(SupportedVersions(version()),
QuicTime::Zero(),
Perspective::IS_CLIENT),
- peer_creator_(connection_id_, &framer_, &random_generator_),
+ peer_creator_(connection_id_,
+ &framer_,
+ &random_generator_,
+ /*delegate=*/nullptr),
send_algorithm_(new StrictMock<MockSendAlgorithm>),
loss_algorithm_(new MockLossAlgorithm()),
helper_(new TestConnectionHelper(&clock_, &random_generator_)),
@@ -5249,6 +5252,36 @@ 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(_, _, _, _))
+ .WillOnce(Return(PacketNumberSet()));
+ 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

Powered by Google App Engine
This is Rietveld 408576698