| 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/base/socket_performance_watcher.h" | 7 #include "net/base/socket_performance_watcher.h" |
| 8 #include "net/quic/quic_protocol.h" | 8 #include "net/quic/quic_protocol.h" |
| 9 #include "net/quic/test_tools/quic_test_utils.h" | 9 #include "net/quic/test_tools/quic_test_utils.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 class QuicConnectionLoggerTest : public ::testing::Test { | 32 class QuicConnectionLoggerTest : public ::testing::Test { |
| 33 protected: | 33 protected: |
| 34 QuicConnectionLoggerTest() | 34 QuicConnectionLoggerTest() |
| 35 : session_(new MockConnection(&helper_, Perspective::IS_CLIENT)), | 35 : session_(new MockConnection(&helper_, Perspective::IS_CLIENT)), |
| 36 logger_(&session_, | 36 logger_(&session_, |
| 37 "CONNECTION_UNKNOWN", | 37 "CONNECTION_UNKNOWN", |
| 38 /*socket_performance_watcher=*/nullptr, | 38 /*socket_performance_watcher=*/nullptr, |
| 39 net_log_) {} | 39 net_log_) {} |
| 40 | 40 |
| 41 BoundNetLog net_log_; | 41 BoundNetLog net_log_; |
| 42 MockHelper helper_; | 42 MockConnectionHelper helper_; |
| 43 MockQuicSpdySession session_; | 43 MockQuicSpdySession session_; |
| 44 QuicConnectionLogger logger_; | 44 QuicConnectionLogger logger_; |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 TEST_F(QuicConnectionLoggerTest, TruncatedAcksSentNotChanged) { | 47 TEST_F(QuicConnectionLoggerTest, TruncatedAcksSentNotChanged) { |
| 48 QuicAckFrame frame; | 48 QuicAckFrame frame; |
| 49 logger_.OnFrameAddedToPacket(QuicFrame(&frame)); | 49 logger_.OnFrameAddedToPacket(QuicFrame(&frame)); |
| 50 EXPECT_EQ(0u, QuicConnectionLoggerPeer::num_truncated_acks_sent(logger_)); | 50 EXPECT_EQ(0u, QuicConnectionLoggerPeer::num_truncated_acks_sent(logger_)); |
| 51 | 51 |
| 52 for (QuicPacketNumber i = 0; i < 256; ++i) { | 52 for (QuicPacketNumber i = 0; i < 256; ++i) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 66 } | 66 } |
| 67 | 67 |
| 68 TEST_F(QuicConnectionLoggerTest, ReceivedPacketLossRate) { | 68 TEST_F(QuicConnectionLoggerTest, ReceivedPacketLossRate) { |
| 69 QuicConnectionLoggerPeer::set_num_packets_received(logger_, 1); | 69 QuicConnectionLoggerPeer::set_num_packets_received(logger_, 1); |
| 70 QuicConnectionLoggerPeer::set_largest_received_packet_number(logger_, 2); | 70 QuicConnectionLoggerPeer::set_largest_received_packet_number(logger_, 2); |
| 71 EXPECT_EQ(0.5f, logger_.ReceivedPacketLossRate()); | 71 EXPECT_EQ(0.5f, logger_.ReceivedPacketLossRate()); |
| 72 } | 72 } |
| 73 | 73 |
| 74 } // namespace test | 74 } // namespace test |
| 75 } // namespace net | 75 } // namespace net |
| OLD | NEW |