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_connection_logger.h" | 5 #include "net/quic/quic_connection_logger.h" |
6 | 6 |
7 #include "net/quic/quic_protocol.h" | 7 #include "net/quic/quic_protocol.h" |
8 #include "net/quic/test_tools/quic_test_utils.h" | 8 #include "net/quic/test_tools/quic_test_utils.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 } | 29 } |
30 }; | 30 }; |
31 | 31 |
32 class QuicConnectionLoggerTest : public ::testing::Test { | 32 class QuicConnectionLoggerTest : public ::testing::Test { |
33 protected: | 33 protected: |
34 QuicConnectionLoggerTest() | 34 QuicConnectionLoggerTest() |
35 : session_(new MockConnection(Perspective::IS_CLIENT)), | 35 : session_(new MockConnection(Perspective::IS_CLIENT)), |
36 logger_(&session_, "CONNECTION_UNKNOWN", net_log_) {} | 36 logger_(&session_, "CONNECTION_UNKNOWN", net_log_) {} |
37 | 37 |
38 BoundNetLog net_log_; | 38 BoundNetLog net_log_; |
39 MockSession session_; | 39 MockQuicSpdySession session_; |
40 QuicConnectionLogger logger_; | 40 QuicConnectionLogger logger_; |
41 }; | 41 }; |
42 | 42 |
43 TEST_F(QuicConnectionLoggerTest, TruncatedAcksSentNotChanged) { | 43 TEST_F(QuicConnectionLoggerTest, TruncatedAcksSentNotChanged) { |
44 QuicAckFrame frame; | 44 QuicAckFrame frame; |
45 logger_.OnFrameAddedToPacket(QuicFrame(&frame)); | 45 logger_.OnFrameAddedToPacket(QuicFrame(&frame)); |
46 EXPECT_EQ(0u, QuicConnectionLoggerPeer::num_truncated_acks_sent(logger_)); | 46 EXPECT_EQ(0u, QuicConnectionLoggerPeer::num_truncated_acks_sent(logger_)); |
47 | 47 |
48 for (QuicPacketSequenceNumber i = 0; i < 256; ++i) { | 48 for (QuicPacketSequenceNumber i = 0; i < 256; ++i) { |
49 frame.missing_packets.insert(i); | 49 frame.missing_packets.insert(i); |
(...skipping 13 matching lines...) Expand all Loading... |
63 | 63 |
64 TEST_F(QuicConnectionLoggerTest, ReceivedPacketLossRate) { | 64 TEST_F(QuicConnectionLoggerTest, ReceivedPacketLossRate) { |
65 QuicConnectionLoggerPeer::set_num_packets_received(logger_, 1); | 65 QuicConnectionLoggerPeer::set_num_packets_received(logger_, 1); |
66 QuicConnectionLoggerPeer::set_largest_received_packet_sequence_number(logger_, | 66 QuicConnectionLoggerPeer::set_largest_received_packet_sequence_number(logger_, |
67 2); | 67 2); |
68 EXPECT_EQ(0.5f, logger_.ReceivedPacketLossRate()); | 68 EXPECT_EQ(0.5f, logger_.ReceivedPacketLossRate()); |
69 } | 69 } |
70 | 70 |
71 } // namespace test | 71 } // namespace test |
72 } // namespace net | 72 } // namespace net |
OLD | NEW |