Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Side by Side Diff: net/quic/quic_connection_logger_unittest.cc

Issue 1908103002: Landing Recent QUIC changes until 4/15/2016 17:20 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/quic_connection.cc ('k') | net/quic/quic_connection_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 14 matching lines...) Expand all
25 25
26 static void set_largest_received_packet_number(QuicConnectionLogger& logger, 26 static void set_largest_received_packet_number(QuicConnectionLogger& logger,
27 int value) { 27 int value) {
28 logger.largest_received_packet_number_ = value; 28 logger.largest_received_packet_number_ = value;
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(&helper_, Perspective::IS_CLIENT)), 35 : session_(new MockConnection(&helper_,
36 &alarm_factory_,
37 Perspective::IS_CLIENT)),
36 logger_(&session_, 38 logger_(&session_,
37 "CONNECTION_UNKNOWN", 39 "CONNECTION_UNKNOWN",
38 /*socket_performance_watcher=*/nullptr, 40 /*socket_performance_watcher=*/nullptr,
39 net_log_) {} 41 net_log_) {}
40 42
41 BoundNetLog net_log_; 43 BoundNetLog net_log_;
42 MockConnectionHelper helper_; 44 MockConnectionHelper helper_;
45 MockAlarmFactory alarm_factory_;
43 MockQuicSpdySession session_; 46 MockQuicSpdySession session_;
44 QuicConnectionLogger logger_; 47 QuicConnectionLogger logger_;
45 }; 48 };
46 49
47 TEST_F(QuicConnectionLoggerTest, TruncatedAcksSentNotChanged) { 50 TEST_F(QuicConnectionLoggerTest, TruncatedAcksSentNotChanged) {
48 QuicAckFrame frame; 51 QuicAckFrame frame;
49 logger_.OnFrameAddedToPacket(QuicFrame(&frame)); 52 logger_.OnFrameAddedToPacket(QuicFrame(&frame));
50 EXPECT_EQ(0u, QuicConnectionLoggerPeer::num_truncated_acks_sent(logger_)); 53 EXPECT_EQ(0u, QuicConnectionLoggerPeer::num_truncated_acks_sent(logger_));
51 54
52 for (QuicPacketNumber i = 0; i < 256; ++i) { 55 for (QuicPacketNumber i = 0; i < 256; ++i) {
(...skipping 13 matching lines...) Expand all
66 } 69 }
67 70
68 TEST_F(QuicConnectionLoggerTest, ReceivedPacketLossRate) { 71 TEST_F(QuicConnectionLoggerTest, ReceivedPacketLossRate) {
69 QuicConnectionLoggerPeer::set_num_packets_received(logger_, 1); 72 QuicConnectionLoggerPeer::set_num_packets_received(logger_, 1);
70 QuicConnectionLoggerPeer::set_largest_received_packet_number(logger_, 2); 73 QuicConnectionLoggerPeer::set_largest_received_packet_number(logger_, 2);
71 EXPECT_EQ(0.5f, logger_.ReceivedPacketLossRate()); 74 EXPECT_EQ(0.5f, logger_.ReceivedPacketLossRate());
72 } 75 }
73 76
74 } // namespace test 77 } // namespace test
75 } // namespace net 78 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_connection.cc ('k') | net/quic/quic_connection_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698