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 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1322 options.clear(); | 1322 options.clear(); |
1323 options.push_back(kTBBR); | 1323 options.push_back(kTBBR); |
1324 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); | 1324 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); |
1325 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_)); | 1325 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_)); |
1326 manager_.SetFromConfig(config); | 1326 manager_.SetFromConfig(config); |
1327 EXPECT_EQ(kBBR, QuicSentPacketManagerPeer::GetCongestionControlAlgorithm( | 1327 EXPECT_EQ(kBBR, QuicSentPacketManagerPeer::GetCongestionControlAlgorithm( |
1328 manager_)->GetCongestionControlType()); | 1328 manager_)->GetCongestionControlType()); |
1329 #endif | 1329 #endif |
1330 } | 1330 } |
1331 | 1331 |
| 1332 TEST_F(QuicSentPacketManagerTest, NegotiateNumConnectionsFromOptions) { |
| 1333 QuicConfig config; |
| 1334 QuicTagVector options; |
| 1335 |
| 1336 options.push_back(k1CON); |
| 1337 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); |
| 1338 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_)); |
| 1339 EXPECT_CALL(*send_algorithm_, SetNumEmulatedConnections(1)); |
| 1340 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()) |
| 1341 .WillOnce(Return(100 * kDefaultTCPMSS)); |
| 1342 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); |
| 1343 manager_.SetFromConfig(config); |
| 1344 |
| 1345 QuicSentPacketManagerPeer::SetIsServer(&manager_, false); |
| 1346 QuicConfig client_config; |
| 1347 client_config.SetConnectionOptionsToSend(options); |
| 1348 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_)); |
| 1349 EXPECT_CALL(*send_algorithm_, SetNumEmulatedConnections(1)); |
| 1350 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()) |
| 1351 .WillOnce(Return(100 * kDefaultTCPMSS)); |
| 1352 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); |
| 1353 manager_.SetFromConfig(client_config); |
| 1354 } |
| 1355 |
1332 TEST_F(QuicSentPacketManagerTest, NegotiatePacingFromOptions) { | 1356 TEST_F(QuicSentPacketManagerTest, NegotiatePacingFromOptions) { |
1333 EXPECT_FALSE(manager_.using_pacing()); | 1357 EXPECT_FALSE(manager_.using_pacing()); |
1334 | 1358 |
1335 QuicConfig config; | 1359 QuicConfig config; |
1336 QuicTagVector options; | 1360 QuicTagVector options; |
1337 options.push_back(kPACE); | 1361 options.push_back(kPACE); |
1338 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); | 1362 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); |
1339 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_)); | 1363 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_)); |
1340 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()) | 1364 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()) |
1341 .WillOnce(Return(100 * kDefaultTCPMSS)); | 1365 .WillOnce(Return(100 * kDefaultTCPMSS)); |
(...skipping 16 matching lines...) Expand all Loading... |
1358 .WillOnce(Return(100 * kDefaultTCPMSS)); | 1382 .WillOnce(Return(100 * kDefaultTCPMSS)); |
1359 manager_.SetFromConfig(config); | 1383 manager_.SetFromConfig(config); |
1360 | 1384 |
1361 EXPECT_EQ(initial_rtt_us, | 1385 EXPECT_EQ(initial_rtt_us, |
1362 manager_.GetRttStats()->SmoothedRtt().ToMicroseconds()); | 1386 manager_.GetRttStats()->SmoothedRtt().ToMicroseconds()); |
1363 } | 1387 } |
1364 | 1388 |
1365 } // namespace | 1389 } // namespace |
1366 } // namespace test | 1390 } // namespace test |
1367 } // namespace net | 1391 } // namespace net |
OLD | NEW |