Index: net/quic/quic_unacked_packet_map_test.cc |
diff --git a/net/quic/quic_unacked_packet_map_test.cc b/net/quic/quic_unacked_packet_map_test.cc |
index 0a7bb2b490ea43801f7997e3fe187050becbbf5f..9c4a6a32888dc547dd12a448d4d21943b102cb58 100644 |
--- a/net/quic/quic_unacked_packet_map_test.cc |
+++ b/net/quic/quic_unacked_packet_map_test.cc |
@@ -7,6 +7,8 @@ |
#include "net/quic/test_tools/quic_test_utils.h" |
#include "testing/gtest/include/gtest/gtest.h" |
+using std::min; |
+ |
namespace net { |
namespace test { |
namespace { |
@@ -113,6 +115,18 @@ TEST_F(QuicUnackedPacketMapTest, RttOnly) { |
VerifyRetransmittablePackets(NULL, 0); |
} |
+TEST_F(QuicUnackedPacketMapTest, DiscardOldRttOnly) { |
+ // Acks are only tracked for RTT measurement purposes, and are discarded |
+ // when more than 200 accumulate. |
+ for (int i = 1; i < 400; ++i) { |
+ unacked_packets_.AddPacket(CreateNonRetransmittablePacket(i)); |
+ unacked_packets_.SetSent(i, now_, kDefaultAckLength, false); |
+ unacked_packets_.RemoveObsoletePackets(); |
+ EXPECT_EQ(static_cast<size_t>(min(i, 200)), |
+ unacked_packets_.GetNumUnackedPacketsDebugOnly()); |
+ } |
+} |
+ |
TEST_F(QuicUnackedPacketMapTest, RetransmittableInflightAndRtt) { |
// Simulate a retransmittable packet being sent and acked. |
unacked_packets_.AddPacket(CreateRetransmittablePacket(1)); |