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, NegotiateNConnectionFromOptions) { |
| 1359 // By default, changing the number of open streams does nothing. |
| 1360 manager_.SetNumOpenStreams(5); |
| 1361 |
| 1362 QuicConfig config; |
| 1363 QuicTagVector options; |
| 1364 |
| 1365 options.push_back(kNCON); |
| 1366 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); |
| 1367 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_)); |
| 1368 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()) |
| 1369 .WillOnce(Return(100 * kDefaultTCPMSS)); |
| 1370 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); |
| 1371 manager_.SetFromConfig(config); |
| 1372 |
| 1373 EXPECT_CALL(*send_algorithm_, SetNumEmulatedConnections(5)); |
| 1374 manager_.SetNumOpenStreams(5); |
| 1375 } |
| 1376 |
1358 TEST_F(QuicSentPacketManagerTest, NegotiateNoTLPFromOptionsAtServer) { | 1377 TEST_F(QuicSentPacketManagerTest, NegotiateNoTLPFromOptionsAtServer) { |
1359 QuicConfig config; | 1378 QuicConfig config; |
1360 QuicTagVector options; | 1379 QuicTagVector options; |
1361 | 1380 |
1362 options.push_back(kNTLP); | 1381 options.push_back(kNTLP); |
1363 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); | 1382 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); |
1364 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_)); | 1383 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_)); |
1365 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()) | 1384 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()) |
1366 .WillOnce(Return(100 * kDefaultTCPMSS)); | 1385 .WillOnce(Return(100 * kDefaultTCPMSS)); |
1367 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); | 1386 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1446 .WillOnce(Return(100 * kDefaultTCPMSS)); | 1465 .WillOnce(Return(100 * kDefaultTCPMSS)); |
1447 manager_.SetFromConfig(config); | 1466 manager_.SetFromConfig(config); |
1448 | 1467 |
1449 EXPECT_EQ(initial_rtt_us, | 1468 EXPECT_EQ(initial_rtt_us, |
1450 manager_.GetRttStats()->SmoothedRtt().ToMicroseconds()); | 1469 manager_.GetRttStats()->SmoothedRtt().ToMicroseconds()); |
1451 } | 1470 } |
1452 | 1471 |
1453 } // namespace | 1472 } // namespace |
1454 } // namespace test | 1473 } // namespace test |
1455 } // namespace net | 1474 } // namespace net |
OLD | NEW |