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

Unified Diff: net/quic/quic_sent_packet_manager_test.cc

Issue 683113005: Update from chromium https://crrev.com/302282 (Closed) Base URL: git@github.com:domokit/mojo.git@master
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_sent_packet_manager.cc ('k') | net/quic/quic_server_session.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_sent_packet_manager_test.cc
diff --git a/net/quic/quic_sent_packet_manager_test.cc b/net/quic/quic_sent_packet_manager_test.cc
index d3f031253ccd04a6b8c28afb08d12d03a9a19619..5eabf86a5a617883cc574e68515fc41d70e77eec 100644
--- a/net/quic/quic_sent_packet_manager_test.cc
+++ b/net/quic/quic_sent_packet_manager_test.cc
@@ -1201,7 +1201,9 @@ TEST_F(QuicSentPacketManagerTest, GetTransmissionTimeRTO) {
// Wait 2RTTs from now for the RTO, since it's the max of the RTO time
// and the TLP time. In production, there would always be two TLP's first.
- expected_time = clock_.Now().Add(QuicTime::Delta::FromMilliseconds(200));
+ // Since retransmission was spurious, smoothed_rtt_ is expired, and replaced
+ // by the latest RTT sample of 500ms.
+ expected_time = clock_.Now().Add(QuicTime::Delta::FromMilliseconds(1000));
EXPECT_EQ(expected_time, manager_.GetRetransmissionTime());
}
@@ -1306,6 +1308,7 @@ TEST_F(QuicSentPacketManagerTest, NegotiateTimeLossDetectionFromOptions) {
}
TEST_F(QuicSentPacketManagerTest, NegotiateCongestionControlFromOptions) {
+ ValueRestore<bool> old_flag(&FLAGS_quic_allow_bbr, true);
QuicConfig config;
QuicTagVector options;
@@ -1313,7 +1316,7 @@ TEST_F(QuicSentPacketManagerTest, NegotiateCongestionControlFromOptions) {
QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_));
manager_.SetFromConfig(config);
- EXPECT_EQ(kReno, QuicSentPacketManagerPeer::GetCongestionControlAlgorithm(
+ EXPECT_EQ(kReno, QuicSentPacketManagerPeer::GetSendAlgorithm(
manager_)->GetCongestionControlType());
// TODO(rtenneti): Enable the following code after BBR code is checked in.
@@ -1323,7 +1326,7 @@ TEST_F(QuicSentPacketManagerTest, NegotiateCongestionControlFromOptions) {
QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_));
manager_.SetFromConfig(config);
- EXPECT_EQ(kBBR, QuicSentPacketManagerPeer::GetCongestionControlAlgorithm(
+ EXPECT_EQ(kBBR, QuicSentPacketManagerPeer::GetSendAlgorithm(
manager_)->GetCongestionControlType());
#endif
}
@@ -1352,6 +1355,35 @@ TEST_F(QuicSentPacketManagerTest, NegotiateNumConnectionsFromOptions) {
manager_.SetFromConfig(client_config);
}
+TEST_F(QuicSentPacketManagerTest, NegotiateNoTLPFromOptionsAtServer) {
+ QuicConfig config;
+ QuicTagVector options;
+
+ options.push_back(kNTLP);
+ QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
+ EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_));
+ EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
+ .WillOnce(Return(100 * kDefaultTCPMSS));
+ EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
+ manager_.SetFromConfig(config);
+ EXPECT_EQ(0u, QuicSentPacketManagerPeer::GetMaxTailLossProbes(&manager_));
+}
+
+TEST_F(QuicSentPacketManagerTest, NegotiateNoTLPFromOptionsAtClient) {
+ QuicConfig client_config;
+ QuicTagVector options;
+
+ options.push_back(kNTLP);
+ QuicSentPacketManagerPeer::SetIsServer(&manager_, false);
+ client_config.SetConnectionOptionsToSend(options);
+ EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_));
+ EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
+ .WillOnce(Return(100 * kDefaultTCPMSS));
+ EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
+ manager_.SetFromConfig(client_config);
+ EXPECT_EQ(0u, QuicSentPacketManagerPeer::GetMaxTailLossProbes(&manager_));
+}
+
TEST_F(QuicSentPacketManagerTest, NegotiatePacingFromOptions) {
EXPECT_FALSE(manager_.using_pacing());
@@ -1368,6 +1400,39 @@ TEST_F(QuicSentPacketManagerTest, NegotiatePacingFromOptions) {
EXPECT_TRUE(manager_.using_pacing());
}
+TEST_F(QuicSentPacketManagerTest, NegotiateReceiveWindowFromOptions) {
+ EXPECT_EQ(kDefaultSocketReceiveBuffer,
+ QuicSentPacketManagerPeer::GetReceiveWindow(&manager_));
+
+ // Try to set a size below the minimum and ensure it gets set to the min.
+ QuicConfig client_config;
+ QuicConfigPeer::SetReceivedSocketReceiveBuffer(&client_config, 1024);
+ EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
+ EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_));
+ EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
+ .WillOnce(Return(100 * kDefaultTCPMSS));
+ manager_.SetFromConfig(client_config);
+
+ EXPECT_EQ(kMinSocketReceiveBuffer,
+ QuicSentPacketManagerPeer::GetReceiveWindow(&manager_));
+
+ // Ensure the smaller send window only allows 16 packets to be sent.
+ for (QuicPacketSequenceNumber i = 1; i <= 16; ++i) {
+ EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)).WillOnce(Return(
+ QuicTime::Delta::Zero()));
+ EXPECT_EQ(QuicTime::Delta::Zero(),
+ manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA));
+ EXPECT_CALL(*send_algorithm_, OnPacketSent(_, BytesInFlight(), i,
+ 1024, HAS_RETRANSMITTABLE_DATA))
+ .WillOnce(Return(true));
+ SerializedPacket packet(CreatePacket(i, true));
+ manager_.OnPacketSent(&packet, 0, clock_.Now(), 1024,
+ NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA);
+ }
+ EXPECT_EQ(QuicTime::Delta::Infinite(),
+ manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA));
+}
+
TEST_F(QuicSentPacketManagerTest, UseInitialRoundTripTimeToSend) {
uint32 initial_rtt_us = 325000;
EXPECT_NE(initial_rtt_us,
« no previous file with comments | « net/quic/quic_sent_packet_manager.cc ('k') | net/quic/quic_server_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698