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 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1147 TEST_F(QuicSentPacketManagerTest, NewRetransmissionTimeout) { | 1147 TEST_F(QuicSentPacketManagerTest, NewRetransmissionTimeout) { |
1148 ValueRestore<bool> old_flag(&FLAGS_quic_use_new_rto, true); | 1148 ValueRestore<bool> old_flag(&FLAGS_quic_use_new_rto, true); |
1149 QuicConfig client_config; | 1149 QuicConfig client_config; |
1150 QuicTagVector options; | 1150 QuicTagVector options; |
1151 options.push_back(kNRTO); | 1151 options.push_back(kNRTO); |
1152 QuicSentPacketManagerPeer::SetIsServer(&manager_, false); | 1152 QuicSentPacketManagerPeer::SetIsServer(&manager_, false); |
1153 client_config.SetConnectionOptionsToSend(options); | 1153 client_config.SetConnectionOptionsToSend(options); |
1154 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); | 1154 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); |
1155 EXPECT_CALL(*network_change_visitor_, OnRttChange()); | 1155 EXPECT_CALL(*network_change_visitor_, OnRttChange()); |
1156 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)); | 1156 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)); |
| 1157 EXPECT_CALL(*send_algorithm_, PacingRate()) |
| 1158 .WillRepeatedly(Return(QuicBandwidth::Zero())); |
1157 manager_.SetFromConfig(client_config); | 1159 manager_.SetFromConfig(client_config); |
1158 EXPECT_TRUE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_)); | 1160 EXPECT_TRUE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_)); |
1159 | 1161 |
1160 // Send 100 packets. | 1162 // Send 100 packets. |
1161 const size_t kNumSentPackets = 100; | 1163 const size_t kNumSentPackets = 100; |
1162 for (size_t i = 1; i <= kNumSentPackets; ++i) { | 1164 for (size_t i = 1; i <= kNumSentPackets; ++i) { |
1163 SendDataPacket(i); | 1165 SendDataPacket(i); |
1164 } | 1166 } |
1165 | 1167 |
1166 EXPECT_FALSE(manager_.MaybeRetransmitTailLossProbe()); | 1168 EXPECT_FALSE(manager_.MaybeRetransmitTailLossProbe()); |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1714 } | 1716 } |
1715 | 1717 |
1716 TEST_F(QuicSentPacketManagerTest, NegotiateReceiveWindowFromOptions) { | 1718 TEST_F(QuicSentPacketManagerTest, NegotiateReceiveWindowFromOptions) { |
1717 EXPECT_EQ(kDefaultSocketReceiveBuffer, | 1719 EXPECT_EQ(kDefaultSocketReceiveBuffer, |
1718 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); | 1720 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); |
1719 | 1721 |
1720 // Try to set a size below the minimum and ensure it gets set to the min. | 1722 // Try to set a size below the minimum and ensure it gets set to the min. |
1721 QuicConfig client_config; | 1723 QuicConfig client_config; |
1722 QuicConfigPeer::SetReceivedSocketReceiveBuffer(&client_config, 1024); | 1724 QuicConfigPeer::SetReceivedSocketReceiveBuffer(&client_config, 1024); |
1723 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)); | 1725 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)); |
| 1726 EXPECT_CALL(*send_algorithm_, PacingRate()) |
| 1727 .WillRepeatedly(Return(QuicBandwidth::Zero())); |
1724 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); | 1728 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); |
1725 EXPECT_CALL(*network_change_visitor_, OnRttChange()); | 1729 EXPECT_CALL(*network_change_visitor_, OnRttChange()); |
1726 manager_.SetFromConfig(client_config); | 1730 manager_.SetFromConfig(client_config); |
1727 | 1731 |
1728 EXPECT_EQ(kMinSocketReceiveBuffer, | 1732 EXPECT_EQ(kMinSocketReceiveBuffer, |
1729 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); | 1733 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); |
1730 | 1734 |
1731 // Ensure the smaller send window only allows 16 packets to be sent. | 1735 // Ensure the smaller send window only allows 16 packets to be sent. |
1732 for (QuicPacketSequenceNumber i = 1; i <= 16; ++i) { | 1736 for (QuicPacketSequenceNumber i = 1; i <= 16; ++i) { |
1733 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)).WillOnce(Return( | 1737 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)).WillOnce(Return( |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1791 | 1795 |
1792 EXPECT_CALL(*send_algorithm_, ResumeConnectionState(_)); | 1796 EXPECT_CALL(*send_algorithm_, ResumeConnectionState(_)); |
1793 manager_.ResumeConnectionState(cached_network_params); | 1797 manager_.ResumeConnectionState(cached_network_params); |
1794 EXPECT_EQ(kRttMs * kNumMicrosPerMilli, | 1798 EXPECT_EQ(kRttMs * kNumMicrosPerMilli, |
1795 static_cast<uint64>(manager_.GetRttStats()->initial_rtt_us())); | 1799 static_cast<uint64>(manager_.GetRttStats()->initial_rtt_us())); |
1796 } | 1800 } |
1797 | 1801 |
1798 } // namespace | 1802 } // namespace |
1799 } // namespace test | 1803 } // namespace test |
1800 } // namespace net | 1804 } // namespace net |
OLD | NEW |