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

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

Issue 1305293004: Notfiy NQE of QUIC RTT (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed a test Created 5 years, 3 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_logger.cc ('k') | net/quic/quic_http_stream_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/quic/quic_protocol.h" 8 #include "net/quic/quic_protocol.h"
8 #include "net/quic/test_tools/quic_test_utils.h" 9 #include "net/quic/test_tools/quic_test_utils.h"
9 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
10 11
11 namespace net { 12 namespace net {
12 namespace test { 13 namespace test {
13 14
14 class QuicConnectionLoggerPeer { 15 class QuicConnectionLoggerPeer {
15 public: 16 public:
16 static size_t num_truncated_acks_sent(const QuicConnectionLogger& logger) { 17 static size_t num_truncated_acks_sent(const QuicConnectionLogger& logger) {
17 return logger.num_truncated_acks_sent_; 18 return logger.num_truncated_acks_sent_;
18 } 19 }
19 20
20 static void set_num_packets_received(QuicConnectionLogger& logger, 21 static void set_num_packets_received(QuicConnectionLogger& logger,
21 int value) { 22 int value) {
22 logger.num_packets_received_ = value; 23 logger.num_packets_received_ = value;
23 } 24 }
24 25
25 static void set_largest_received_packet_number(QuicConnectionLogger& logger, 26 static void set_largest_received_packet_number(QuicConnectionLogger& logger,
26 int value) { 27 int value) {
27 logger.largest_received_packet_number_ = value; 28 logger.largest_received_packet_number_ = value;
28 } 29 }
29 }; 30 };
30 31
31 class QuicConnectionLoggerTest : public ::testing::Test { 32 class QuicConnectionLoggerTest : public ::testing::Test {
32 protected: 33 protected:
33 QuicConnectionLoggerTest() 34 QuicConnectionLoggerTest()
34 : session_(new MockConnection(Perspective::IS_CLIENT)), 35 : session_(new MockConnection(Perspective::IS_CLIENT)),
35 logger_(&session_, "CONNECTION_UNKNOWN", net_log_) {} 36 logger_(&session_,
37 "CONNECTION_UNKNOWN",
38 /*socket_performance_watcher=*/nullptr,
39 net_log_) {}
36 40
37 BoundNetLog net_log_; 41 BoundNetLog net_log_;
38 MockQuicSpdySession session_; 42 MockQuicSpdySession session_;
39 QuicConnectionLogger logger_; 43 QuicConnectionLogger logger_;
40 }; 44 };
41 45
42 TEST_F(QuicConnectionLoggerTest, TruncatedAcksSentNotChanged) { 46 TEST_F(QuicConnectionLoggerTest, TruncatedAcksSentNotChanged) {
43 QuicAckFrame frame; 47 QuicAckFrame frame;
44 logger_.OnFrameAddedToPacket(QuicFrame(&frame)); 48 logger_.OnFrameAddedToPacket(QuicFrame(&frame));
45 EXPECT_EQ(0u, QuicConnectionLoggerPeer::num_truncated_acks_sent(logger_)); 49 EXPECT_EQ(0u, QuicConnectionLoggerPeer::num_truncated_acks_sent(logger_));
(...skipping 15 matching lines...) Expand all
61 } 65 }
62 66
63 TEST_F(QuicConnectionLoggerTest, ReceivedPacketLossRate) { 67 TEST_F(QuicConnectionLoggerTest, ReceivedPacketLossRate) {
64 QuicConnectionLoggerPeer::set_num_packets_received(logger_, 1); 68 QuicConnectionLoggerPeer::set_num_packets_received(logger_, 1);
65 QuicConnectionLoggerPeer::set_largest_received_packet_number(logger_, 2); 69 QuicConnectionLoggerPeer::set_largest_received_packet_number(logger_, 2);
66 EXPECT_EQ(0.5f, logger_.ReceivedPacketLossRate()); 70 EXPECT_EQ(0.5f, logger_.ReceivedPacketLossRate());
67 } 71 }
68 72
69 } // namespace test 73 } // namespace test
70 } // namespace net 74 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_connection_logger.cc ('k') | net/quic/quic_http_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698