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

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

Issue 868813003: Fix a bug in QUIC's RTO. Flag protected by FLAGS_quic_use_new_rto. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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_sent_packet_manager.cc ('k') | no next file » | 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 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 } 1120 }
1121 RetransmitNextPacket(101); 1121 RetransmitNextPacket(101);
1122 RetransmitNextPacket(102); 1122 RetransmitNextPacket(102);
1123 if (FLAGS_quic_use_new_rto) { 1123 if (FLAGS_quic_use_new_rto) {
1124 EXPECT_FALSE(manager_.HasPendingRetransmissions()); 1124 EXPECT_FALSE(manager_.HasPendingRetransmissions());
1125 } else { 1125 } else {
1126 EXPECT_TRUE(manager_.HasPendingRetransmissions()); 1126 EXPECT_TRUE(manager_.HasPendingRetransmissions());
1127 } 1127 }
1128 1128
1129 // Ack a retransmission. 1129 // Ack a retransmission.
1130 if (FLAGS_quic_use_new_rto) {
1131 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true));
1132 }
1133 QuicAckFrame ack_frame; 1130 QuicAckFrame ack_frame;
1134 ack_frame.delta_time_largest_observed = QuicTime::Delta::Zero(); 1131 ack_frame.delta_time_largest_observed = QuicTime::Delta::Zero();
1135 ack_frame.largest_observed = 102; 1132 ack_frame.largest_observed = 102;
1136 for (int i = 0; i < 102; ++i) { 1133 for (int i = 0; i < 102; ++i) {
1137 ack_frame.missing_packets.insert(i); 1134 ack_frame.missing_packets.insert(i);
1138 } 1135 }
1136 // Ensure no packets are lost.
1139 EXPECT_CALL(*send_algorithm_, 1137 EXPECT_CALL(*send_algorithm_,
1140 OnCongestionEvent(true, _, ElementsAre(Pair(102, _)), _)); 1138 OnCongestionEvent(true, _, ElementsAre(Pair(102, _)),
1139 IsEmpty()) /*lost_packets=*/);
1141 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 1140 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
1142 EXPECT_CALL(*network_change_visitor_, OnRttChange()); 1141 EXPECT_CALL(*network_change_visitor_, OnRttChange());
1142 if (FLAGS_quic_use_new_rto) {
1143 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true));
1144 }
1143 manager_.OnIncomingAck(ack_frame, clock_.Now()); 1145 manager_.OnIncomingAck(ack_frame, clock_.Now());
1144 } 1146 }
1145 1147
1146 TEST_F(QuicSentPacketManagerTest, TwoRetransmissionTimeoutsAckSecond) { 1148 TEST_F(QuicSentPacketManagerTest, TwoRetransmissionTimeoutsAckSecond) {
1147 // Send 1 packet. 1149 // Send 1 packet.
1148 SendDataPacket(1); 1150 SendDataPacket(1);
1149 1151
1150 if (!FLAGS_quic_use_new_rto) { 1152 if (!FLAGS_quic_use_new_rto) {
1151 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true)); 1153 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true));
1152 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 1154 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
1717 1719
1718 EXPECT_CALL(*send_algorithm_, ResumeConnectionState(_)); 1720 EXPECT_CALL(*send_algorithm_, ResumeConnectionState(_));
1719 manager_.ResumeConnectionState(cached_network_params); 1721 manager_.ResumeConnectionState(cached_network_params);
1720 EXPECT_EQ(kRttMs * kNumMicrosPerMilli, 1722 EXPECT_EQ(kRttMs * kNumMicrosPerMilli,
1721 static_cast<uint64>(manager_.GetRttStats()->initial_rtt_us())); 1723 static_cast<uint64>(manager_.GetRttStats()->initial_rtt_us()));
1722 } 1724 }
1723 1725
1724 } // namespace 1726 } // namespace
1725 } // namespace test 1727 } // namespace test
1726 } // namespace net 1728 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_sent_packet_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698