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

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

Issue 670533004: Fixes two div by zero bugs in QUIC's BBR pacing code that caused server (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Simplify_QuicUnackedPacketMap_77986449
Patch Set: Created 6 years, 2 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_server_session.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_sent_packet_manager.h" 5 #include "net/quic/quic_sent_packet_manager.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "net/quic/quic_flags.h" 8 #include "net/quic/quic_flags.h"
9 #include "net/quic/test_tools/quic_config_peer.h" 9 #include "net/quic/test_tools/quic_config_peer.h"
10 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" 10 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h"
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); 1029 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow());
1030 VerifyUnackedPackets(nullptr, 0); 1030 VerifyUnackedPackets(nullptr, 0);
1031 VerifyRetransmittablePackets(nullptr, 0); 1031 VerifyRetransmittablePackets(nullptr, 0);
1032 } 1032 }
1033 1033
1034 TEST_F(QuicSentPacketManagerTest, ResetRecentMinRTTWithEmptyWindow) { 1034 TEST_F(QuicSentPacketManagerTest, ResetRecentMinRTTWithEmptyWindow) {
1035 QuicTime::Delta min_rtt = QuicTime::Delta::FromMilliseconds(50); 1035 QuicTime::Delta min_rtt = QuicTime::Delta::FromMilliseconds(50);
1036 QuicSentPacketManagerPeer::GetRttStats(&manager_)->UpdateRtt( 1036 QuicSentPacketManagerPeer::GetRttStats(&manager_)->UpdateRtt(
1037 min_rtt, QuicTime::Delta::Zero(), QuicTime::Zero()); 1037 min_rtt, QuicTime::Delta::Zero(), QuicTime::Zero());
1038 EXPECT_EQ(min_rtt, 1038 EXPECT_EQ(min_rtt,
1039 QuicSentPacketManagerPeer::GetRttStats(&manager_)->min_rtt()); 1039 QuicSentPacketManagerPeer::GetRttStats(&manager_)->MinRtt());
1040 EXPECT_EQ(min_rtt, 1040 EXPECT_EQ(min_rtt,
1041 QuicSentPacketManagerPeer::GetRttStats( 1041 QuicSentPacketManagerPeer::GetRttStats(
1042 &manager_)->recent_min_rtt()); 1042 &manager_)->recent_min_rtt());
1043 1043
1044 // Send two packets with no prior bytes in flight. 1044 // Send two packets with no prior bytes in flight.
1045 SendDataPacket(1); 1045 SendDataPacket(1);
1046 SendDataPacket(2); 1046 SendDataPacket(2);
1047 1047
1048 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(100)); 1048 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(100));
1049 // Ack two packets with 100ms RTT observations. 1049 // Ack two packets with 100ms RTT observations.
1050 QuicAckFrame ack_frame; 1050 QuicAckFrame ack_frame;
1051 ack_frame.delta_time_largest_observed = QuicTime::Delta::Zero(); 1051 ack_frame.delta_time_largest_observed = QuicTime::Delta::Zero();
1052 ack_frame.largest_observed = 1; 1052 ack_frame.largest_observed = 1;
1053 ExpectAck(1); 1053 ExpectAck(1);
1054 manager_.OnIncomingAck(ack_frame, clock_.Now()); 1054 manager_.OnIncomingAck(ack_frame, clock_.Now());
1055 1055
1056 // First ack does not change recent min rtt. 1056 // First ack does not change recent min rtt.
1057 EXPECT_EQ(min_rtt, 1057 EXPECT_EQ(min_rtt,
1058 QuicSentPacketManagerPeer::GetRttStats( 1058 QuicSentPacketManagerPeer::GetRttStats(
1059 &manager_)->recent_min_rtt()); 1059 &manager_)->recent_min_rtt());
1060 1060
1061 ack_frame.largest_observed = 2; 1061 ack_frame.largest_observed = 2;
1062 ExpectAck(2); 1062 ExpectAck(2);
1063 manager_.OnIncomingAck(ack_frame, clock_.Now()); 1063 manager_.OnIncomingAck(ack_frame, clock_.Now());
1064 1064
1065 EXPECT_EQ(min_rtt, 1065 EXPECT_EQ(min_rtt,
1066 QuicSentPacketManagerPeer::GetRttStats(&manager_)->min_rtt()); 1066 QuicSentPacketManagerPeer::GetRttStats(&manager_)->MinRtt());
1067 EXPECT_EQ(QuicTime::Delta::FromMilliseconds(100), 1067 EXPECT_EQ(QuicTime::Delta::FromMilliseconds(100),
1068 QuicSentPacketManagerPeer::GetRttStats( 1068 QuicSentPacketManagerPeer::GetRttStats(
1069 &manager_)->recent_min_rtt()); 1069 &manager_)->recent_min_rtt());
1070 } 1070 }
1071 1071
1072 TEST_F(QuicSentPacketManagerTest, RetransmissionTimeout) { 1072 TEST_F(QuicSentPacketManagerTest, RetransmissionTimeout) {
1073 // Send 100 packets and then ensure all are abandoned when the RTO fires. 1073 // Send 100 packets and then ensure all are abandoned when the RTO fires.
1074 const size_t kNumSentPackets = 100; 1074 const size_t kNumSentPackets = 100;
1075 for (size_t i = 1; i <= kNumSentPackets; ++i) { 1075 for (size_t i = 1; i <= kNumSentPackets; ++i) {
1076 SendDataPacket(i); 1076 SendDataPacket(i);
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
1381 .WillOnce(Return(100 * kDefaultTCPMSS)); 1381 .WillOnce(Return(100 * kDefaultTCPMSS));
1382 manager_.SetFromConfig(config); 1382 manager_.SetFromConfig(config);
1383 1383
1384 EXPECT_EQ(initial_rtt_us, 1384 EXPECT_EQ(initial_rtt_us,
1385 manager_.GetRttStats()->SmoothedRtt().ToMicroseconds()); 1385 manager_.GetRttStats()->SmoothedRtt().ToMicroseconds());
1386 } 1386 }
1387 1387
1388 } // namespace 1388 } // namespace
1389 } // namespace test 1389 } // namespace test
1390 } // namespace net 1390 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_connection.cc ('k') | net/quic/quic_server_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698