OLD | NEW |
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 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 QuicConfig client_config; | 1110 QuicConfig client_config; |
1111 QuicTagVector options; | 1111 QuicTagVector options; |
1112 options.push_back(kNRTO); | 1112 options.push_back(kNRTO); |
1113 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT); | 1113 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT); |
1114 client_config.SetConnectionOptionsToSend(options); | 1114 client_config.SetConnectionOptionsToSend(options); |
1115 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); | 1115 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); |
1116 EXPECT_CALL(*network_change_visitor_, OnRttChange()); | 1116 EXPECT_CALL(*network_change_visitor_, OnRttChange()); |
1117 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); | 1117 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); |
1118 EXPECT_CALL(*send_algorithm_, PacingRate()) | 1118 EXPECT_CALL(*send_algorithm_, PacingRate()) |
1119 .WillRepeatedly(Return(QuicBandwidth::Zero())); | 1119 .WillRepeatedly(Return(QuicBandwidth::Zero())); |
| 1120 if (FLAGS_quic_limit_pacing_burst) { |
| 1121 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()) |
| 1122 .WillOnce(Return(10 * kDefaultTCPMSS)); |
| 1123 } |
1120 manager_.SetFromConfig(client_config); | 1124 manager_.SetFromConfig(client_config); |
1121 EXPECT_TRUE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_)); | 1125 EXPECT_TRUE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_)); |
1122 | 1126 |
1123 // Send 100 packets. | 1127 // Send 100 packets. |
1124 const size_t kNumSentPackets = 100; | 1128 const size_t kNumSentPackets = 100; |
1125 for (size_t i = 1; i <= kNumSentPackets; ++i) { | 1129 for (size_t i = 1; i <= kNumSentPackets; ++i) { |
1126 SendDataPacket(i); | 1130 SendDataPacket(i); |
1127 } | 1131 } |
1128 | 1132 |
1129 EXPECT_FALSE(manager_.MaybeRetransmitTailLossProbe()); | 1133 EXPECT_FALSE(manager_.MaybeRetransmitTailLossProbe()); |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1583 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); | 1587 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); |
1584 | 1588 |
1585 // Try to set a size below the minimum and ensure it gets set to the min. | 1589 // Try to set a size below the minimum and ensure it gets set to the min. |
1586 QuicConfig client_config; | 1590 QuicConfig client_config; |
1587 QuicConfigPeer::SetReceivedSocketReceiveBuffer(&client_config, 1024); | 1591 QuicConfigPeer::SetReceivedSocketReceiveBuffer(&client_config, 1024); |
1588 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); | 1592 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); |
1589 EXPECT_CALL(*send_algorithm_, | 1593 EXPECT_CALL(*send_algorithm_, |
1590 SetMaxCongestionWindow(kMinSocketReceiveBuffer * 0.95)); | 1594 SetMaxCongestionWindow(kMinSocketReceiveBuffer * 0.95)); |
1591 EXPECT_CALL(*send_algorithm_, PacingRate()) | 1595 EXPECT_CALL(*send_algorithm_, PacingRate()) |
1592 .WillRepeatedly(Return(QuicBandwidth::Zero())); | 1596 .WillRepeatedly(Return(QuicBandwidth::Zero())); |
| 1597 if (FLAGS_quic_limit_pacing_burst) { |
| 1598 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()) |
| 1599 .WillOnce(Return(10 * kDefaultTCPMSS)); |
| 1600 } |
1593 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); | 1601 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); |
1594 EXPECT_CALL(*network_change_visitor_, OnRttChange()); | 1602 EXPECT_CALL(*network_change_visitor_, OnRttChange()); |
1595 manager_.SetFromConfig(client_config); | 1603 manager_.SetFromConfig(client_config); |
1596 | 1604 |
1597 EXPECT_EQ(kMinSocketReceiveBuffer, | 1605 EXPECT_EQ(kMinSocketReceiveBuffer, |
1598 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); | 1606 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); |
1599 | 1607 |
1600 // Ensure the smaller send window only allows 16 packets to be sent. | 1608 // Ensure the smaller send window only allows 16 packets to be sent. |
1601 for (QuicPacketSequenceNumber i = 1; i <= 16; ++i) { | 1609 for (QuicPacketSequenceNumber i = 1; i <= 16; ++i) { |
1602 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)).WillOnce(Return( | 1610 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)).WillOnce(Return( |
(...skipping 21 matching lines...) Expand all Loading... |
1624 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); | 1632 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); |
1625 | 1633 |
1626 // Try to set a size below the minimum and ensure it gets set to the min. | 1634 // Try to set a size below the minimum and ensure it gets set to the min. |
1627 QuicConfig client_config; | 1635 QuicConfig client_config; |
1628 QuicConfigPeer::SetReceivedSocketReceiveBuffer(&client_config, 1024); | 1636 QuicConfigPeer::SetReceivedSocketReceiveBuffer(&client_config, 1024); |
1629 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); | 1637 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); |
1630 EXPECT_CALL(*send_algorithm_, | 1638 EXPECT_CALL(*send_algorithm_, |
1631 SetMaxCongestionWindow(kMinSocketReceiveBuffer * 0.6)); | 1639 SetMaxCongestionWindow(kMinSocketReceiveBuffer * 0.6)); |
1632 EXPECT_CALL(*send_algorithm_, PacingRate()) | 1640 EXPECT_CALL(*send_algorithm_, PacingRate()) |
1633 .WillRepeatedly(Return(QuicBandwidth::Zero())); | 1641 .WillRepeatedly(Return(QuicBandwidth::Zero())); |
| 1642 if (FLAGS_quic_limit_pacing_burst) { |
| 1643 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()) |
| 1644 .WillOnce(Return(10 * kDefaultTCPMSS)); |
| 1645 } |
1634 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); | 1646 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); |
1635 EXPECT_CALL(*network_change_visitor_, OnRttChange()); | 1647 EXPECT_CALL(*network_change_visitor_, OnRttChange()); |
1636 manager_.SetFromConfig(client_config); | 1648 manager_.SetFromConfig(client_config); |
1637 | 1649 |
1638 EXPECT_EQ(kMinSocketReceiveBuffer, | 1650 EXPECT_EQ(kMinSocketReceiveBuffer, |
1639 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); | 1651 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); |
1640 | 1652 |
1641 // Ensure the smaller send window only allows 16 packets to be sent. | 1653 // Ensure the smaller send window only allows 16 packets to be sent. |
1642 for (QuicPacketSequenceNumber i = 1; i <= 16; ++i) { | 1654 for (QuicPacketSequenceNumber i = 1; i <= 16; ++i) { |
1643 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)) | 1655 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)) |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1705 | 1717 |
1706 EXPECT_CALL(*send_algorithm_, ResumeConnectionState(_, false)); | 1718 EXPECT_CALL(*send_algorithm_, ResumeConnectionState(_, false)); |
1707 manager_.ResumeConnectionState(cached_network_params, false); | 1719 manager_.ResumeConnectionState(cached_network_params, false); |
1708 EXPECT_EQ(kRttMs * kNumMicrosPerMilli, | 1720 EXPECT_EQ(kRttMs * kNumMicrosPerMilli, |
1709 static_cast<uint64>(manager_.GetRttStats()->initial_rtt_us())); | 1721 static_cast<uint64>(manager_.GetRttStats()->initial_rtt_us())); |
1710 } | 1722 } |
1711 | 1723 |
1712 } // namespace | 1724 } // namespace |
1713 } // namespace test | 1725 } // namespace test |
1714 } // namespace net | 1726 } // namespace net |
OLD | NEW |