OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "net/quic/congestion_control/rtt_stats.h" | 9 #include "net/quic/congestion_control/rtt_stats.h" |
10 #include "net/quic/congestion_control/tcp_loss_algorithm.h" | 10 #include "net/quic/congestion_control/tcp_loss_algorithm.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 unacked_packets_.RemoveRetransmittability(1); | 186 unacked_packets_.RemoveRetransmittability(1); |
187 | 187 |
188 // Early retransmit when the final packet gets acked and the first is nacked. | 188 // Early retransmit when the final packet gets acked and the first is nacked. |
189 unacked_packets_.IncreaseLargestObserved(2); | 189 unacked_packets_.IncreaseLargestObserved(2); |
190 unacked_packets_.RemoveFromInFlight(2); | 190 unacked_packets_.RemoveFromInFlight(2); |
191 unacked_packets_.NackPacket(1, 1); | 191 unacked_packets_.NackPacket(1, 1); |
192 VerifyLosses(2, nullptr, 0); | 192 VerifyLosses(2, nullptr, 0); |
193 EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout()); | 193 EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout()); |
194 } | 194 } |
195 | 195 |
| 196 TEST_F(TcpLossAlgorithmTest, AlwaysLosePacketSent1RTTEarlier) { |
| 197 // Transmit 1 packet and then wait an rtt plus 1ms. |
| 198 SendDataPacket(1); |
| 199 clock_.AdvanceTime( |
| 200 rtt_stats_.smoothed_rtt().Add(QuicTime::Delta::FromMilliseconds(1))); |
| 201 |
| 202 // Transmit 2 packets. |
| 203 SendDataPacket(2); |
| 204 SendDataPacket(3); |
| 205 |
| 206 // Wait another RTT and ack 2. |
| 207 clock_.AdvanceTime(rtt_stats_.smoothed_rtt()); |
| 208 unacked_packets_.IncreaseLargestObserved(2); |
| 209 unacked_packets_.RemoveFromInFlight(2); |
| 210 unacked_packets_.NackPacket(1, 1); |
| 211 QuicPacketSequenceNumber lost[] = {1}; |
| 212 VerifyLosses(2, lost, arraysize(lost)); |
| 213 } |
| 214 |
196 } // namespace | 215 } // namespace |
197 } // namespace test | 216 } // namespace test |
198 } // namespace net | 217 } // namespace net |
OLD | NEW |