| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 VerifyRetransmittablePackets(nullptr, 0); | 131 VerifyRetransmittablePackets(nullptr, 0); |
| 132 | 132 |
| 133 unacked_packets_.IncreaseLargestObserved(1); | 133 unacked_packets_.IncreaseLargestObserved(1); |
| 134 VerifyUnackedPackets(nullptr, 0); | 134 VerifyUnackedPackets(nullptr, 0); |
| 135 VerifyInFlightPackets(nullptr, 0); | 135 VerifyInFlightPackets(nullptr, 0); |
| 136 VerifyRetransmittablePackets(nullptr, 0); | 136 VerifyRetransmittablePackets(nullptr, 0); |
| 137 } | 137 } |
| 138 | 138 |
| 139 TEST_F(QuicUnackedPacketMapTest, DiscardOldRttOnly) { | 139 TEST_F(QuicUnackedPacketMapTest, DiscardOldRttOnly) { |
| 140 // Acks are only tracked for RTT measurement purposes, and are discarded | 140 // Acks are only tracked for RTT measurement purposes, and are discarded |
| 141 // when more than 2500 accumulate. | 141 // when more than 200 accumulate. |
| 142 const size_t kNumUnackedPackets = 2500; | 142 const size_t kNumUnackedPackets = 200; |
| 143 for (size_t i = 1; i < 3000; ++i) { | 143 for (size_t i = 1; i < 400; ++i) { |
| 144 unacked_packets_.AddSentPacket(CreateNonRetransmittablePacket(i), 0, | 144 unacked_packets_.AddSentPacket(CreateNonRetransmittablePacket(i), 0, |
| 145 NOT_RETRANSMISSION, now_, kDefaultAckLength, | 145 NOT_RETRANSMISSION, now_, kDefaultAckLength, |
| 146 false); | 146 false); |
| 147 unacked_packets_.RemoveObsoletePackets(); | 147 unacked_packets_.RemoveObsoletePackets(); |
| 148 EXPECT_EQ(min(i, kNumUnackedPackets), | 148 EXPECT_EQ(min(i, kNumUnackedPackets), |
| 149 unacked_packets_.GetNumUnackedPacketsDebugOnly()); | 149 unacked_packets_.GetNumUnackedPacketsDebugOnly()); |
| 150 } | 150 } |
| 151 } | 151 } |
| 152 | 152 |
| 153 TEST_F(QuicUnackedPacketMapTest, RetransmittableInflightAndRtt) { | 153 TEST_F(QuicUnackedPacketMapTest, RetransmittableInflightAndRtt) { |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 EXPECT_TRUE(unacked_packets_.IsUnacked(3)); | 437 EXPECT_TRUE(unacked_packets_.IsUnacked(3)); |
| 438 EXPECT_FALSE(unacked_packets_.IsUnacked(4)); | 438 EXPECT_FALSE(unacked_packets_.IsUnacked(4)); |
| 439 EXPECT_TRUE(unacked_packets_.IsUnacked(5)); | 439 EXPECT_TRUE(unacked_packets_.IsUnacked(5)); |
| 440 EXPECT_EQ(5u, unacked_packets_.largest_sent_packet()); | 440 EXPECT_EQ(5u, unacked_packets_.largest_sent_packet()); |
| 441 } | 441 } |
| 442 | 442 |
| 443 | 443 |
| 444 } // namespace | 444 } // namespace |
| 445 } // namespace test | 445 } // namespace test |
| 446 } // namespace net | 446 } // namespace net |
| OLD | NEW |