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

Unified Diff: net/quic/quic_sent_packet_manager_test.cc

Issue 687093002: Move receive_window_ from BbrTcpSender and TcpCubicSender to (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Gathering_ClientConnectionStats_78688302
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/test_tools/quic_config_peer.h » ('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 9d616ec8bca407f84ced9ed342362782ca5389ba..5eabf86a5a617883cc574e68515fc41d70e77eec 100644
--- a/net/quic/quic_sent_packet_manager_test.cc
+++ b/net/quic/quic_sent_packet_manager_test.cc
@@ -1316,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.
@@ -1326,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
}
@@ -1400,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/test_tools/quic_config_peer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698