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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 VerifyLosses(kNumSentPackets, lost3, arraysize(lost3)); | 161 VerifyLosses(kNumSentPackets, lost3, arraysize(lost3)); |
162 EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout()); | 162 EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout()); |
163 } | 163 } |
164 | 164 |
165 TEST_F(TcpLossAlgorithmTest, DontEarlyRetransmitNeuteredPacket) { | 165 TEST_F(TcpLossAlgorithmTest, DontEarlyRetransmitNeuteredPacket) { |
166 const size_t kNumSentPackets = 2; | 166 const size_t kNumSentPackets = 2; |
167 // Transmit 2 packets. | 167 // Transmit 2 packets. |
168 for (size_t i = 1; i <= kNumSentPackets; ++i) { | 168 for (size_t i = 1; i <= kNumSentPackets; ++i) { |
169 SendDataPacket(i); | 169 SendDataPacket(i); |
170 } | 170 } |
| 171 // Neuter packet 1. |
| 172 unacked_packets_.RemoveRetransmittability(1); |
| 173 |
171 // Early retransmit when the final packet gets acked and the first is nacked. | 174 // Early retransmit when the final packet gets acked and the first is nacked. |
| 175 unacked_packets_.IncreaseLargestObserved(2); |
172 unacked_packets_.SetNotPending(2); | 176 unacked_packets_.SetNotPending(2); |
173 unacked_packets_.NackPacket(1, 1); | 177 unacked_packets_.NackPacket(1, 1); |
174 unacked_packets_.RemoveRetransmittability(1, 1); | |
175 VerifyLosses(2, NULL, 0); | 178 VerifyLosses(2, NULL, 0); |
176 EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout()); | 179 EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout()); |
177 } | 180 } |
178 | 181 |
179 } // namespace test | 182 } // namespace test |
180 } // namespace net | 183 } // namespace net |
OLD | NEW |