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

Unified Diff: net/quic/core/quic_sent_packet_manager_test.cc

Issue 2392093002: Add a QUIC connection option to use a more conservative handshake retransmission timer. Protected … (Closed)
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/core/quic_sent_packet_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/quic_sent_packet_manager_test.cc
diff --git a/net/quic/core/quic_sent_packet_manager_test.cc b/net/quic/core/quic_sent_packet_manager_test.cc
index 8f531c32fed80217368602d722f760647958ff37..a6a54477348d376689e13d85de4e19da8fea7407 100644
--- a/net/quic/core/quic_sent_packet_manager_test.cc
+++ b/net/quic/core/quic_sent_packet_manager_test.cc
@@ -1165,6 +1165,48 @@ TEST_P(QuicSentPacketManagerTest, GetTransmissionTimeCryptoHandshake) {
EXPECT_EQ(expected_time, manager_.GetRetransmissionTime());
}
+TEST_P(QuicSentPacketManagerTest,
+ GetConservativeTransmissionTimeCryptoHandshake) {
+ FLAGS_quic_conservative_handshake_retransmits = true;
+ QuicConfig config;
+ QuicTagVector options;
+ options.push_back(kCONH);
+ QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
+ EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
+ EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
+ manager_.SetFromConfig(config);
+ // Calling SetFromConfig requires mocking out some send algorithm methods.
+ EXPECT_CALL(*send_algorithm_, PacingRate(_))
+ .WillRepeatedly(Return(QuicBandwidth::Zero()));
+ EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
+ .WillRepeatedly(Return(10 * kDefaultTCPMSS));
+
+ SendCryptoPacket(1);
+
+ // Check the min.
+ RttStats* rtt_stats = const_cast<RttStats*>(manager_.GetRttStats());
+ rtt_stats->set_initial_rtt_us(1 * kNumMicrosPerMilli);
+ EXPECT_EQ(clock_.Now() + QuicTime::Delta::FromMilliseconds(25),
+ manager_.GetRetransmissionTime());
+
+ // Test with a standard smoothed RTT.
+ rtt_stats->set_initial_rtt_us(100 * kNumMicrosPerMilli);
+
+ QuicTime::Delta srtt =
+ QuicTime::Delta::FromMicroseconds(rtt_stats->initial_rtt_us());
+ QuicTime expected_time = clock_.Now() + 2 * srtt;
+ EXPECT_EQ(expected_time, manager_.GetRetransmissionTime());
+
+ // Retransmit the packet by invoking the retransmission timeout.
+ clock_.AdvanceTime(2 * srtt);
+ manager_.OnRetransmissionTimeout();
+ RetransmitNextPacket(2);
+
+ // The retransmission time should now be twice as far in the future.
+ expected_time = clock_.Now() + srtt * 2 * 2;
+ EXPECT_EQ(expected_time, manager_.GetRetransmissionTime());
+}
+
TEST_P(QuicSentPacketManagerTest, GetTransmissionTimeTailLossProbe) {
QuicSentPacketManagerPeer::SetMaxTailLossProbes(&manager_, 2);
SendDataPacket(1);
« no previous file with comments | « net/quic/core/quic_sent_packet_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698