We started redesigning GpuMemoryBuffer interface to handle multiple buffers [0].
[chromium-blink-merge.git] / net / quic / quic_connection_logger_unittest.cc
blobab6d95051847632b3bdedacf9e8f05f26523528f
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 "net/quic/test_tools/quic_test_utils.h"
9 #include "testing/gtest/include/gtest/gtest.h"
11 namespace net {
12 namespace test {
14 class QuicConnectionLoggerPeer {
15 public:
16 static size_t num_truncated_acks_sent(const QuicConnectionLogger& logger) {
17 return logger.num_truncated_acks_sent_;
21 class QuicConnectionLoggerTest : public ::testing::Test {
22 protected:
23 QuicConnectionLoggerTest()
24 : session_(new MockConnection(Perspective::IS_CLIENT)),
25 logger_(&session_, "CONNECTION_UNKNOWN", net_log_) {}
27 BoundNetLog net_log_;
28 MockSession session_;
29 QuicConnectionLogger logger_;
32 TEST_F(QuicConnectionLoggerTest, TruncatedAcksSentNotChanged) {
33 QuicAckFrame frame;
34 logger_.OnFrameAddedToPacket(QuicFrame(&frame));
35 EXPECT_EQ(0u, QuicConnectionLoggerPeer::num_truncated_acks_sent(logger_));
37 for (QuicPacketSequenceNumber i = 0; i < 256; ++i) {
38 frame.missing_packets.insert(i);
40 logger_.OnFrameAddedToPacket(QuicFrame(&frame));
41 EXPECT_EQ(0u, QuicConnectionLoggerPeer::num_truncated_acks_sent(logger_));
44 TEST_F(QuicConnectionLoggerTest, TruncatedAcksSent) {
45 QuicAckFrame frame;
46 for (QuicPacketSequenceNumber i = 0; i < 512; i += 2) {
47 frame.missing_packets.insert(i);
49 logger_.OnFrameAddedToPacket(QuicFrame(&frame));
50 EXPECT_EQ(1u, QuicConnectionLoggerPeer::num_truncated_acks_sent(logger_));
53 } // namespace test
54 } // namespace net