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

Unified Diff: net/quic/quic_connection_test.cc

Issue 841603005: Change QUIC's RTO implementation. Protected by FLAGS_quic_use_new_rto. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Remove_transmission_stats_83598791
Patch Set: Merge internal change: 83966746 Created 5 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
« no previous file with comments | « no previous file | 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 ebc588d9f30731c3581316d204053461ab449316..a55c57590f8b4055cbb399b5839aba3fdbbc09a9 100644
--- a/net/quic/quic_connection_test.cc
+++ b/net/quic/quic_connection_test.cc
@@ -1761,8 +1761,13 @@ TEST_P(QuicConnectionTest, RemoveFECFromInflightOnRetransmissionTimeout) {
// the first transmission will have 1 byte for FEC group number and 2 bytes of
// stream frame size, which are absent in the retransmission.
size_t retransmitted_packet = protected_packet - 3;
- EXPECT_EQ(retransmitted_packet,
- QuicSentPacketManagerPeer::GetBytesInFlight(manager_));
+ if (FLAGS_quic_use_new_rto) {
+ EXPECT_EQ(protected_packet + retransmitted_packet,
+ QuicSentPacketManagerPeer::GetBytesInFlight(manager_));
+ } else {
+ EXPECT_EQ(retransmitted_packet,
+ QuicSentPacketManagerPeer::GetBytesInFlight(manager_));
+ }
EXPECT_FALSE(connection_.GetFecAlarm()->IsSet());
// Receive ack for the retransmission. No data should be outstanding.
@@ -1770,11 +1775,13 @@ TEST_P(QuicConnectionTest, RemoveFECFromInflightOnRetransmissionTimeout) {
NackPacket(1, &ack);
NackPacket(2, &ack);
SequenceNumberSet lost_packets;
+ if (FLAGS_quic_use_new_rto) {
+ lost_packets.insert(1);
+ }
EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _))
.WillOnce(Return(lost_packets));
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
ProcessAckPacket(&ack);
- EXPECT_EQ(0u, QuicSentPacketManagerPeer::GetBytesInFlight(manager_));
// Ensure the alarm is not set since all packets have been acked or abandoned.
EXPECT_FALSE(connection_.GetRetransmissionAlarm()->IsSet());
@@ -1999,9 +2006,12 @@ TEST_P(QuicConnectionTest, NoTLPForFECPacket) {
// Simulate the retransmission alarm firing. FEC packet is no longer
// outstanding.
- EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(false));
+ if (!FLAGS_quic_use_new_rto) {
+ EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(false));
+ }
clock_.AdvanceTime(rto_time.Subtract(clock_.Now()));
connection_.GetRetransmissionAlarm()->Fire();
+
EXPECT_FALSE(connection_.GetRetransmissionAlarm()->IsSet());
EXPECT_EQ(0u, QuicSentPacketManagerPeer::GetBytesInFlight(manager_));
}
@@ -2326,21 +2336,27 @@ TEST_P(QuicConnectionTest, QueueAfterTwoRTOs) {
connection_.SendStreamDataWithString(3, "foo", i * 3, !kFin, nullptr);
}
- // Block the congestion window and ensure they're queued.
+ // Block the writer and ensure they're queued.
BlockOnNextWrite();
clock_.AdvanceTime(DefaultRetransmissionTime());
// Only one packet should be retransmitted.
- EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true));
+ if (!FLAGS_quic_use_new_rto) {
+ EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true));
+ }
connection_.GetRetransmissionAlarm()->Fire();
EXPECT_TRUE(connection_.HasQueuedData());
- // Unblock the congestion window.
+ // Unblock the writer.
writer_->SetWritable();
clock_.AdvanceTime(QuicTime::Delta::FromMicroseconds(
2 * DefaultRetransmissionTime().ToMicroseconds()));
// Retransmit already retransmitted packets event though the sequence number
// greater than the largest observed.
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(10);
+ if (FLAGS_quic_use_new_rto) {
+ EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2);
+ } else {
+ EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(10);
+ }
connection_.GetRetransmissionAlarm()->Fire();
connection_.OnCanWrite();
}
@@ -2365,7 +2381,9 @@ TEST_P(QuicConnectionTest, RetransmitWriteBlockedAckedOriginalThenSent) {
BlockOnNextWrite();
writer_->set_is_write_blocked_data_buffered(true);
// Simulate the retransmission alarm firing.
- EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(_));
+ if (!FLAGS_quic_use_new_rto) {
+ EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(_));
+ }
clock_.AdvanceTime(DefaultRetransmissionTime());
connection_.GetRetransmissionAlarm()->Fire();
@@ -2373,7 +2391,9 @@ TEST_P(QuicConnectionTest, RetransmitWriteBlockedAckedOriginalThenSent) {
// rare circumstances with write blocked sockets.
QuicAckFrame ack = InitAckFrame(1);
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
- EXPECT_CALL(*send_algorithm_, RevertRetransmissionTimeout());
+ if (!FLAGS_quic_use_new_rto) {
+ EXPECT_CALL(*send_algorithm_, RevertRetransmissionTimeout());
+ }
ProcessAckPacket(&ack);
writer_->SetWritable();
@@ -2658,7 +2678,9 @@ TEST_P(QuicConnectionTest, RTO) {
connection_.GetRetransmissionAlarm()->deadline());
// Simulate the retransmission alarm firing.
clock_.AdvanceTime(DefaultRetransmissionTime());
- EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true));
+ if (!FLAGS_quic_use_new_rto) {
+ EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true));
+ }
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, 2u, _, _));
connection_.GetRetransmissionAlarm()->Fire();
EXPECT_EQ(2u, writer_->header().packet_sequence_number);
@@ -2686,7 +2708,9 @@ TEST_P(QuicConnectionTest, RTOWithSameEncryptionLevel) {
connection_.GetRetransmissionAlarm()->deadline());
{
InSequence s;
- EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true));
+ if (!FLAGS_quic_use_new_rto) {
+ EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true));
+ }
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, 3, _, _));
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, 4, _, _));
}
@@ -2740,7 +2764,9 @@ TEST_P(QuicConnectionTest,
// Simulate the retransmission alarm firing and the socket blocking.
BlockOnNextWrite();
- EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true));
+ if (!FLAGS_quic_use_new_rto) {
+ EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true));
+ }
clock_.AdvanceTime(DefaultRetransmissionTime());
connection_.GetRetransmissionAlarm()->Fire();
@@ -2902,7 +2928,9 @@ TEST_P(QuicConnectionTest, TestRetransmitOrder) {
EXPECT_NE(first_packet_size, second_packet_size);
// Advance the clock by huge time to make sure packets will be retransmitted.
clock_.AdvanceTime(QuicTime::Delta::FromSeconds(10));
- EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true));
+ if (!FLAGS_quic_use_new_rto) {
+ EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true));
+ }
{
InSequence s;
EXPECT_CALL(*send_algorithm_,
@@ -2914,7 +2942,9 @@ TEST_P(QuicConnectionTest, TestRetransmitOrder) {
// Advance again and expect the packets to be sent again in the same order.
clock_.AdvanceTime(QuicTime::Delta::FromSeconds(20));
- EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true));
+ if (!FLAGS_quic_use_new_rto) {
+ EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true));
+ }
{
InSequence s;
EXPECT_CALL(*send_algorithm_,
@@ -2925,58 +2955,6 @@ TEST_P(QuicConnectionTest, TestRetransmitOrder) {
connection_.GetRetransmissionAlarm()->Fire();
}
-TEST_P(QuicConnectionTest, RetransmissionCountCalculation) {
- EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
- QuicPacketSequenceNumber original_sequence_number;
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
- .WillOnce(DoAll(SaveArg<2>(&original_sequence_number), Return(true)));
- connection_.SendStreamDataWithString(3, "foo", 0, !kFin, nullptr);
-
- EXPECT_TRUE(QuicConnectionPeer::IsSavedForRetransmission(
- &connection_, original_sequence_number));
- EXPECT_FALSE(QuicConnectionPeer::IsRetransmission(
- &connection_, original_sequence_number));
- // Force retransmission due to RTO.
- clock_.AdvanceTime(QuicTime::Delta::FromSeconds(10));
- EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true));
- QuicPacketSequenceNumber rto_sequence_number;
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
- .WillOnce(DoAll(SaveArg<2>(&rto_sequence_number), Return(true)));
- connection_.GetRetransmissionAlarm()->Fire();
- EXPECT_FALSE(QuicConnectionPeer::IsSavedForRetransmission(
- &connection_, original_sequence_number));
- ASSERT_TRUE(QuicConnectionPeer::IsSavedForRetransmission(
- &connection_, rto_sequence_number));
- EXPECT_TRUE(QuicConnectionPeer::IsRetransmission(
- &connection_, rto_sequence_number));
- // Once by explicit nack.
- SequenceNumberSet lost_packets;
- lost_packets.insert(rto_sequence_number);
- EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _))
- .WillOnce(Return(lost_packets));
- EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
- QuicPacketSequenceNumber nack_sequence_number = 0;
- // Ack packets might generate some other packets, which are not
- // retransmissions. (More ack packets).
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
- .Times(AnyNumber());
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
- .WillOnce(DoAll(SaveArg<2>(&nack_sequence_number), Return(true)));
- QuicAckFrame ack = InitAckFrame(rto_sequence_number);
- // Nack the retransmitted packet.
- NackPacket(original_sequence_number, &ack);
- NackPacket(rto_sequence_number, &ack);
- ProcessAckPacket(&ack);
-
- ASSERT_NE(0u, nack_sequence_number);
- EXPECT_FALSE(QuicConnectionPeer::IsSavedForRetransmission(
- &connection_, rto_sequence_number));
- ASSERT_TRUE(QuicConnectionPeer::IsSavedForRetransmission(
- &connection_, nack_sequence_number));
- EXPECT_TRUE(QuicConnectionPeer::IsRetransmission(
- &connection_, nack_sequence_number));
-}
-
TEST_P(QuicConnectionTest, SetRTOAfterWritingToSocket) {
BlockOnNextWrite();
connection_.SendStreamDataWithString(1, "foo", 0, !kFin, nullptr);
@@ -3015,7 +2993,9 @@ TEST_P(QuicConnectionTest, DelayRTOWithAckReceipt) {
// Ensure the second packet gets retransmitted when it finally fires.
EXPECT_TRUE(retransmission_alarm->IsSet());
EXPECT_LT(retransmission_alarm->deadline(), clock_.ApproximateNow());
- EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true));
+ if (!FLAGS_quic_use_new_rto) {
+ EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true));
+ }
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _));
// Manually cancel the alarm to simulate a real test.
connection_.GetRetransmissionAlarm()->Fire();
@@ -3992,7 +3972,9 @@ TEST_P(QuicConnectionTest, CheckSendStats) {
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
EXPECT_CALL(visitor_, OnCanWrite()).Times(2);
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
- EXPECT_CALL(*send_algorithm_, RevertRetransmissionTimeout());
+ if (!FLAGS_quic_use_new_rto) {
+ EXPECT_CALL(*send_algorithm_, RevertRetransmissionTimeout());
+ }
ProcessAckPacket(&nack_three);
EXPECT_CALL(*send_algorithm_, BandwidthEstimate()).WillOnce(
@@ -4238,7 +4220,9 @@ TEST_P(QuicConnectionTest, AckNotifierCallbackForAckAfterRTO) {
connection_.GetRetransmissionAlarm()->deadline());
// Simulate the retransmission alarm firing.
clock_.AdvanceTime(DefaultRetransmissionTime());
- EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true));
+ if (!FLAGS_quic_use_new_rto) {
+ EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true));
+ }
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, 2u, _, _));
connection_.GetRetransmissionAlarm()->Fire();
EXPECT_EQ(2u, writer_->header().packet_sequence_number);
@@ -4248,7 +4232,9 @@ TEST_P(QuicConnectionTest, AckNotifierCallbackForAckAfterRTO) {
// Ack the original packet, which will revert the RTO.
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
EXPECT_CALL(*delegate.get(), OnAckNotification(1, _, _));
- EXPECT_CALL(*send_algorithm_, RevertRetransmissionTimeout());
+ if (!FLAGS_quic_use_new_rto) {
+ EXPECT_CALL(*send_algorithm_, RevertRetransmissionTimeout());
+ }
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
QuicAckFrame ack_frame = InitAckFrame(1);
ProcessAckPacket(&ack_frame);
« no previous file with comments | « no previous file | net/quic/quic_flags.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698