| Index: net/quic/quic_connection_test.cc
|
| diff --git a/net/quic/quic_connection_test.cc b/net/quic/quic_connection_test.cc
|
| index fb7ae7922aefb655a3080309c52c4ee51cc62940..30f67cfe10a586aa906572d5ad2dcfd8bc4f555e 100644
|
| --- a/net/quic/quic_connection_test.cc
|
| +++ b/net/quic/quic_connection_test.cc
|
| @@ -2241,6 +2241,8 @@ TEST_P(QuicConnectionTest, SendPendingRetransmissionForQuicRstStreamNoError) {
|
| }
|
|
|
| TEST_P(QuicConnectionTest, DiscardRetransmit) {
|
| + ValueRestore<bool> old_flag(&FLAGS_quic_always_write_queued_retransmissions,
|
| + true);
|
| QuicPacketNumber last_packet;
|
| SendStreamDataToPeer(1, "foo", 0, !kFin, &last_packet); // Packet 1
|
| SendStreamDataToPeer(1, "foos", 3, !kFin, &last_packet); // Packet 2
|
| @@ -2279,6 +2281,48 @@ TEST_P(QuicConnectionTest, DiscardRetransmit) {
|
| EXPECT_EQ(0u, connection_.NumQueuedPackets());
|
| }
|
|
|
| +TEST_P(QuicConnectionTest, RetransmitAckedPacket) {
|
| + FLAGS_quic_always_write_queued_retransmissions = true;
|
| + QuicPacketNumber last_packet;
|
| + SendStreamDataToPeer(1, "foo", 0, !kFin, &last_packet); // Packet 1
|
| + SendStreamDataToPeer(1, "foos", 3, !kFin, &last_packet); // Packet 2
|
| + SendStreamDataToPeer(1, "fooos", 7, !kFin, &last_packet); // Packet 3
|
| +
|
| + EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
|
| +
|
| + // Instigate a loss with an ack.
|
| + QuicAckFrame nack_two = InitAckFrame(3);
|
| + NackPacket(2, &nack_two);
|
| + // The first nack should trigger a fast retransmission, but we'll be
|
| + // write blocked, so the packet will be queued.
|
| + BlockOnNextWrite();
|
| +
|
| + SendAlgorithmInterface::CongestionVector lost_packets;
|
| + lost_packets.push_back(std::make_pair(2, kMaxPacketSize));
|
| + EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _))
|
| + .WillOnce(SetArgPointee<4>(lost_packets));
|
| + EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
|
| + ProcessAckPacket(&nack_two);
|
| + EXPECT_EQ(1u, connection_.NumQueuedPackets());
|
| +
|
| + // Now, ack the previous transmission.
|
| + EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _));
|
| + QuicAckFrame ack_all = InitAckFrame(3);
|
| + ProcessAckPacket(&ack_all);
|
| +
|
| + // Unblock the socket and attempt to send the queued packets. We will always
|
| + // send the retransmission.
|
| + EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, 4, _, _)).Times(1);
|
| +
|
| + writer_->SetWritable();
|
| + connection_.OnCanWrite();
|
| +
|
| + EXPECT_EQ(0u, connection_.NumQueuedPackets());
|
| + // We do not store retransmittable frames of this retransmission.
|
| + EXPECT_FALSE(connection_.sent_packet_manager().HasRetransmittableFrames(
|
| + kDefaultPathId, 4));
|
| +}
|
| +
|
| TEST_P(QuicConnectionTest, RetransmitNackedLargestObserved) {
|
| EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
|
| QuicPacketNumber largest_observed;
|
|
|