Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1022)

Side by Side Diff: net/quic/core/quic_sent_packet_manager_test.cc

Issue 2881623002: Do not wrap a PCC sender with a PacingSender. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/core/quic_sent_packet_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/core/quic_sent_packet_manager.h" 5 #include "net/quic/core/quic_sent_packet_manager.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "net/quic/core/quic_pending_retransmission.h" 9 #include "net/quic/core/quic_pending_retransmission.h"
10 #include "net/quic/platform/api/quic_flags.h" 10 #include "net/quic/platform/api/quic_flags.h"
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 manager_.OnIncomingAck(ack_frame, clock_.Now()); 960 manager_.OnIncomingAck(ack_frame, clock_.Now());
961 } 961 }
962 962
963 TEST_F(QuicSentPacketManagerTest, NewRetransmissionTimeout) { 963 TEST_F(QuicSentPacketManagerTest, NewRetransmissionTimeout) {
964 QuicConfig client_config; 964 QuicConfig client_config;
965 QuicTagVector options; 965 QuicTagVector options;
966 options.push_back(kNRTO); 966 options.push_back(kNRTO);
967 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT); 967 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT);
968 client_config.SetConnectionOptionsToSend(options); 968 client_config.SetConnectionOptionsToSend(options);
969 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()); 969 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
970 EXPECT_CALL(*send_algorithm_, GetCongestionControlType());
970 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); 971 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
971 EXPECT_CALL(*send_algorithm_, PacingRate(_)) 972 EXPECT_CALL(*send_algorithm_, PacingRate(_))
972 .WillRepeatedly(Return(QuicBandwidth::Zero())); 973 .WillRepeatedly(Return(QuicBandwidth::Zero()));
973 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()) 974 EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
974 .WillOnce(Return(10 * kDefaultTCPMSS)); 975 .WillOnce(Return(10 * kDefaultTCPMSS));
975 manager_.SetFromConfig(client_config); 976 manager_.SetFromConfig(client_config);
976 EXPECT_TRUE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_)); 977 EXPECT_TRUE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_));
977 978
978 // Send 100 packets. 979 // Send 100 packets.
979 const size_t kNumSentPackets = 100; 980 const size_t kNumSentPackets = 100;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 expected_time = clock_.Now() + srtt * 2 * 1.5; 1111 expected_time = clock_.Now() + srtt * 2 * 1.5;
1111 EXPECT_EQ(expected_time, manager_.GetRetransmissionTime()); 1112 EXPECT_EQ(expected_time, manager_.GetRetransmissionTime());
1112 } 1113 }
1113 1114
1114 TEST_F(QuicSentPacketManagerTest, 1115 TEST_F(QuicSentPacketManagerTest,
1115 GetConservativeTransmissionTimeCryptoHandshake) { 1116 GetConservativeTransmissionTimeCryptoHandshake) {
1116 QuicConfig config; 1117 QuicConfig config;
1117 QuicTagVector options; 1118 QuicTagVector options;
1118 options.push_back(kCONH); 1119 options.push_back(kCONH);
1119 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 1120 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1121 EXPECT_CALL(*send_algorithm_, GetCongestionControlType());
1120 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); 1122 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1121 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()); 1123 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1122 manager_.SetFromConfig(config); 1124 manager_.SetFromConfig(config);
1123 // Calling SetFromConfig requires mocking out some send algorithm methods. 1125 // Calling SetFromConfig requires mocking out some send algorithm methods.
1124 EXPECT_CALL(*send_algorithm_, PacingRate(_)) 1126 EXPECT_CALL(*send_algorithm_, PacingRate(_))
1125 .WillRepeatedly(Return(QuicBandwidth::Zero())); 1127 .WillRepeatedly(Return(QuicBandwidth::Zero()));
1126 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()) 1128 EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
1127 .WillRepeatedly(Return(10 * kDefaultTCPMSS)); 1129 .WillRepeatedly(Return(10 * kDefaultTCPMSS));
1128 1130
1129 SendCryptoPacket(1); 1131 SendCryptoPacket(1);
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1351 } 1353 }
1352 1354
1353 TEST_F(QuicSentPacketManagerTest, NegotiateTimeLossDetectionFromOptions) { 1355 TEST_F(QuicSentPacketManagerTest, NegotiateTimeLossDetectionFromOptions) {
1354 EXPECT_EQ(kNack, QuicSentPacketManagerPeer::GetLossAlgorithm(&manager_) 1356 EXPECT_EQ(kNack, QuicSentPacketManagerPeer::GetLossAlgorithm(&manager_)
1355 ->GetLossDetectionType()); 1357 ->GetLossDetectionType());
1356 1358
1357 QuicConfig config; 1359 QuicConfig config;
1358 QuicTagVector options; 1360 QuicTagVector options;
1359 options.push_back(kTIME); 1361 options.push_back(kTIME);
1360 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 1362 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1363 EXPECT_CALL(*send_algorithm_, GetCongestionControlType());
1361 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); 1364 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1362 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()); 1365 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1363 manager_.SetFromConfig(config); 1366 manager_.SetFromConfig(config);
1364 1367
1365 EXPECT_EQ(kTime, QuicSentPacketManagerPeer::GetLossAlgorithm(&manager_) 1368 EXPECT_EQ(kTime, QuicSentPacketManagerPeer::GetLossAlgorithm(&manager_)
1366 ->GetLossDetectionType()); 1369 ->GetLossDetectionType());
1367 } 1370 }
1368 1371
1369 TEST_F(QuicSentPacketManagerTest, NegotiateCongestionControlFromOptions) { 1372 TEST_F(QuicSentPacketManagerTest, NegotiateCongestionControlFromOptions) {
1370 FLAGS_quic_reloadable_flag_quic_allow_new_bbr = true; 1373 FLAGS_quic_reloadable_flag_quic_allow_new_bbr = true;
1371 QuicConfig config; 1374 QuicConfig config;
1372 QuicTagVector options; 1375 QuicTagVector options;
1373 1376
1374 options.push_back(kRENO); 1377 options.push_back(kRENO);
1375 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 1378 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1376 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()); 1379 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1377 manager_.SetFromConfig(config); 1380 manager_.SetFromConfig(config);
1378 EXPECT_EQ(kReno, QuicSentPacketManagerPeer::GetSendAlgorithm(manager_) 1381 EXPECT_EQ(kReno, QuicSentPacketManagerPeer::GetSendAlgorithm(manager_)
1379 ->GetCongestionControlType()); 1382 ->GetCongestionControlType());
1383 EXPECT_TRUE(QuicSentPacketManagerPeer::UsingPacing(&manager_));
1380 1384
1381 options.clear(); 1385 options.clear();
1382 options.push_back(kTBBR); 1386 options.push_back(kTBBR);
1383 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 1387 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1384 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()); 1388 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1385 manager_.SetFromConfig(config); 1389 manager_.SetFromConfig(config);
1386 EXPECT_EQ(kBBR, QuicSentPacketManagerPeer::GetSendAlgorithm(manager_) 1390 EXPECT_EQ(kBBR, QuicSentPacketManagerPeer::GetSendAlgorithm(manager_)
1387 ->GetCongestionControlType()); 1391 ->GetCongestionControlType());
1392 EXPECT_TRUE(QuicSentPacketManagerPeer::UsingPacing(&manager_));
1388 1393
1389 options.clear(); 1394 options.clear();
1390 options.push_back(kBYTE); 1395 options.push_back(kBYTE);
1391 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 1396 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1392 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()); 1397 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1393 manager_.SetFromConfig(config); 1398 manager_.SetFromConfig(config);
1394 EXPECT_EQ(kCubic, QuicSentPacketManagerPeer::GetSendAlgorithm(manager_) 1399 EXPECT_EQ(kCubic, QuicSentPacketManagerPeer::GetSendAlgorithm(manager_)
1395 ->GetCongestionControlType()); 1400 ->GetCongestionControlType());
1401 EXPECT_TRUE(QuicSentPacketManagerPeer::UsingPacing(&manager_));
1396 1402
1397 options.clear(); 1403 options.clear();
1398 options.push_back(kRENO); 1404 options.push_back(kRENO);
1399 options.push_back(kBYTE); 1405 options.push_back(kBYTE);
1400 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 1406 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1401 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()); 1407 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1402 manager_.SetFromConfig(config); 1408 manager_.SetFromConfig(config);
1403 EXPECT_EQ(kRenoBytes, QuicSentPacketManagerPeer::GetSendAlgorithm(manager_) 1409 EXPECT_EQ(kRenoBytes, QuicSentPacketManagerPeer::GetSendAlgorithm(manager_)
1404 ->GetCongestionControlType()); 1410 ->GetCongestionControlType());
1411 EXPECT_TRUE(QuicSentPacketManagerPeer::UsingPacing(&manager_));
1412
1413 // Test with PCC enabled and disabled.
1414 FLAGS_quic_reloadable_flag_quic_enable_pcc = false;
1415 const CongestionControlType prior_cc_type =
1416 QuicSentPacketManagerPeer::GetSendAlgorithm(manager_)
1417 ->GetCongestionControlType();
1418 options.clear();
1419 options.push_back(kTPCC);
1420 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1421 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1422 manager_.SetFromConfig(config);
1423 // No change will be made to the congestion-control algorithm.
1424 // Defaults to current type, as set in previous test.
1425 EXPECT_NE(kPCC, QuicSentPacketManagerPeer::GetSendAlgorithm(manager_)
1426 ->GetCongestionControlType());
1427 EXPECT_EQ(prior_cc_type, QuicSentPacketManagerPeer::GetSendAlgorithm(manager_)
1428 ->GetCongestionControlType());
1429 EXPECT_TRUE(QuicSentPacketManagerPeer::UsingPacing(&manager_));
1430
1431 FLAGS_quic_reloadable_flag_quic_enable_pcc = true;
1432 options.clear();
1433 options.push_back(kTPCC);
1434 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1435 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1436 manager_.SetFromConfig(config);
1437 // Don't check the tag, since the actual implementation is
1438 // platform-specific (i.e. it may be stubbed out). If the
1439 // implementation does return PCC as the type, however, make sure
1440 // that the packet manager does NOT wrap it with a PacingSender.
1441 const bool should_pace = QuicSentPacketManagerPeer::GetSendAlgorithm(manager_)
1442 ->GetCongestionControlType() != kPCC;
1443 EXPECT_EQ(should_pace, QuicSentPacketManagerPeer::UsingPacing(&manager_));
1444
1445 // Make sure that the flag for disabling pacing actually works.
1446 FLAGS_quic_disable_pacing_for_perf_tests = true;
1447 options.clear();
1448 options.push_back(kBYTE);
1449 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1450 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1451 manager_.SetFromConfig(config);
1452 EXPECT_EQ(kCubic, QuicSentPacketManagerPeer::GetSendAlgorithm(manager_)
1453 ->GetCongestionControlType());
1454 EXPECT_FALSE(QuicSentPacketManagerPeer::UsingPacing(&manager_));
1405 } 1455 }
1406 1456
1407 TEST_F(QuicSentPacketManagerTest, NegotiateClientCongestionControlFromOptions) { 1457 TEST_F(QuicSentPacketManagerTest, NegotiateClientCongestionControlFromOptions) {
1408 FLAGS_quic_reloadable_flag_quic_allow_new_bbr = true; 1458 FLAGS_quic_reloadable_flag_quic_allow_new_bbr = true;
1459 FLAGS_quic_reloadable_flag_quic_enable_pcc = true;
1409 QuicConfig config; 1460 QuicConfig config;
1410 QuicTagVector options; 1461 QuicTagVector options;
1411 1462
1412 // No change if the server receives client options. 1463 // No change if the server receives client options.
1413 const SendAlgorithmInterface* mock_sender = 1464 const SendAlgorithmInterface* mock_sender =
1414 QuicSentPacketManagerPeer::GetSendAlgorithm(manager_); 1465 QuicSentPacketManagerPeer::GetSendAlgorithm(manager_);
1415 options.push_back(kRENO); 1466 options.push_back(kRENO);
1416 config.SetClientConnectionOptions(options); 1467 config.SetClientConnectionOptions(options);
1468 EXPECT_CALL(*send_algorithm_, GetCongestionControlType());
1417 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); 1469 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1418 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()); 1470 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1419 manager_.SetFromConfig(config); 1471 manager_.SetFromConfig(config);
1420 EXPECT_EQ(mock_sender, QuicSentPacketManagerPeer::GetSendAlgorithm(manager_)); 1472 EXPECT_EQ(mock_sender, QuicSentPacketManagerPeer::GetSendAlgorithm(manager_));
1421 1473
1422 // Change the congestion control on the client with client options. 1474 // Change the congestion control on the client with client options.
1423 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT); 1475 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT);
1424 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()); 1476 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1425 manager_.SetFromConfig(config); 1477 manager_.SetFromConfig(config);
1426 EXPECT_EQ(kReno, QuicSentPacketManagerPeer::GetSendAlgorithm(manager_) 1478 EXPECT_EQ(kReno, QuicSentPacketManagerPeer::GetSendAlgorithm(manager_)
(...skipping 26 matching lines...) Expand all
1453 } 1505 }
1454 1506
1455 TEST_F(QuicSentPacketManagerTest, NegotiateNumConnectionsFromOptions) { 1507 TEST_F(QuicSentPacketManagerTest, NegotiateNumConnectionsFromOptions) {
1456 QuicConfig config; 1508 QuicConfig config;
1457 QuicTagVector options; 1509 QuicTagVector options;
1458 1510
1459 options.push_back(k1CON); 1511 options.push_back(k1CON);
1460 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 1512 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1461 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()); 1513 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1462 EXPECT_CALL(*send_algorithm_, SetNumEmulatedConnections(1)); 1514 EXPECT_CALL(*send_algorithm_, SetNumEmulatedConnections(1));
1515 EXPECT_CALL(*send_algorithm_, GetCongestionControlType());
1463 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); 1516 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1464 manager_.SetFromConfig(config); 1517 manager_.SetFromConfig(config);
1465 1518
1466 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT); 1519 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT);
1467 QuicConfig client_config; 1520 QuicConfig client_config;
1468 client_config.SetConnectionOptionsToSend(options); 1521 client_config.SetConnectionOptionsToSend(options);
1469 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()); 1522 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1470 EXPECT_CALL(*send_algorithm_, SetNumEmulatedConnections(1)); 1523 EXPECT_CALL(*send_algorithm_, SetNumEmulatedConnections(1));
1524 EXPECT_CALL(*send_algorithm_, GetCongestionControlType());
1471 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); 1525 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1472 manager_.SetFromConfig(client_config); 1526 manager_.SetFromConfig(client_config);
1473 } 1527 }
1474 1528
1475 TEST_F(QuicSentPacketManagerTest, NegotiateNConnectionFromOptions) { 1529 TEST_F(QuicSentPacketManagerTest, NegotiateNConnectionFromOptions) {
1476 // By default, changing the number of open streams does nothing. 1530 // By default, changing the number of open streams does nothing.
1477 manager_.SetNumOpenStreams(5); 1531 manager_.SetNumOpenStreams(5);
1478 1532
1479 QuicConfig config; 1533 QuicConfig config;
1480 QuicTagVector options; 1534 QuicTagVector options;
1481 1535
1482 options.push_back(kNCON); 1536 options.push_back(kNCON);
1483 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 1537 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1484 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()); 1538 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1539 EXPECT_CALL(*send_algorithm_, GetCongestionControlType());
1485 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); 1540 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1486 manager_.SetFromConfig(config); 1541 manager_.SetFromConfig(config);
1487 1542
1488 EXPECT_CALL(*send_algorithm_, SetNumEmulatedConnections(5)); 1543 EXPECT_CALL(*send_algorithm_, SetNumEmulatedConnections(5));
1489 manager_.SetNumOpenStreams(5); 1544 manager_.SetNumOpenStreams(5);
1490 } 1545 }
1491 1546
1492 TEST_F(QuicSentPacketManagerTest, NegotiateNoTLPFromOptionsAtServer) { 1547 TEST_F(QuicSentPacketManagerTest, NegotiateNoTLPFromOptionsAtServer) {
1493 QuicConfig config; 1548 QuicConfig config;
1494 QuicTagVector options; 1549 QuicTagVector options;
1495 1550
1496 options.push_back(kNTLP); 1551 options.push_back(kNTLP);
1497 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 1552 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1498 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()); 1553 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1554 EXPECT_CALL(*send_algorithm_, GetCongestionControlType());
1499 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); 1555 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1500 manager_.SetFromConfig(config); 1556 manager_.SetFromConfig(config);
1501 EXPECT_EQ(0u, QuicSentPacketManagerPeer::GetMaxTailLossProbes(&manager_)); 1557 EXPECT_EQ(0u, QuicSentPacketManagerPeer::GetMaxTailLossProbes(&manager_));
1502 } 1558 }
1503 1559
1504 TEST_F(QuicSentPacketManagerTest, NegotiateNoTLPFromOptionsAtClient) { 1560 TEST_F(QuicSentPacketManagerTest, NegotiateNoTLPFromOptionsAtClient) {
1505 QuicConfig client_config; 1561 QuicConfig client_config;
1506 QuicTagVector options; 1562 QuicTagVector options;
1507 1563
1508 options.push_back(kNTLP); 1564 options.push_back(kNTLP);
1509 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT); 1565 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT);
1510 client_config.SetConnectionOptionsToSend(options); 1566 client_config.SetConnectionOptionsToSend(options);
1511 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()); 1567 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1568 EXPECT_CALL(*send_algorithm_, GetCongestionControlType());
1512 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); 1569 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1513 manager_.SetFromConfig(client_config); 1570 manager_.SetFromConfig(client_config);
1514 EXPECT_EQ(0u, QuicSentPacketManagerPeer::GetMaxTailLossProbes(&manager_)); 1571 EXPECT_EQ(0u, QuicSentPacketManagerPeer::GetMaxTailLossProbes(&manager_));
1515 } 1572 }
1516 1573
1517 TEST_F(QuicSentPacketManagerTest, NegotiateTLPRttFromOptionsAtServer) { 1574 TEST_F(QuicSentPacketManagerTest, NegotiateTLPRttFromOptionsAtServer) {
1518 QuicConfig config; 1575 QuicConfig config;
1519 QuicTagVector options; 1576 QuicTagVector options;
1520 1577
1521 options.push_back(kTLPR); 1578 options.push_back(kTLPR);
1522 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 1579 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1523 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()); 1580 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1581 EXPECT_CALL(*send_algorithm_, GetCongestionControlType());
1524 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); 1582 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1525 manager_.SetFromConfig(config); 1583 manager_.SetFromConfig(config);
1526 EXPECT_TRUE( 1584 EXPECT_TRUE(
1527 QuicSentPacketManagerPeer::GetEnableHalfRttTailLossProbe(&manager_)); 1585 QuicSentPacketManagerPeer::GetEnableHalfRttTailLossProbe(&manager_));
1528 } 1586 }
1529 1587
1530 TEST_F(QuicSentPacketManagerTest, NegotiateTLPRttFromOptionsAtClient) { 1588 TEST_F(QuicSentPacketManagerTest, NegotiateTLPRttFromOptionsAtClient) {
1531 QuicConfig client_config; 1589 QuicConfig client_config;
1532 QuicTagVector options; 1590 QuicTagVector options;
1533 1591
1534 options.push_back(kTLPR); 1592 options.push_back(kTLPR);
1535 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT); 1593 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT);
1536 client_config.SetConnectionOptionsToSend(options); 1594 client_config.SetConnectionOptionsToSend(options);
1537 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()); 1595 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1596 EXPECT_CALL(*send_algorithm_, GetCongestionControlType());
1538 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); 1597 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1539 manager_.SetFromConfig(client_config); 1598 manager_.SetFromConfig(client_config);
1540 EXPECT_TRUE( 1599 EXPECT_TRUE(
1541 QuicSentPacketManagerPeer::GetEnableHalfRttTailLossProbe(&manager_)); 1600 QuicSentPacketManagerPeer::GetEnableHalfRttTailLossProbe(&manager_));
1542 } 1601 }
1543 1602
1544 TEST_F(QuicSentPacketManagerTest, NegotiateNewRTOFromOptionsAtServer) { 1603 TEST_F(QuicSentPacketManagerTest, NegotiateNewRTOFromOptionsAtServer) {
1545 EXPECT_FALSE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_)); 1604 EXPECT_FALSE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_));
1546 QuicConfig config; 1605 QuicConfig config;
1547 QuicTagVector options; 1606 QuicTagVector options;
1548 1607
1549 options.push_back(kNRTO); 1608 options.push_back(kNRTO);
1550 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 1609 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1551 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()); 1610 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1611 EXPECT_CALL(*send_algorithm_, GetCongestionControlType());
1552 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); 1612 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1553 manager_.SetFromConfig(config); 1613 manager_.SetFromConfig(config);
1554 EXPECT_TRUE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_)); 1614 EXPECT_TRUE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_));
1555 } 1615 }
1556 1616
1557 TEST_F(QuicSentPacketManagerTest, NegotiateNewRTOFromOptionsAtClient) { 1617 TEST_F(QuicSentPacketManagerTest, NegotiateNewRTOFromOptionsAtClient) {
1558 EXPECT_FALSE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_)); 1618 EXPECT_FALSE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_));
1559 QuicConfig client_config; 1619 QuicConfig client_config;
1560 QuicTagVector options; 1620 QuicTagVector options;
1561 1621
1562 options.push_back(kNRTO); 1622 options.push_back(kNRTO);
1563 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT); 1623 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT);
1564 client_config.SetConnectionOptionsToSend(options); 1624 client_config.SetConnectionOptionsToSend(options);
1565 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()); 1625 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1626 EXPECT_CALL(*send_algorithm_, GetCongestionControlType());
1566 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); 1627 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1567 manager_.SetFromConfig(client_config); 1628 manager_.SetFromConfig(client_config);
1568 EXPECT_TRUE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_)); 1629 EXPECT_TRUE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_));
1569 } 1630 }
1570 1631
1571 TEST_F(QuicSentPacketManagerTest, NegotiateUndoFromOptionsAtServer) { 1632 TEST_F(QuicSentPacketManagerTest, NegotiateUndoFromOptionsAtServer) {
1572 EXPECT_FALSE(QuicSentPacketManagerPeer::GetUndoRetransmits(&manager_)); 1633 EXPECT_FALSE(QuicSentPacketManagerPeer::GetUndoRetransmits(&manager_));
1573 QuicConfig config; 1634 QuicConfig config;
1574 QuicTagVector options; 1635 QuicTagVector options;
1575 1636
1576 options.push_back(kUNDO); 1637 options.push_back(kUNDO);
1577 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 1638 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1578 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()); 1639 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1640 EXPECT_CALL(*send_algorithm_, GetCongestionControlType());
1579 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); 1641 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1580 manager_.SetFromConfig(config); 1642 manager_.SetFromConfig(config);
1581 EXPECT_TRUE(QuicSentPacketManagerPeer::GetUndoRetransmits(&manager_)); 1643 EXPECT_TRUE(QuicSentPacketManagerPeer::GetUndoRetransmits(&manager_));
1582 1644
1583 // Ensure undo works as intended. 1645 // Ensure undo works as intended.
1584 // Send 5 packets, mark the first 4 for retransmission, and then cancel 1646 // Send 5 packets, mark the first 4 for retransmission, and then cancel
1585 // them when 1 is acked. 1647 // them when 1 is acked.
1586 EXPECT_CALL(*send_algorithm_, PacingRate(_)) 1648 EXPECT_CALL(*send_algorithm_, PacingRate(_))
1587 .WillRepeatedly(Return(QuicBandwidth::Zero())); 1649 .WillRepeatedly(Return(QuicBandwidth::Zero()));
1588 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()) 1650 EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1621 1683
1622 TEST_F(QuicSentPacketManagerTest, NegotiateUndoFromOptionsAtClient) { 1684 TEST_F(QuicSentPacketManagerTest, NegotiateUndoFromOptionsAtClient) {
1623 EXPECT_FALSE(QuicSentPacketManagerPeer::GetUndoRetransmits(&manager_)); 1685 EXPECT_FALSE(QuicSentPacketManagerPeer::GetUndoRetransmits(&manager_));
1624 QuicConfig client_config; 1686 QuicConfig client_config;
1625 QuicTagVector options; 1687 QuicTagVector options;
1626 1688
1627 options.push_back(kUNDO); 1689 options.push_back(kUNDO);
1628 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT); 1690 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT);
1629 client_config.SetConnectionOptionsToSend(options); 1691 client_config.SetConnectionOptionsToSend(options);
1630 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()); 1692 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1693 EXPECT_CALL(*send_algorithm_, GetCongestionControlType());
1631 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); 1694 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1632 manager_.SetFromConfig(client_config); 1695 manager_.SetFromConfig(client_config);
1633 EXPECT_TRUE(QuicSentPacketManagerPeer::GetUndoRetransmits(&manager_)); 1696 EXPECT_TRUE(QuicSentPacketManagerPeer::GetUndoRetransmits(&manager_));
1634 } 1697 }
1635 1698
1636 TEST_F(QuicSentPacketManagerTest, UseInitialRoundTripTimeToSend) { 1699 TEST_F(QuicSentPacketManagerTest, UseInitialRoundTripTimeToSend) {
1637 uint32_t initial_rtt_us = 325000; 1700 uint32_t initial_rtt_us = 325000;
1638 EXPECT_NE(initial_rtt_us, 1701 EXPECT_NE(initial_rtt_us,
1639 manager_.GetRttStats()->smoothed_rtt().ToMicroseconds()); 1702 manager_.GetRttStats()->smoothed_rtt().ToMicroseconds());
1640 1703
1641 QuicConfig config; 1704 QuicConfig config;
1642 config.SetInitialRoundTripTimeUsToSend(initial_rtt_us); 1705 config.SetInitialRoundTripTimeUsToSend(initial_rtt_us);
1706 EXPECT_CALL(*send_algorithm_, GetCongestionControlType());
1643 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); 1707 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1644 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()); 1708 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1645 manager_.SetFromConfig(config); 1709 manager_.SetFromConfig(config);
1646 1710
1647 EXPECT_EQ(0, manager_.GetRttStats()->smoothed_rtt().ToMicroseconds()); 1711 EXPECT_EQ(0, manager_.GetRttStats()->smoothed_rtt().ToMicroseconds());
1648 EXPECT_EQ(initial_rtt_us, manager_.GetRttStats()->initial_rtt_us()); 1712 EXPECT_EQ(initial_rtt_us, manager_.GetRttStats()->initial_rtt_us());
1649 } 1713 }
1650 1714
1651 TEST_F(QuicSentPacketManagerTest, ResumeConnectionState) { 1715 TEST_F(QuicSentPacketManagerTest, ResumeConnectionState) {
1652 // The sent packet manager should use the RTT from CachedNetworkParameters if 1716 // The sent packet manager should use the RTT from CachedNetworkParameters if
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1729 ExpectAck(1); 1793 ExpectAck(1);
1730 EXPECT_CALL(*network_change_visitor_, 1794 EXPECT_CALL(*network_change_visitor_,
1731 OnPathMtuIncreased(kDefaultLength + 100)); 1795 OnPathMtuIncreased(kDefaultLength + 100));
1732 QuicAckFrame ack_frame = InitAckFrame(1); 1796 QuicAckFrame ack_frame = InitAckFrame(1);
1733 manager_.OnIncomingAck(ack_frame, clock_.Now()); 1797 manager_.OnIncomingAck(ack_frame, clock_.Now());
1734 } 1798 }
1735 1799
1736 } // namespace 1800 } // namespace
1737 } // namespace test 1801 } // namespace test
1738 } // namespace net 1802 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_sent_packet_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698