| Index: net/quic/quic_connection_test.cc
|
| diff --git a/net/quic/quic_connection_test.cc b/net/quic/quic_connection_test.cc
|
| index 3487cd0c9a117d54c529d2c46483885656db7348..9a642d0bbc9071b8833d30ea0673c1da73fd14b8 100644
|
| --- a/net/quic/quic_connection_test.cc
|
| +++ b/net/quic/quic_connection_test.cc
|
| @@ -1774,6 +1774,46 @@ TEST_F(QuicConnectionTest, WriteBlockedThenSent) {
|
| EXPECT_TRUE(connection_.GetRetransmissionAlarm()->IsSet());
|
| }
|
|
|
| +TEST_F(QuicConnectionTest, WriteBlockedAckedThenSent) {
|
| + EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
|
| + writer_->SetWriteBlocked();
|
| +
|
| + writer_->set_is_write_blocked_data_buffered(true);
|
| + connection_.SendStreamDataWithString(1, "foo", 0, !kFin, NULL);
|
| + EXPECT_FALSE(connection_.GetRetransmissionAlarm()->IsSet());
|
| +
|
| + // Ack the sent packet before the callback returns, which happens in
|
| + // rare circumstances with write blocked sockets.
|
| + QuicAckFrame ack = InitAckFrame(1, 0);
|
| + ProcessAckPacket(&ack);
|
| +
|
| + EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(0);
|
| + connection_.OnPacketSent(WriteResult(WRITE_STATUS_OK, 0));
|
| + EXPECT_FALSE(connection_.GetRetransmissionAlarm()->IsSet());
|
| +}
|
| +
|
| +TEST_F(QuicConnectionTest, RetransmitWriteBlockedAckedOriginalThenSent) {
|
| + EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
|
| + connection_.SendStreamDataWithString(1, "foo", 0, !kFin, NULL);
|
| + EXPECT_TRUE(connection_.GetRetransmissionAlarm()->IsSet());
|
| +
|
| + writer_->SetWriteBlocked();
|
| + writer_->set_is_write_blocked_data_buffered(true);
|
| +
|
| + // Simulate the retransmission alarm firing.
|
| + EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(1, _));
|
| + clock_.AdvanceTime(DefaultRetransmissionTime());
|
| + connection_.GetRetransmissionAlarm()->Fire();
|
| +
|
| + // Ack the sent packet before the callback returns, which happens in
|
| + // rare circumstances with write blocked sockets.
|
| + QuicAckFrame ack = InitAckFrame(1, 0);
|
| + ProcessAckPacket(&ack);
|
| +
|
| + connection_.OnPacketSent(WriteResult(WRITE_STATUS_OK, 0));
|
| + EXPECT_TRUE(connection_.GetRetransmissionAlarm()->IsSet());
|
| +}
|
| +
|
| TEST_F(QuicConnectionTest, ResumptionAlarmThenWriteBlocked) {
|
| // Set the send and resumption alarm, then block the connection.
|
| connection_.GetResumeWritesAlarm()->Set(clock_.ApproximateNow());
|
|
|