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 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1385 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_)); | 1385 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_)); |
1386 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()) | 1386 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()) |
1387 .WillOnce(Return(100 * kDefaultTCPMSS)); | 1387 .WillOnce(Return(100 * kDefaultTCPMSS)); |
1388 manager_.SetFromConfig(config); | 1388 manager_.SetFromConfig(config); |
1389 | 1389 |
1390 EXPECT_EQ(kTime, | 1390 EXPECT_EQ(kTime, |
1391 QuicSentPacketManagerPeer::GetLossAlgorithm( | 1391 QuicSentPacketManagerPeer::GetLossAlgorithm( |
1392 &manager_)->GetLossDetectionType()); | 1392 &manager_)->GetLossDetectionType()); |
1393 } | 1393 } |
1394 | 1394 |
| 1395 TEST_F(QuicSentPacketManagerTest, NegotiateCongestionControlFromOptions) { |
| 1396 QuicConfig config; |
| 1397 QuicTagVector options; |
| 1398 |
| 1399 options.push_back(kRENO); |
| 1400 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); |
| 1401 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_)); |
| 1402 manager_.SetFromConfig(config); |
| 1403 EXPECT_EQ(kReno, QuicSentPacketManagerPeer::GetCongestionControlAlgorithm( |
| 1404 manager_)->GetCongestionControlType()); |
| 1405 |
| 1406 // TODO(rtenneti): Enable the following code after BBR code is checked in. |
| 1407 #if 0 |
| 1408 options.clear(); |
| 1409 options.push_back(kTBBR); |
| 1410 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); |
| 1411 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_)); |
| 1412 manager_.SetFromConfig(config); |
| 1413 EXPECT_EQ(kBBR, QuicSentPacketManagerPeer::GetCongestionControlAlgorithm( |
| 1414 manager_)->GetCongestionControlType()); |
| 1415 #endif |
| 1416 } |
| 1417 |
1395 TEST_F(QuicSentPacketManagerTest, NegotiatePacingFromOptions) { | 1418 TEST_F(QuicSentPacketManagerTest, NegotiatePacingFromOptions) { |
1396 ValueRestore<bool> old_flag(&FLAGS_enable_quic_pacing, true); | 1419 ValueRestore<bool> old_flag(&FLAGS_enable_quic_pacing, true); |
1397 EXPECT_FALSE(manager_.using_pacing()); | 1420 EXPECT_FALSE(manager_.using_pacing()); |
1398 | 1421 |
1399 QuicConfig config; | 1422 QuicConfig config; |
1400 QuicTagVector options; | 1423 QuicTagVector options; |
1401 options.push_back(kPACE); | 1424 options.push_back(kPACE); |
1402 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); | 1425 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); |
1403 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_)); | 1426 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_)); |
1404 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()) | 1427 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()) |
1405 .WillOnce(Return(100 * kDefaultTCPMSS)); | 1428 .WillOnce(Return(100 * kDefaultTCPMSS)); |
1406 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); | 1429 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); |
1407 manager_.SetFromConfig(config); | 1430 manager_.SetFromConfig(config); |
1408 | 1431 |
1409 EXPECT_TRUE(manager_.using_pacing()); | 1432 EXPECT_TRUE(manager_.using_pacing()); |
1410 } | 1433 } |
1411 | 1434 |
1412 } // namespace | 1435 } // namespace |
1413 } // namespace test | 1436 } // namespace test |
1414 } // namespace net | 1437 } // namespace net |
OLD | NEW |