| 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 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1377 QuicTagVector options; | 1377 QuicTagVector options; |
| 1378 options.push_back(kPACE); | 1378 options.push_back(kPACE); |
| 1379 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); | 1379 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); |
| 1380 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); | 1380 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); |
| 1381 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, /* using_pacing= */ true)); | 1381 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, /* using_pacing= */ true)); |
| 1382 manager_.SetFromConfig(config); | 1382 manager_.SetFromConfig(config); |
| 1383 | 1383 |
| 1384 EXPECT_TRUE(manager_.using_pacing()); | 1384 EXPECT_TRUE(manager_.using_pacing()); |
| 1385 } | 1385 } |
| 1386 | 1386 |
| 1387 TEST_F(QuicSentPacketManagerTest, EnablePacingViaFlag) { |
| 1388 EXPECT_FALSE(manager_.using_pacing()); |
| 1389 |
| 1390 // If pacing is enabled via command-line flag, it will be turned on, |
| 1391 // regardless of the contents of the config. |
| 1392 ValueRestore<bool> old_flag(&FLAGS_quic_enable_pacing, true); |
| 1393 QuicConfig config; |
| 1394 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); |
| 1395 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, /* using_pacing= */ true)); |
| 1396 manager_.SetFromConfig(config); |
| 1397 |
| 1398 EXPECT_TRUE(manager_.using_pacing()); |
| 1399 } |
| 1400 |
| 1387 TEST_F(QuicSentPacketManagerTest, NegotiateReceiveWindowFromOptions) { | 1401 TEST_F(QuicSentPacketManagerTest, NegotiateReceiveWindowFromOptions) { |
| 1388 EXPECT_EQ(kDefaultSocketReceiveBuffer, | 1402 EXPECT_EQ(kDefaultSocketReceiveBuffer, |
| 1389 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); | 1403 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); |
| 1390 | 1404 |
| 1391 // Try to set a size below the minimum and ensure it gets set to the min. | 1405 // Try to set a size below the minimum and ensure it gets set to the min. |
| 1392 QuicConfig client_config; | 1406 QuicConfig client_config; |
| 1393 QuicConfigPeer::SetReceivedSocketReceiveBuffer(&client_config, 1024); | 1407 QuicConfigPeer::SetReceivedSocketReceiveBuffer(&client_config, 1024); |
| 1394 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)); | 1408 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)); |
| 1395 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); | 1409 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); |
| 1396 manager_.SetFromConfig(client_config); | 1410 manager_.SetFromConfig(client_config); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1447 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); | 1461 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); |
| 1448 manager_.SetFromConfig(config); | 1462 manager_.SetFromConfig(config); |
| 1449 | 1463 |
| 1450 EXPECT_EQ(0, manager_.GetRttStats()->smoothed_rtt().ToMicroseconds()); | 1464 EXPECT_EQ(0, manager_.GetRttStats()->smoothed_rtt().ToMicroseconds()); |
| 1451 EXPECT_EQ(initial_rtt_us, manager_.GetRttStats()->initial_rtt_us()); | 1465 EXPECT_EQ(initial_rtt_us, manager_.GetRttStats()->initial_rtt_us()); |
| 1452 } | 1466 } |
| 1453 | 1467 |
| 1454 } // namespace | 1468 } // namespace |
| 1455 } // namespace test | 1469 } // namespace test |
| 1456 } // namespace net | 1470 } // namespace net |
| OLD | NEW |