| Index: net/quic/quic_connection_test.cc
|
| diff --git a/net/quic/quic_connection_test.cc b/net/quic/quic_connection_test.cc
|
| index b70d2c0d0fbb06264148e8ceeab47c7f8cbc2b6b..05aeeeb74e5572b547dd670655de531c83e28ee4 100644
|
| --- a/net/quic/quic_connection_test.cc
|
| +++ b/net/quic/quic_connection_test.cc
|
| @@ -472,11 +472,6 @@ class TestConnection : public QuicConnection {
|
| QuicConnectionPeer::GetRetransmissionAlarm(this));
|
| }
|
|
|
| - TestConnectionHelper::TestAlarm* GetAbandonFecAlarm() {
|
| - return reinterpret_cast<TestConnectionHelper::TestAlarm*>(
|
| - QuicConnectionPeer::GetAbandonFecAlarm(this));
|
| - }
|
| -
|
| TestConnectionHelper::TestAlarm* GetSendAlarm() {
|
| return reinterpret_cast<TestConnectionHelper::TestAlarm*>(
|
| QuicConnectionPeer::GetSendAlarm(this));
|
| @@ -1299,10 +1294,12 @@ TEST_F(QuicConnectionTest, AbandonFECFromCongestionWindow) {
|
| QuicTime::Delta::FromMilliseconds(5000);
|
| clock_.AdvanceTime(retransmission_time);
|
|
|
| - // Abandon FEC packet.
|
| - EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(_, _)).Times(1);
|
| + // Abandon FEC packet and data packet.
|
| + EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(_, _)).Times(2);
|
| + EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout());
|
| + EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1);
|
| EXPECT_CALL(visitor_, OnCanWrite());
|
| - connection_.OnAbandonFecTimeout();
|
| + connection_.OnRetransmissionTimeout();
|
| }
|
|
|
| TEST_F(QuicConnectionTest, DontAbandonAckedFEC) {
|
| @@ -1333,8 +1330,53 @@ TEST_F(QuicConnectionTest, DontAbandonAckedFEC) {
|
|
|
| // Don't abandon the acked FEC packet, but it will abandon 2 the subsequent
|
| // FEC packets.
|
| - EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(_, _)).Times(2);
|
| - connection_.GetAbandonFecAlarm()->Fire();
|
| + EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(_, _)).Times(5);
|
| + EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout());
|
| + EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(3);
|
| + connection_.GetRetransmissionAlarm()->Fire();
|
| +}
|
| +
|
| +TEST_F(QuicConnectionTest, DontAbandonAllFEC) {
|
| + EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
|
| + connection_.options()->max_packets_per_fec_group = 1;
|
| +
|
| + // 1 Data and 1 FEC packet.
|
| + EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(6);
|
| + connection_.SendStreamDataWithString(1, "foo", 0, !kFin, NULL);
|
| + // Send some more data afterwards to ensure early retransmit doesn't trigger.
|
| + connection_.SendStreamDataWithString(1, "foo", 3, !kFin, NULL);
|
| + // Advance the time so not all the FEC packets are abandoned.
|
| + clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(1));
|
| + connection_.SendStreamDataWithString(1, "foo", 6, !kFin, NULL);
|
| +
|
| + QuicAckFrame ack_fec(5, QuicTime::Zero(), 1);
|
| + // Ack all data packets, but no fec packets.
|
| + ack_fec.received_info.missing_packets.insert(2);
|
| + ack_fec.received_info.missing_packets.insert(4);
|
| + ack_fec.received_info.entropy_hash =
|
| + QuicConnectionPeer::GetSentEntropyHash(&connection_, 5) ^
|
| + QuicConnectionPeer::GetSentEntropyHash(&connection_, 4) ^
|
| + QuicConnectionPeer::GetSentEntropyHash(&connection_, 3) ^
|
| + QuicConnectionPeer::GetSentEntropyHash(&connection_, 2) ^
|
| + QuicConnectionPeer::GetSentEntropyHash(&connection_, 1);
|
| +
|
| + // Lose the first FEC packet and ack the three data packets.
|
| + EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _, _)).Times(3);
|
| + EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(2, _));
|
| + EXPECT_CALL(*send_algorithm_, OnPacketLost(2, _));
|
| + ProcessAckPacket(&ack_fec);
|
| +
|
| + clock_.AdvanceTime(DefaultRetransmissionTime().Subtract(
|
| + QuicTime::Delta::FromMilliseconds(1)));
|
| +
|
| + // Don't abandon the acked FEC packet, but it will abandon 1 of the subsequent
|
| + // FEC packets.
|
| + EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(4, _));
|
| + connection_.GetRetransmissionAlarm()->Fire();
|
| +
|
| + // Ensure the connection's alarm is still set, in order to abandon the third
|
| + // FEC packet.
|
| + EXPECT_TRUE(connection_.GetRetransmissionAlarm()->IsSet());
|
| }
|
|
|
| TEST_F(QuicConnectionTest, FramePacking) {
|
|
|