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

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

Issue 1141743004: Remove FLAGS_quic_limit_max_cwnd_to_receive_buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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/quic_flags.h" 8 #include "net/quic/quic_flags.h"
9 #include "net/quic/test_tools/quic_config_peer.h" 9 #include "net/quic/test_tools/quic_config_peer.h"
10 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" 10 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h"
(...skipping 1566 matching lines...) Expand 10 before | Expand all | Expand 10 after
1577 } 1577 }
1578 1578
1579 TEST_F(QuicSentPacketManagerTest, NegotiateReceiveWindowFromOptions) { 1579 TEST_F(QuicSentPacketManagerTest, NegotiateReceiveWindowFromOptions) {
1580 EXPECT_EQ(kDefaultSocketReceiveBuffer, 1580 EXPECT_EQ(kDefaultSocketReceiveBuffer,
1581 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); 1581 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_));
1582 1582
1583 // Try to set a size below the minimum and ensure it gets set to the min. 1583 // Try to set a size below the minimum and ensure it gets set to the min.
1584 QuicConfig client_config; 1584 QuicConfig client_config;
1585 QuicConfigPeer::SetReceivedSocketReceiveBuffer(&client_config, 1024); 1585 QuicConfigPeer::SetReceivedSocketReceiveBuffer(&client_config, 1024);
1586 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); 1586 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1587 if (FLAGS_quic_limit_max_cwnd_to_receive_buffer) { 1587 EXPECT_CALL(*send_algorithm_,
1588 EXPECT_CALL(*send_algorithm_, 1588 SetMaxCongestionWindow(kMinSocketReceiveBuffer * 0.95));
1589 SetMaxCongestionWindow(kMinSocketReceiveBuffer * 0.95));
1590 }
1591 EXPECT_CALL(*send_algorithm_, PacingRate()) 1589 EXPECT_CALL(*send_algorithm_, PacingRate())
1592 .WillRepeatedly(Return(QuicBandwidth::Zero())); 1590 .WillRepeatedly(Return(QuicBandwidth::Zero()));
1593 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 1591 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
1594 EXPECT_CALL(*network_change_visitor_, OnRttChange()); 1592 EXPECT_CALL(*network_change_visitor_, OnRttChange());
1595 manager_.SetFromConfig(client_config); 1593 manager_.SetFromConfig(client_config);
1596 1594
1597 EXPECT_EQ(kMinSocketReceiveBuffer, 1595 EXPECT_EQ(kMinSocketReceiveBuffer,
1598 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); 1596 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_));
1599 1597
1600 // Ensure the smaller send window only allows 16 packets to be sent. 1598 // Ensure the smaller send window only allows 16 packets to be sent.
1601 for (QuicPacketSequenceNumber i = 1; i <= 16; ++i) { 1599 for (QuicPacketSequenceNumber i = 1; i <= 16; ++i) {
1602 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)).WillOnce(Return( 1600 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)).WillOnce(Return(
1603 QuicTime::Delta::Zero())); 1601 QuicTime::Delta::Zero()));
1604 EXPECT_EQ(QuicTime::Delta::Zero(), 1602 EXPECT_EQ(QuicTime::Delta::Zero(),
1605 manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA)); 1603 manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA));
1606 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, BytesInFlight(), i, 1604 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, BytesInFlight(), i,
1607 1024, HAS_RETRANSMITTABLE_DATA)) 1605 1024, HAS_RETRANSMITTABLE_DATA))
1608 .WillOnce(Return(true)); 1606 .WillOnce(Return(true));
1609 SerializedPacket packet(CreatePacket(i, true)); 1607 SerializedPacket packet(CreatePacket(i, true));
1610 manager_.OnPacketSent(&packet, 0, clock_.Now(), 1024, 1608 manager_.OnPacketSent(&packet, 0, clock_.Now(), 1024,
1611 NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA); 1609 NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA);
1612 } 1610 }
1613 if (FLAGS_quic_limit_max_cwnd_to_receive_buffer) { 1611 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _))
1614 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)) 1612 .WillOnce(Return(QuicTime::Delta::Infinite()));
1615 .WillOnce(Return(QuicTime::Delta::Infinite()));
1616 }
1617 EXPECT_EQ(QuicTime::Delta::Infinite(), 1613 EXPECT_EQ(QuicTime::Delta::Infinite(),
1618 manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA)); 1614 manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA));
1619 } 1615 }
1620 1616
1621 TEST_F(QuicSentPacketManagerTest, ReceiveWindowLimited) { 1617 TEST_F(QuicSentPacketManagerTest, ReceiveWindowLimited) {
1622 EXPECT_EQ(kDefaultSocketReceiveBuffer, 1618 EXPECT_EQ(kDefaultSocketReceiveBuffer,
1623 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); 1619 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_));
1624 1620
1625 // Ensure the smaller send window only allows 256 * 0.95 packets to be sent. 1621 // Ensure the smaller send window only allows 256 * 0.95 packets to be sent.
1626 for (QuicPacketSequenceNumber i = 1; i <= 244; ++i) { 1622 for (QuicPacketSequenceNumber i = 1; i <= 244; ++i) {
1627 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)).WillOnce(Return( 1623 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)).WillOnce(Return(
1628 QuicTime::Delta::Zero())); 1624 QuicTime::Delta::Zero()));
1629 EXPECT_EQ(QuicTime::Delta::Zero(), 1625 EXPECT_EQ(QuicTime::Delta::Zero(),
1630 manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA)); 1626 manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA));
1631 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, BytesInFlight(), i, 1627 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, BytesInFlight(), i,
1632 1024, HAS_RETRANSMITTABLE_DATA)) 1628 1024, HAS_RETRANSMITTABLE_DATA))
1633 .WillOnce(Return(true)); 1629 .WillOnce(Return(true));
1634 SerializedPacket packet(CreatePacket(i, true)); 1630 SerializedPacket packet(CreatePacket(i, true));
1635 manager_.OnPacketSent(&packet, 0, clock_.Now(), 1024, 1631 manager_.OnPacketSent(&packet, 0, clock_.Now(), 1024,
1636 NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA); 1632 NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA);
1637 } 1633 }
1638 if (FLAGS_quic_limit_max_cwnd_to_receive_buffer) { 1634 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _))
1639 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)) 1635 .WillOnce(Return(QuicTime::Delta::Infinite()));
1640 .WillOnce(Return(QuicTime::Delta::Infinite()));
1641 }
1642 EXPECT_EQ(QuicTime::Delta::Infinite(), 1636 EXPECT_EQ(QuicTime::Delta::Infinite(),
1643 manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA)); 1637 manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA));
1644 } 1638 }
1645 1639
1646 TEST_F(QuicSentPacketManagerTest, UseInitialRoundTripTimeToSend) { 1640 TEST_F(QuicSentPacketManagerTest, UseInitialRoundTripTimeToSend) {
1647 uint32 initial_rtt_us = 325000; 1641 uint32 initial_rtt_us = 325000;
1648 EXPECT_NE(initial_rtt_us, 1642 EXPECT_NE(initial_rtt_us,
1649 manager_.GetRttStats()->smoothed_rtt().ToMicroseconds()); 1643 manager_.GetRttStats()->smoothed_rtt().ToMicroseconds());
1650 1644
1651 QuicConfig config; 1645 QuicConfig config;
(...skipping 16 matching lines...) Expand all
1668 1662
1669 EXPECT_CALL(*send_algorithm_, ResumeConnectionState(_, false)); 1663 EXPECT_CALL(*send_algorithm_, ResumeConnectionState(_, false));
1670 manager_.ResumeConnectionState(cached_network_params, false); 1664 manager_.ResumeConnectionState(cached_network_params, false);
1671 EXPECT_EQ(kRttMs * kNumMicrosPerMilli, 1665 EXPECT_EQ(kRttMs * kNumMicrosPerMilli,
1672 static_cast<uint64>(manager_.GetRttStats()->initial_rtt_us())); 1666 static_cast<uint64>(manager_.GetRttStats()->initial_rtt_us()));
1673 } 1667 }
1674 1668
1675 } // namespace 1669 } // namespace
1676 } // namespace test 1670 } // namespace test
1677 } // namespace net 1671 } // 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