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

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

Issue 286143007: Update QuicSentPacketManager to sample a new recent min rtt within the (Closed) Base URL: https://chromium.googlesource.com/chromium/src
Patch Set: Created 6 years, 7 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/test_tools/quic_config_peer.h" 8 #include "net/quic/test_tools/quic_config_peer.h"
9 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" 9 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h"
10 #include "net/quic/test_tools/quic_test_utils.h" 10 #include "net/quic/test_tools/quic_test_utils.h"
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 EXPECT_TRUE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_)); 1027 EXPECT_TRUE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_));
1028 1028
1029 // Retransmit 1 unacked packets, but not the first serialized packet. 1029 // Retransmit 1 unacked packets, but not the first serialized packet.
1030 manager_.OnRetransmissionTimeout(); 1030 manager_.OnRetransmissionTimeout();
1031 RetransmitNextPacket(3); 1031 RetransmitNextPacket(3);
1032 EXPECT_FALSE(manager_.HasPendingRetransmissions()); 1032 EXPECT_FALSE(manager_.HasPendingRetransmissions());
1033 EXPECT_FALSE(QuicSentPacketManagerPeer::HasUnackedCryptoPackets(&manager_)); 1033 EXPECT_FALSE(QuicSentPacketManagerPeer::HasUnackedCryptoPackets(&manager_));
1034 EXPECT_TRUE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_)); 1034 EXPECT_TRUE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_));
1035 } 1035 }
1036 1036
1037 TEST_F(QuicSentPacketManagerTest, ResetRecentMinRTTWithEmptyWindow) {
1038 QuicTime::Delta min_rtt = QuicTime::Delta::FromMilliseconds(50);
1039 QuicSentPacketManagerPeer::GetRttStats(&manager_)->UpdateRtt(
1040 min_rtt, QuicTime::Delta::Zero(), QuicTime::Zero());
1041 EXPECT_EQ(min_rtt,
1042 QuicSentPacketManagerPeer::GetRttStats(&manager_)->min_rtt());
1043 EXPECT_EQ(min_rtt,
1044 QuicSentPacketManagerPeer::GetRttStats(
1045 &manager_)->recent_min_rtt());
1046
1047 // Send two packets with no prior bytes in flight.
1048 SendDataPacket(1);
1049 SendDataPacket(2);
1050
1051 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(100));
1052 // Ack two packets with 100ms RTT observations.
1053 ReceivedPacketInfo received_info;
1054 received_info.delta_time_largest_observed = QuicTime::Delta::Zero();
1055 received_info.largest_observed = 1;
1056 ExpectAck(1);
1057 manager_.OnIncomingAck(received_info, clock_.Now());
1058
1059 // First ack does not change recent min rtt.
1060 EXPECT_EQ(min_rtt,
1061 QuicSentPacketManagerPeer::GetRttStats(
1062 &manager_)->recent_min_rtt());
1063
1064 received_info.largest_observed = 2;
1065 ExpectAck(2);
1066 manager_.OnIncomingAck(received_info, clock_.Now());
1067
1068 EXPECT_EQ(min_rtt,
1069 QuicSentPacketManagerPeer::GetRttStats(&manager_)->min_rtt());
1070 EXPECT_EQ(QuicTime::Delta::FromMilliseconds(100),
1071 QuicSentPacketManagerPeer::GetRttStats(
1072 &manager_)->recent_min_rtt());
1073 }
1074
1037 TEST_F(QuicSentPacketManagerTest, RetransmissionTimeout) { 1075 TEST_F(QuicSentPacketManagerTest, RetransmissionTimeout) {
1038 // Send 100 packets and then ensure all are abandoned when the RTO fires. 1076 // Send 100 packets and then ensure all are abandoned when the RTO fires.
1039 const size_t kNumSentPackets = 100; 1077 const size_t kNumSentPackets = 100;
1040 for (size_t i = 1; i <= kNumSentPackets; ++i) { 1078 for (size_t i = 1; i <= kNumSentPackets; ++i) {
1041 SendDataPacket(i); 1079 SendDataPacket(i);
1042 } 1080 }
1043 1081
1044 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true)); 1082 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true));
1045 manager_.OnRetransmissionTimeout(); 1083 manager_.OnRetransmissionTimeout();
1046 } 1084 }
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 1267
1230 EXPECT_EQ(kTime, 1268 EXPECT_EQ(kTime,
1231 QuicSentPacketManagerPeer::GetLossAlgorithm( 1269 QuicSentPacketManagerPeer::GetLossAlgorithm(
1232 &manager_)->GetLossDetectionType()); 1270 &manager_)->GetLossDetectionType());
1233 } 1271 }
1234 1272
1235 1273
1236 } // namespace 1274 } // namespace
1237 } // namespace test 1275 } // namespace test
1238 } // namespace net 1276 } // 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