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

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

Issue 1048493002: Remove the using_pacing argument from QuicSentPacketManager::SetFromConfig because it's always true. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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/quic_sent_packet_manager.cc ('k') | net/quic/test_tools/quic_test_utils.h » ('j') | 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/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 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 } 1145 }
1146 1146
1147 TEST_F(QuicSentPacketManagerTest, NewRetransmissionTimeout) { 1147 TEST_F(QuicSentPacketManagerTest, NewRetransmissionTimeout) {
1148 QuicConfig client_config; 1148 QuicConfig client_config;
1149 QuicTagVector options; 1149 QuicTagVector options;
1150 options.push_back(kNRTO); 1150 options.push_back(kNRTO);
1151 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT); 1151 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT);
1152 client_config.SetConnectionOptionsToSend(options); 1152 client_config.SetConnectionOptionsToSend(options);
1153 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 1153 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
1154 EXPECT_CALL(*network_change_visitor_, OnRttChange()); 1154 EXPECT_CALL(*network_change_visitor_, OnRttChange());
1155 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)); 1155 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1156 EXPECT_CALL(*send_algorithm_, PacingRate()) 1156 EXPECT_CALL(*send_algorithm_, PacingRate())
1157 .WillRepeatedly(Return(QuicBandwidth::Zero())); 1157 .WillRepeatedly(Return(QuicBandwidth::Zero()));
1158 manager_.SetFromConfig(client_config); 1158 manager_.SetFromConfig(client_config);
1159 EXPECT_TRUE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_)); 1159 EXPECT_TRUE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_));
1160 1160
1161 // Send 100 packets. 1161 // Send 100 packets.
1162 const size_t kNumSentPackets = 100; 1162 const size_t kNumSentPackets = 100;
1163 for (size_t i = 1; i <= kNumSentPackets; ++i) { 1163 for (size_t i = 1; i <= kNumSentPackets; ++i) {
1164 SendDataPacket(i); 1164 SendDataPacket(i);
1165 } 1165 }
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 1456
1457 TEST_F(QuicSentPacketManagerTest, NegotiateTimeLossDetectionFromOptions) { 1457 TEST_F(QuicSentPacketManagerTest, NegotiateTimeLossDetectionFromOptions) {
1458 EXPECT_EQ(kNack, 1458 EXPECT_EQ(kNack,
1459 QuicSentPacketManagerPeer::GetLossAlgorithm( 1459 QuicSentPacketManagerPeer::GetLossAlgorithm(
1460 &manager_)->GetLossDetectionType()); 1460 &manager_)->GetLossDetectionType());
1461 1461
1462 QuicConfig config; 1462 QuicConfig config;
1463 QuicTagVector options; 1463 QuicTagVector options;
1464 options.push_back(kTIME); 1464 options.push_back(kTIME);
1465 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 1465 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1466 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)); 1466 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1467 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 1467 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
1468 EXPECT_CALL(*network_change_visitor_, OnRttChange()); 1468 EXPECT_CALL(*network_change_visitor_, OnRttChange());
1469 manager_.SetFromConfig(config); 1469 manager_.SetFromConfig(config);
1470 1470
1471 EXPECT_EQ(kTime, 1471 EXPECT_EQ(kTime,
1472 QuicSentPacketManagerPeer::GetLossAlgorithm( 1472 QuicSentPacketManagerPeer::GetLossAlgorithm(
1473 &manager_)->GetLossDetectionType()); 1473 &manager_)->GetLossDetectionType());
1474 } 1474 }
1475 1475
1476 TEST_F(QuicSentPacketManagerTest, NegotiateCongestionControlFromOptions) { 1476 TEST_F(QuicSentPacketManagerTest, NegotiateCongestionControlFromOptions) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1520 1520
1521 TEST_F(QuicSentPacketManagerTest, NegotiateNumConnectionsFromOptions) { 1521 TEST_F(QuicSentPacketManagerTest, NegotiateNumConnectionsFromOptions) {
1522 QuicConfig config; 1522 QuicConfig config;
1523 QuicTagVector options; 1523 QuicTagVector options;
1524 1524
1525 options.push_back(k1CON); 1525 options.push_back(k1CON);
1526 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 1526 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1527 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 1527 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
1528 EXPECT_CALL(*network_change_visitor_, OnRttChange()); 1528 EXPECT_CALL(*network_change_visitor_, OnRttChange());
1529 EXPECT_CALL(*send_algorithm_, SetNumEmulatedConnections(1)); 1529 EXPECT_CALL(*send_algorithm_, SetNumEmulatedConnections(1));
1530 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)); 1530 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1531 manager_.SetFromConfig(config); 1531 manager_.SetFromConfig(config);
1532 1532
1533 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT); 1533 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT);
1534 QuicConfig client_config; 1534 QuicConfig client_config;
1535 client_config.SetConnectionOptionsToSend(options); 1535 client_config.SetConnectionOptionsToSend(options);
1536 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 1536 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
1537 EXPECT_CALL(*network_change_visitor_, OnRttChange()); 1537 EXPECT_CALL(*network_change_visitor_, OnRttChange());
1538 EXPECT_CALL(*send_algorithm_, SetNumEmulatedConnections(1)); 1538 EXPECT_CALL(*send_algorithm_, SetNumEmulatedConnections(1));
1539 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)); 1539 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1540 manager_.SetFromConfig(client_config); 1540 manager_.SetFromConfig(client_config);
1541 } 1541 }
1542 1542
1543 TEST_F(QuicSentPacketManagerTest, NegotiateNConnectionFromOptions) { 1543 TEST_F(QuicSentPacketManagerTest, NegotiateNConnectionFromOptions) {
1544 // By default, changing the number of open streams does nothing. 1544 // By default, changing the number of open streams does nothing.
1545 manager_.SetNumOpenStreams(5); 1545 manager_.SetNumOpenStreams(5);
1546 1546
1547 QuicConfig config; 1547 QuicConfig config;
1548 QuicTagVector options; 1548 QuicTagVector options;
1549 1549
1550 options.push_back(kNCON); 1550 options.push_back(kNCON);
1551 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 1551 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1552 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 1552 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
1553 EXPECT_CALL(*network_change_visitor_, OnRttChange()); 1553 EXPECT_CALL(*network_change_visitor_, OnRttChange());
1554 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)); 1554 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1555 manager_.SetFromConfig(config); 1555 manager_.SetFromConfig(config);
1556 1556
1557 EXPECT_CALL(*send_algorithm_, SetNumEmulatedConnections(5)); 1557 EXPECT_CALL(*send_algorithm_, SetNumEmulatedConnections(5));
1558 manager_.SetNumOpenStreams(5); 1558 manager_.SetNumOpenStreams(5);
1559 } 1559 }
1560 1560
1561 TEST_F(QuicSentPacketManagerTest, NegotiateNoTLPFromOptionsAtServer) { 1561 TEST_F(QuicSentPacketManagerTest, NegotiateNoTLPFromOptionsAtServer) {
1562 QuicConfig config; 1562 QuicConfig config;
1563 QuicTagVector options; 1563 QuicTagVector options;
1564 1564
1565 options.push_back(kNTLP); 1565 options.push_back(kNTLP);
1566 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 1566 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1567 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 1567 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
1568 EXPECT_CALL(*network_change_visitor_, OnRttChange()); 1568 EXPECT_CALL(*network_change_visitor_, OnRttChange());
1569 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)); 1569 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1570 manager_.SetFromConfig(config); 1570 manager_.SetFromConfig(config);
1571 EXPECT_EQ(0u, QuicSentPacketManagerPeer::GetMaxTailLossProbes(&manager_)); 1571 EXPECT_EQ(0u, QuicSentPacketManagerPeer::GetMaxTailLossProbes(&manager_));
1572 } 1572 }
1573 1573
1574 TEST_F(QuicSentPacketManagerTest, NegotiateNoTLPFromOptionsAtClient) { 1574 TEST_F(QuicSentPacketManagerTest, NegotiateNoTLPFromOptionsAtClient) {
1575 QuicConfig client_config; 1575 QuicConfig client_config;
1576 QuicTagVector options; 1576 QuicTagVector options;
1577 1577
1578 options.push_back(kNTLP); 1578 options.push_back(kNTLP);
1579 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT); 1579 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT);
1580 client_config.SetConnectionOptionsToSend(options); 1580 client_config.SetConnectionOptionsToSend(options);
1581 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 1581 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
1582 EXPECT_CALL(*network_change_visitor_, OnRttChange()); 1582 EXPECT_CALL(*network_change_visitor_, OnRttChange());
1583 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)); 1583 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1584 manager_.SetFromConfig(client_config); 1584 manager_.SetFromConfig(client_config);
1585 EXPECT_EQ(0u, QuicSentPacketManagerPeer::GetMaxTailLossProbes(&manager_)); 1585 EXPECT_EQ(0u, QuicSentPacketManagerPeer::GetMaxTailLossProbes(&manager_));
1586 } 1586 }
1587 1587
1588 TEST_F(QuicSentPacketManagerTest, NegotiateNewRTOFromOptionsAtServer) { 1588 TEST_F(QuicSentPacketManagerTest, NegotiateNewRTOFromOptionsAtServer) {
1589 EXPECT_FALSE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_)); 1589 EXPECT_FALSE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_));
1590 QuicConfig config; 1590 QuicConfig config;
1591 QuicTagVector options; 1591 QuicTagVector options;
1592 1592
1593 options.push_back(kNRTO); 1593 options.push_back(kNRTO);
1594 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 1594 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1595 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 1595 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
1596 EXPECT_CALL(*network_change_visitor_, OnRttChange()); 1596 EXPECT_CALL(*network_change_visitor_, OnRttChange());
1597 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)); 1597 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1598 manager_.SetFromConfig(config); 1598 manager_.SetFromConfig(config);
1599 EXPECT_TRUE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_)); 1599 EXPECT_TRUE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_));
1600 } 1600 }
1601 1601
1602 TEST_F(QuicSentPacketManagerTest, NegotiateNewRTOFromOptionsAtClient) { 1602 TEST_F(QuicSentPacketManagerTest, NegotiateNewRTOFromOptionsAtClient) {
1603 EXPECT_FALSE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_)); 1603 EXPECT_FALSE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_));
1604 QuicConfig client_config; 1604 QuicConfig client_config;
1605 QuicTagVector options; 1605 QuicTagVector options;
1606 1606
1607 options.push_back(kNRTO); 1607 options.push_back(kNRTO);
1608 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT); 1608 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT);
1609 client_config.SetConnectionOptionsToSend(options); 1609 client_config.SetConnectionOptionsToSend(options);
1610 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 1610 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
1611 EXPECT_CALL(*network_change_visitor_, OnRttChange()); 1611 EXPECT_CALL(*network_change_visitor_, OnRttChange());
1612 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)); 1612 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1613 manager_.SetFromConfig(client_config); 1613 manager_.SetFromConfig(client_config);
1614 EXPECT_TRUE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_)); 1614 EXPECT_TRUE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_));
1615 } 1615 }
1616 1616
1617 TEST_F(QuicSentPacketManagerTest, NegotiatePacingFromOptions) {
1618 EXPECT_FALSE(manager_.using_pacing());
1619
1620 QuicConfig config;
1621 QuicTagVector options;
1622 options.push_back(kPACE);
1623 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1624 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
1625 EXPECT_CALL(*network_change_visitor_, OnRttChange());
1626 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, /*using_pacing=*/true));
1627 manager_.SetFromConfig(config);
1628
1629 EXPECT_TRUE(manager_.using_pacing());
1630 }
1631
1632 TEST_F(QuicSentPacketManagerTest, NegotiateReceiveWindowFromOptions) { 1617 TEST_F(QuicSentPacketManagerTest, NegotiateReceiveWindowFromOptions) {
1633 EXPECT_EQ(kDefaultSocketReceiveBuffer, 1618 EXPECT_EQ(kDefaultSocketReceiveBuffer,
1634 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); 1619 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_));
1635 1620
1636 // Try to set a size below the minimum and ensure it gets set to the min. 1621 // Try to set a size below the minimum and ensure it gets set to the min.
1637 QuicConfig client_config; 1622 QuicConfig client_config;
1638 QuicConfigPeer::SetReceivedSocketReceiveBuffer(&client_config, 1024); 1623 QuicConfigPeer::SetReceivedSocketReceiveBuffer(&client_config, 1024);
1639 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)); 1624 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1640 if (FLAGS_quic_limit_max_cwnd_to_receive_buffer) { 1625 if (FLAGS_quic_limit_max_cwnd_to_receive_buffer) {
1641 EXPECT_CALL(*send_algorithm_, 1626 EXPECT_CALL(*send_algorithm_,
1642 SetMaxCongestionWindow(kMinSocketReceiveBuffer * 0.95)); 1627 SetMaxCongestionWindow(kMinSocketReceiveBuffer * 0.95));
1643 } 1628 }
1644 EXPECT_CALL(*send_algorithm_, PacingRate()) 1629 EXPECT_CALL(*send_algorithm_, PacingRate())
1645 .WillRepeatedly(Return(QuicBandwidth::Zero())); 1630 .WillRepeatedly(Return(QuicBandwidth::Zero()));
1646 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 1631 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
1647 EXPECT_CALL(*network_change_visitor_, OnRttChange()); 1632 EXPECT_CALL(*network_change_visitor_, OnRttChange());
1648 manager_.SetFromConfig(client_config); 1633 manager_.SetFromConfig(client_config);
1649 1634
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1696 manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA)); 1681 manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA));
1697 } 1682 }
1698 1683
1699 TEST_F(QuicSentPacketManagerTest, UseInitialRoundTripTimeToSend) { 1684 TEST_F(QuicSentPacketManagerTest, UseInitialRoundTripTimeToSend) {
1700 uint32 initial_rtt_us = 325000; 1685 uint32 initial_rtt_us = 325000;
1701 EXPECT_NE(initial_rtt_us, 1686 EXPECT_NE(initial_rtt_us,
1702 manager_.GetRttStats()->smoothed_rtt().ToMicroseconds()); 1687 manager_.GetRttStats()->smoothed_rtt().ToMicroseconds());
1703 1688
1704 QuicConfig config; 1689 QuicConfig config;
1705 config.SetInitialRoundTripTimeUsToSend(initial_rtt_us); 1690 config.SetInitialRoundTripTimeUsToSend(initial_rtt_us);
1706 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)); 1691 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1707 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 1692 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
1708 EXPECT_CALL(*network_change_visitor_, OnRttChange()); 1693 EXPECT_CALL(*network_change_visitor_, OnRttChange());
1709 manager_.SetFromConfig(config); 1694 manager_.SetFromConfig(config);
1710 1695
1711 EXPECT_EQ(0, manager_.GetRttStats()->smoothed_rtt().ToMicroseconds()); 1696 EXPECT_EQ(0, manager_.GetRttStats()->smoothed_rtt().ToMicroseconds());
1712 EXPECT_EQ(initial_rtt_us, manager_.GetRttStats()->initial_rtt_us()); 1697 EXPECT_EQ(initial_rtt_us, manager_.GetRttStats()->initial_rtt_us());
1713 } 1698 }
1714 1699
1715 TEST_F(QuicSentPacketManagerTest, ResumeConnectionState) { 1700 TEST_F(QuicSentPacketManagerTest, ResumeConnectionState) {
1716 // The sent packet manager should use the RTT from CachedNetworkParameters if 1701 // The sent packet manager should use the RTT from CachedNetworkParameters if
1717 // it is provided. 1702 // it is provided.
1718 const int kRttMs = 1234; 1703 const int kRttMs = 1234;
1719 CachedNetworkParameters cached_network_params; 1704 CachedNetworkParameters cached_network_params;
1720 cached_network_params.set_min_rtt_ms(kRttMs); 1705 cached_network_params.set_min_rtt_ms(kRttMs);
1721 1706
1722 EXPECT_CALL(*send_algorithm_, ResumeConnectionState(_, false)); 1707 EXPECT_CALL(*send_algorithm_, ResumeConnectionState(_, false));
1723 manager_.ResumeConnectionState(cached_network_params, false); 1708 manager_.ResumeConnectionState(cached_network_params, false);
1724 EXPECT_EQ(kRttMs * kNumMicrosPerMilli, 1709 EXPECT_EQ(kRttMs * kNumMicrosPerMilli,
1725 static_cast<uint64>(manager_.GetRttStats()->initial_rtt_us())); 1710 static_cast<uint64>(manager_.GetRttStats()->initial_rtt_us()));
1726 } 1711 }
1727 1712
1728 } // namespace 1713 } // namespace
1729 } // namespace test 1714 } // namespace test
1730 } // namespace net 1715 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_sent_packet_manager.cc ('k') | net/quic/test_tools/quic_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698