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
3 // found in the LICENSE file.
5 #include "net/quic/quic_connection_logger.h"
7 #include "net/quic/quic_protocol.h"
8 #include "testing/gtest/include/gtest/gtest.h"
13 class QuicConnectionLoggerPeer
{
15 static size_t num_truncated_acks_sent(const QuicConnectionLogger
& logger
) {
16 return logger
.num_truncated_acks_sent_
;
20 class QuicConnectionLoggerTest
: public ::testing::Test
{
22 QuicConnectionLoggerTest() : logger_(net_log_
) {}
25 QuicConnectionLogger logger_
;
28 TEST_F(QuicConnectionLoggerTest
, TruncatedAcksSentNotChanged
) {
30 logger_
.OnFrameAddedToPacket(QuicFrame(&frame
));
31 EXPECT_EQ(0u, QuicConnectionLoggerPeer::num_truncated_acks_sent(logger_
));
33 for (QuicPacketSequenceNumber i
= 0; i
< 256; ++i
) {
34 frame
.missing_packets
.insert(i
);
36 logger_
.OnFrameAddedToPacket(QuicFrame(&frame
));
37 EXPECT_EQ(0u, QuicConnectionLoggerPeer::num_truncated_acks_sent(logger_
));
40 TEST_F(QuicConnectionLoggerTest
, TruncatedAcksSent
) {
42 for (QuicPacketSequenceNumber i
= 0; i
< 512; i
+= 2) {
43 frame
.missing_packets
.insert(i
);
45 logger_
.OnFrameAddedToPacket(QuicFrame(&frame
));
46 EXPECT_EQ(1u, QuicConnectionLoggerPeer::num_truncated_acks_sent(logger_
));