| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "net/quic/quic_flags.h" | 10 #include "net/quic/quic_flags.h" |
| (...skipping 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1622 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT); | 1622 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT); |
| 1623 client_config.SetConnectionOptionsToSend(options); | 1623 client_config.SetConnectionOptionsToSend(options); |
| 1624 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()); | 1624 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()); |
| 1625 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); | 1625 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); |
| 1626 manager_.SetFromConfig(client_config); | 1626 manager_.SetFromConfig(client_config); |
| 1627 EXPECT_TRUE(QuicSentPacketManagerPeer::GetUndoRetransmits(&manager_)); | 1627 EXPECT_TRUE(QuicSentPacketManagerPeer::GetUndoRetransmits(&manager_)); |
| 1628 } | 1628 } |
| 1629 | 1629 |
| 1630 TEST_P(QuicSentPacketManagerTest, | 1630 TEST_P(QuicSentPacketManagerTest, |
| 1631 NegotiateConservativeReceiveWindowFromOptions) { | 1631 NegotiateConservativeReceiveWindowFromOptions) { |
| 1632 ValueRestore<bool> old_flag(&FLAGS_quic_ignore_srbf, false); |
| 1632 EXPECT_EQ(kDefaultSocketReceiveBuffer, | 1633 EXPECT_EQ(kDefaultSocketReceiveBuffer, |
| 1633 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); | 1634 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); |
| 1634 | 1635 |
| 1635 // Try to set a size below the minimum and ensure it gets set to the min. | 1636 // Try to set a size below the minimum and ensure it gets set to the min. |
| 1636 QuicConfig client_config; | 1637 QuicConfig client_config; |
| 1637 QuicConfigPeer::SetReceivedSocketReceiveBuffer(&client_config, 1024); | 1638 QuicConfigPeer::SetReceivedSocketReceiveBuffer(&client_config, 1024); |
| 1638 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); | 1639 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); |
| 1639 EXPECT_CALL(*send_algorithm_, | 1640 EXPECT_CALL(*send_algorithm_, |
| 1640 SetMaxCongestionWindow(kMinSocketReceiveBuffer * 0.6)); | 1641 SetMaxCongestionWindow(kMinSocketReceiveBuffer * 0.6)); |
| 1641 EXPECT_CALL(*send_algorithm_, PacingRate()) | 1642 EXPECT_CALL(*send_algorithm_, PacingRate()) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1665 NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA); | 1666 NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA); |
| 1666 } | 1667 } |
| 1667 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _)) | 1668 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _)) |
| 1668 .WillOnce(Return(QuicTime::Delta::Infinite())); | 1669 .WillOnce(Return(QuicTime::Delta::Infinite())); |
| 1669 EXPECT_EQ( | 1670 EXPECT_EQ( |
| 1670 QuicTime::Delta::Infinite(), | 1671 QuicTime::Delta::Infinite(), |
| 1671 manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA, &path_id)); | 1672 manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA, &path_id)); |
| 1672 } | 1673 } |
| 1673 | 1674 |
| 1674 TEST_P(QuicSentPacketManagerTest, ReceiveWindowLimited) { | 1675 TEST_P(QuicSentPacketManagerTest, ReceiveWindowLimited) { |
| 1676 ValueRestore<bool> old_flag(&FLAGS_quic_ignore_srbf, false); |
| 1675 EXPECT_EQ(kDefaultSocketReceiveBuffer, | 1677 EXPECT_EQ(kDefaultSocketReceiveBuffer, |
| 1676 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); | 1678 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); |
| 1677 | 1679 |
| 1678 // Ensure the smaller send window only allows 256 * 0.95 packets to be sent. | 1680 // Ensure the smaller send window only allows 256 * 0.95 packets to be sent. |
| 1679 QuicPathId path_id = kInvalidPathId; | 1681 QuicPathId path_id = kInvalidPathId; |
| 1680 for (QuicPacketNumber i = 1; i <= 244; ++i) { | 1682 for (QuicPacketNumber i = 1; i <= 244; ++i) { |
| 1681 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _)) | 1683 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _)) |
| 1682 .WillOnce(Return(QuicTime::Delta::Zero())); | 1684 .WillOnce(Return(QuicTime::Delta::Zero())); |
| 1683 EXPECT_EQ(QuicTime::Delta::Zero(), | 1685 EXPECT_EQ(QuicTime::Delta::Zero(), |
| 1684 manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA, | 1686 manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA, |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1777 manager_.OnConnectionMigration(kDefaultPathId, PORT_CHANGE); | 1779 manager_.OnConnectionMigration(kDefaultPathId, PORT_CHANGE); |
| 1778 | 1780 |
| 1779 EXPECT_EQ(2 * default_init_rtt, rtt_stats->initial_rtt_us()); | 1781 EXPECT_EQ(2 * default_init_rtt, rtt_stats->initial_rtt_us()); |
| 1780 EXPECT_EQ(1u, manager_.GetConsecutiveRtoCount()); | 1782 EXPECT_EQ(1u, manager_.GetConsecutiveRtoCount()); |
| 1781 EXPECT_EQ(2u, manager_.GetConsecutiveTlpCount()); | 1783 EXPECT_EQ(2u, manager_.GetConsecutiveTlpCount()); |
| 1782 } | 1784 } |
| 1783 | 1785 |
| 1784 } // namespace | 1786 } // namespace |
| 1785 } // namespace test | 1787 } // namespace test |
| 1786 } // namespace net | 1788 } // namespace net |
| OLD | NEW |