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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 VerifyRetransmittablePackets(nullptr, 0); | 119 VerifyRetransmittablePackets(nullptr, 0); |
120 | 120 |
121 unacked_packets_.IncreaseLargestObserved(1); | 121 unacked_packets_.IncreaseLargestObserved(1); |
122 VerifyUnackedPackets(nullptr, 0); | 122 VerifyUnackedPackets(nullptr, 0); |
123 VerifyInFlightPackets(nullptr, 0); | 123 VerifyInFlightPackets(nullptr, 0); |
124 VerifyRetransmittablePackets(nullptr, 0); | 124 VerifyRetransmittablePackets(nullptr, 0); |
125 } | 125 } |
126 | 126 |
127 TEST_F(QuicUnackedPacketMapTest, DiscardOldRttOnly) { | 127 TEST_F(QuicUnackedPacketMapTest, DiscardOldRttOnly) { |
128 // Acks are only tracked for RTT measurement purposes, and are discarded | 128 // Acks are only tracked for RTT measurement purposes, and are discarded |
129 // when more than 200 accumulate. | 129 // when more than 2500 accumulate. |
130 const size_t kNumUnackedPackets = 200; | 130 const size_t kNumUnackedPackets = 2500; |
131 for (size_t i = 1; i < 400; ++i) { | 131 for (size_t i = 1; i < 3000; ++i) { |
132 unacked_packets_.AddSentPacket(CreateNonRetransmittablePacket(i), 0, | 132 unacked_packets_.AddSentPacket(CreateNonRetransmittablePacket(i), 0, |
133 NOT_RETRANSMISSION, now_, kDefaultAckLength, | 133 NOT_RETRANSMISSION, now_, kDefaultAckLength, |
134 false); | 134 false); |
135 unacked_packets_.RemoveObsoletePackets(); | 135 unacked_packets_.RemoveObsoletePackets(); |
136 EXPECT_EQ(min(i, kNumUnackedPackets), | 136 EXPECT_EQ(min(i, kNumUnackedPackets), |
137 unacked_packets_.GetNumUnackedPacketsDebugOnly()); | 137 unacked_packets_.GetNumUnackedPacketsDebugOnly()); |
138 } | 138 } |
139 } | 139 } |
140 | 140 |
141 TEST_F(QuicUnackedPacketMapTest, RetransmittableInflightAndRtt) { | 141 TEST_F(QuicUnackedPacketMapTest, RetransmittableInflightAndRtt) { |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 EXPECT_TRUE(unacked_packets_.IsUnacked(3)); | 367 EXPECT_TRUE(unacked_packets_.IsUnacked(3)); |
368 EXPECT_FALSE(unacked_packets_.IsUnacked(4)); | 368 EXPECT_FALSE(unacked_packets_.IsUnacked(4)); |
369 EXPECT_TRUE(unacked_packets_.IsUnacked(5)); | 369 EXPECT_TRUE(unacked_packets_.IsUnacked(5)); |
370 EXPECT_EQ(5u, unacked_packets_.largest_sent_packet()); | 370 EXPECT_EQ(5u, unacked_packets_.largest_sent_packet()); |
371 } | 371 } |
372 | 372 |
373 | 373 |
374 } // namespace | 374 } // namespace |
375 } // namespace test | 375 } // namespace test |
376 } // namespace net | 376 } // namespace net |
OLD | NEW |