gfe-relnote: In QUIC, add a connection option to use 2 * rttvar when calculating PTO timeout. Protected by existing gfe2_reloadable_flag_quic_enable_pto.
PiperOrigin-RevId: 278451908
Change-Id: I5f68cad58734bd52e70efce51eefd84646050cac
diff --git a/quic/core/quic_sent_packet_manager_test.cc b/quic/core/quic_sent_packet_manager_test.cc
index b7ca395..539ce97 100644
--- a/quic/core/quic_sent_packet_manager_test.cc
+++ b/quic/core/quic_sent_packet_manager_test.cc
@@ -3026,6 +3026,35 @@
manager_.GetRetransmissionTime());
}
+TEST_F(QuicSentPacketManagerTest, PtoTimeoutRttVarMultiple) {
+ EnablePto(k1PTO);
+ // Use 2 * rttvar
+ QuicConfig config;
+ QuicTagVector options;
+ options.push_back(kPVS1);
+ QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
+ EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
+ EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
+ manager_.SetFromConfig(config);
+
+ EXPECT_CALL(*send_algorithm_, PacingRate(_))
+ .WillRepeatedly(Return(QuicBandwidth::Zero()));
+ EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
+ .WillRepeatedly(Return(10 * kDefaultTCPMSS));
+ RttStats* rtt_stats = const_cast<RttStats*>(manager_.GetRttStats());
+ rtt_stats->UpdateRtt(QuicTime::Delta::FromMilliseconds(100),
+ QuicTime::Delta::Zero(), QuicTime::Zero());
+ QuicTime::Delta srtt = rtt_stats->smoothed_rtt();
+
+ SendDataPacket(1, ENCRYPTION_FORWARD_SECURE);
+ // Verify PTO is correctly set based on 2 times rtt var.
+ QuicTime::Delta expected_pto_delay =
+ srtt + 2 * rtt_stats->mean_deviation() +
+ QuicTime::Delta::FromMilliseconds(kDefaultDelayedAckTimeMs);
+ EXPECT_EQ(clock_.Now() + expected_pto_delay,
+ manager_.GetRetransmissionTime());
+}
+
} // namespace
} // namespace test
} // namespace quic