| 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 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1348 QuicConfig client_config; | 1348 QuicConfig client_config; |
| 1349 client_config.SetConnectionOptionsToSend(options); | 1349 client_config.SetConnectionOptionsToSend(options); |
| 1350 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_)); | 1350 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_)); |
| 1351 EXPECT_CALL(*send_algorithm_, SetNumEmulatedConnections(1)); | 1351 EXPECT_CALL(*send_algorithm_, SetNumEmulatedConnections(1)); |
| 1352 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()) | 1352 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()) |
| 1353 .WillOnce(Return(100 * kDefaultTCPMSS)); | 1353 .WillOnce(Return(100 * kDefaultTCPMSS)); |
| 1354 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); | 1354 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); |
| 1355 manager_.SetFromConfig(client_config); | 1355 manager_.SetFromConfig(client_config); |
| 1356 } | 1356 } |
| 1357 | 1357 |
| 1358 TEST_F(QuicSentPacketManagerTest, NegotiateNoTLPFromOptionsAtServer) { |
| 1359 QuicConfig config; |
| 1360 QuicTagVector options; |
| 1361 |
| 1362 options.push_back(kNTLP); |
| 1363 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); |
| 1364 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_)); |
| 1365 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()) |
| 1366 .WillOnce(Return(100 * kDefaultTCPMSS)); |
| 1367 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); |
| 1368 manager_.SetFromConfig(config); |
| 1369 EXPECT_EQ(0u, QuicSentPacketManagerPeer::GetMaxTailLossProbes(&manager_)); |
| 1370 } |
| 1371 |
| 1372 TEST_F(QuicSentPacketManagerTest, NegotiateNoTLPFromOptionsAtClient) { |
| 1373 QuicConfig client_config; |
| 1374 QuicTagVector options; |
| 1375 |
| 1376 options.push_back(kNTLP); |
| 1377 QuicSentPacketManagerPeer::SetIsServer(&manager_, false); |
| 1378 client_config.SetConnectionOptionsToSend(options); |
| 1379 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_)); |
| 1380 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()) |
| 1381 .WillOnce(Return(100 * kDefaultTCPMSS)); |
| 1382 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); |
| 1383 manager_.SetFromConfig(client_config); |
| 1384 EXPECT_EQ(0u, QuicSentPacketManagerPeer::GetMaxTailLossProbes(&manager_)); |
| 1385 } |
| 1386 |
| 1358 TEST_F(QuicSentPacketManagerTest, NegotiatePacingFromOptions) { | 1387 TEST_F(QuicSentPacketManagerTest, NegotiatePacingFromOptions) { |
| 1359 EXPECT_FALSE(manager_.using_pacing()); | 1388 EXPECT_FALSE(manager_.using_pacing()); |
| 1360 | 1389 |
| 1361 QuicConfig config; | 1390 QuicConfig config; |
| 1362 QuicTagVector options; | 1391 QuicTagVector options; |
| 1363 options.push_back(kPACE); | 1392 options.push_back(kPACE); |
| 1364 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); | 1393 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); |
| 1365 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_)); | 1394 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_)); |
| 1366 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()) | 1395 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()) |
| 1367 .WillOnce(Return(100 * kDefaultTCPMSS)); | 1396 .WillOnce(Return(100 * kDefaultTCPMSS)); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1384 .WillOnce(Return(100 * kDefaultTCPMSS)); | 1413 .WillOnce(Return(100 * kDefaultTCPMSS)); |
| 1385 manager_.SetFromConfig(config); | 1414 manager_.SetFromConfig(config); |
| 1386 | 1415 |
| 1387 EXPECT_EQ(initial_rtt_us, | 1416 EXPECT_EQ(initial_rtt_us, |
| 1388 manager_.GetRttStats()->SmoothedRtt().ToMicroseconds()); | 1417 manager_.GetRttStats()->SmoothedRtt().ToMicroseconds()); |
| 1389 } | 1418 } |
| 1390 | 1419 |
| 1391 } // namespace | 1420 } // namespace |
| 1392 } // namespace test | 1421 } // namespace test |
| 1393 } // namespace net | 1422 } // namespace net |
| OLD | NEW |