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 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1578 options.push_back(kPACE); | 1578 options.push_back(kPACE); |
1579 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); | 1579 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); |
1580 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); | 1580 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); |
1581 EXPECT_CALL(*network_change_visitor_, OnRttChange()); | 1581 EXPECT_CALL(*network_change_visitor_, OnRttChange()); |
1582 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, /*using_pacing=*/true)); | 1582 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, /*using_pacing=*/true)); |
1583 manager_.SetFromConfig(config); | 1583 manager_.SetFromConfig(config); |
1584 | 1584 |
1585 EXPECT_TRUE(manager_.using_pacing()); | 1585 EXPECT_TRUE(manager_.using_pacing()); |
1586 } | 1586 } |
1587 | 1587 |
1588 TEST_F(QuicSentPacketManagerTest, EnablePacingViaFlag) { | |
1589 EXPECT_FALSE(manager_.using_pacing()); | |
1590 | |
1591 // If pacing is enabled via command-line flag, it will be turned on, | |
1592 // regardless of the contents of the config. | |
1593 ValueRestore<bool> old_flag(&FLAGS_quic_enable_pacing, true); | |
1594 QuicConfig config; | |
1595 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); | |
1596 EXPECT_CALL(*network_change_visitor_, OnRttChange()); | |
1597 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, /*using_pacing=*/true)); | |
1598 manager_.SetFromConfig(config); | |
1599 | |
1600 EXPECT_TRUE(manager_.using_pacing()); | |
1601 } | |
1602 | |
1603 TEST_F(QuicSentPacketManagerTest, NegotiateReceiveWindowFromOptions) { | 1588 TEST_F(QuicSentPacketManagerTest, NegotiateReceiveWindowFromOptions) { |
1604 EXPECT_EQ(kDefaultSocketReceiveBuffer, | 1589 EXPECT_EQ(kDefaultSocketReceiveBuffer, |
1605 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); | 1590 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); |
1606 | 1591 |
1607 // Try to set a size below the minimum and ensure it gets set to the min. | 1592 // Try to set a size below the minimum and ensure it gets set to the min. |
1608 QuicConfig client_config; | 1593 QuicConfig client_config; |
1609 QuicConfigPeer::SetReceivedSocketReceiveBuffer(&client_config, 1024); | 1594 QuicConfigPeer::SetReceivedSocketReceiveBuffer(&client_config, 1024); |
1610 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)); | 1595 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)); |
1611 EXPECT_CALL(*send_algorithm_, PacingRate()) | 1596 EXPECT_CALL(*send_algorithm_, PacingRate()) |
1612 .WillRepeatedly(Return(QuicBandwidth::Zero())); | 1597 .WillRepeatedly(Return(QuicBandwidth::Zero())); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1680 | 1665 |
1681 EXPECT_CALL(*send_algorithm_, ResumeConnectionState(_)); | 1666 EXPECT_CALL(*send_algorithm_, ResumeConnectionState(_)); |
1682 manager_.ResumeConnectionState(cached_network_params); | 1667 manager_.ResumeConnectionState(cached_network_params); |
1683 EXPECT_EQ(kRttMs * kNumMicrosPerMilli, | 1668 EXPECT_EQ(kRttMs * kNumMicrosPerMilli, |
1684 static_cast<uint64>(manager_.GetRttStats()->initial_rtt_us())); | 1669 static_cast<uint64>(manager_.GetRttStats()->initial_rtt_us())); |
1685 } | 1670 } |
1686 | 1671 |
1687 } // namespace | 1672 } // namespace |
1688 } // namespace test | 1673 } // namespace test |
1689 } // namespace net | 1674 } // namespace net |
OLD | NEW |