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 "net/quic/quic_unacked_packet_map.h" | 5 #include "net/quic/quic_unacked_packet_map.h" |
6 | 6 |
7 #include "net/quic/test_tools/quic_test_utils.h" | 7 #include "net/quic/test_tools/quic_test_utils.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 using std::min; | 10 using std::min; |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 EXPECT_EQ(kDefaultLength, unacked_packets_.bytes_in_flight()); | 280 EXPECT_EQ(kDefaultLength, unacked_packets_.bytes_in_flight()); |
281 | 281 |
282 // Simulate an F-RTO, and restore 1 to flight. | 282 // Simulate an F-RTO, and restore 1 to flight. |
283 unacked_packets_.RestoreInFlight(1); | 283 unacked_packets_.RestoreInFlight(1); |
284 VerifyUnackedPackets(unacked, arraysize(unacked)); | 284 VerifyUnackedPackets(unacked, arraysize(unacked)); |
285 VerifyInFlightPackets(unacked, arraysize(unacked)); | 285 VerifyInFlightPackets(unacked, arraysize(unacked)); |
286 VerifyRetransmittablePackets(retransmittable, arraysize(retransmittable)); | 286 VerifyRetransmittablePackets(retransmittable, arraysize(retransmittable)); |
287 EXPECT_EQ(2 * kDefaultLength, unacked_packets_.bytes_in_flight()); | 287 EXPECT_EQ(2 * kDefaultLength, unacked_packets_.bytes_in_flight()); |
288 } | 288 } |
289 | 289 |
| 290 TEST_F(QuicUnackedPacketMapTest, SendWithGap) { |
| 291 // Simulate a retransmittable packet being sent, retransmitted, and the first |
| 292 // transmission being acked. |
| 293 unacked_packets_.AddPacket(CreateRetransmittablePacket(1)); |
| 294 unacked_packets_.SetSent(1, now_, kDefaultLength, true); |
| 295 unacked_packets_.AddPacket(CreateRetransmittablePacket(3)); |
| 296 unacked_packets_.SetSent(3, now_, kDefaultLength, true); |
| 297 unacked_packets_.OnRetransmittedPacket(1, 5, LOSS_RETRANSMISSION); |
| 298 unacked_packets_.SetSent(5, now_, kDefaultLength, true); |
| 299 |
| 300 EXPECT_EQ(1u, unacked_packets_.GetLeastUnacked()); |
| 301 EXPECT_TRUE(unacked_packets_.IsUnacked(1)); |
| 302 EXPECT_FALSE(unacked_packets_.IsUnacked(2)); |
| 303 EXPECT_TRUE(unacked_packets_.IsUnacked(3)); |
| 304 EXPECT_FALSE(unacked_packets_.IsUnacked(4)); |
| 305 EXPECT_TRUE(unacked_packets_.IsUnacked(5)); |
| 306 EXPECT_EQ(5u, unacked_packets_.largest_sent_packet()); |
| 307 } |
| 308 |
| 309 |
290 } // namespace | 310 } // namespace |
291 } // namespace test | 311 } // namespace test |
292 } // namespace net | 312 } // namespace net |
OLD | NEW |