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

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

Issue 2126903002: Deprectate --quic_ignore_srbf (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@126352469
Patch Set: Created 4 years, 5 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') | 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/quic_sent_packet_manager.h" 5 #include "net/quic/quic_sent_packet_manager.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "net/quic/quic_flags.h" 10 #include "net/quic/quic_flags.h"
(...skipping 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after
1615 1615
1616 options.push_back(kUNDO); 1616 options.push_back(kUNDO);
1617 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT); 1617 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT);
1618 client_config.SetConnectionOptionsToSend(options); 1618 client_config.SetConnectionOptionsToSend(options);
1619 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()); 1619 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1620 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); 1620 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1621 manager_.SetFromConfig(client_config); 1621 manager_.SetFromConfig(client_config);
1622 EXPECT_TRUE(QuicSentPacketManagerPeer::GetUndoRetransmits(&manager_)); 1622 EXPECT_TRUE(QuicSentPacketManagerPeer::GetUndoRetransmits(&manager_));
1623 } 1623 }
1624 1624
1625 TEST_P(QuicSentPacketManagerTest,
1626 NegotiateConservativeReceiveWindowFromOptions) {
1627 ValueRestore<bool> old_flag(&FLAGS_quic_ignore_srbf, false);
1628 EXPECT_EQ(kDefaultSocketReceiveBuffer,
1629 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_));
1630
1631 // Try to set a size below the minimum and ensure it gets set to the min.
1632 QuicConfig client_config;
1633 QuicConfigPeer::SetReceivedSocketReceiveBuffer(&client_config, 1024);
1634 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1635 EXPECT_CALL(*send_algorithm_,
1636 SetMaxCongestionWindow(kMinSocketReceiveBuffer * 0.6));
1637 EXPECT_CALL(*send_algorithm_, PacingRate(_))
1638 .WillRepeatedly(Return(QuicBandwidth::Zero()));
1639 EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
1640 .WillOnce(Return(10 * kDefaultTCPMSS));
1641 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1642 manager_.SetFromConfig(client_config);
1643
1644 EXPECT_EQ(kMinSocketReceiveBuffer,
1645 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_));
1646
1647 // Ensure the smaller send window only allows 16 packets to be sent.
1648 QuicPathId path_id = kInvalidPathId;
1649 for (QuicPacketNumber i = 1; i <= 16; ++i) {
1650 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _))
1651 .WillOnce(Return(QuicTime::Delta::Zero()));
1652 EXPECT_EQ(QuicTime::Delta::Zero(),
1653 manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA,
1654 &path_id));
1655 EXPECT_CALL(*send_algorithm_,
1656 OnPacketSent(_, BytesInFlight(), i, kDefaultLength,
1657 HAS_RETRANSMITTABLE_DATA))
1658 .WillOnce(Return(true));
1659 SerializedPacket packet(CreatePacket(i, true));
1660 manager_.OnPacketSent(&packet, kInvalidPathId, 0, clock_.Now(),
1661 NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA);
1662 }
1663 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _))
1664 .WillOnce(Return(QuicTime::Delta::Infinite()));
1665 EXPECT_EQ(
1666 QuicTime::Delta::Infinite(),
1667 manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA, &path_id));
1668 }
1669
1670 TEST_P(QuicSentPacketManagerTest, ReceiveWindowLimited) {
1671 ValueRestore<bool> old_flag(&FLAGS_quic_ignore_srbf, false);
1672 EXPECT_EQ(kDefaultSocketReceiveBuffer,
1673 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_));
1674
1675 // Ensure the smaller send window only allows 256 * 0.95 packets to be sent.
1676 QuicPathId path_id = kInvalidPathId;
1677 for (QuicPacketNumber i = 1; i <= 244; ++i) {
1678 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _))
1679 .WillOnce(Return(QuicTime::Delta::Zero()));
1680 EXPECT_EQ(QuicTime::Delta::Zero(),
1681 manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA,
1682 &path_id));
1683 EXPECT_CALL(*send_algorithm_,
1684 OnPacketSent(_, BytesInFlight(), i, kDefaultLength,
1685 HAS_RETRANSMITTABLE_DATA))
1686 .WillOnce(Return(true));
1687 SerializedPacket packet(CreatePacket(i, true));
1688 manager_.OnPacketSent(&packet, kInvalidPathId, 0, clock_.Now(),
1689 NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA);
1690 }
1691 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _))
1692 .WillOnce(Return(QuicTime::Delta::Infinite()));
1693 EXPECT_EQ(
1694 QuicTime::Delta::Infinite(),
1695 manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA, &path_id));
1696 }
1697
1698 TEST_P(QuicSentPacketManagerTest, UseInitialRoundTripTimeToSend) { 1625 TEST_P(QuicSentPacketManagerTest, UseInitialRoundTripTimeToSend) {
1699 uint32_t initial_rtt_us = 325000; 1626 uint32_t initial_rtt_us = 325000;
1700 EXPECT_NE(initial_rtt_us, 1627 EXPECT_NE(initial_rtt_us,
1701 manager_.GetRttStats()->smoothed_rtt().ToMicroseconds()); 1628 manager_.GetRttStats()->smoothed_rtt().ToMicroseconds());
1702 1629
1703 QuicConfig config; 1630 QuicConfig config;
1704 config.SetInitialRoundTripTimeUsToSend(initial_rtt_us); 1631 config.SetInitialRoundTripTimeUsToSend(initial_rtt_us);
1705 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); 1632 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1706 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()); 1633 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1707 manager_.SetFromConfig(config); 1634 manager_.SetFromConfig(config);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1792 ExpectAck(1); 1719 ExpectAck(1);
1793 EXPECT_CALL(*network_change_visitor_, 1720 EXPECT_CALL(*network_change_visitor_,
1794 OnPathMtuIncreased(kDefaultLength + 100)); 1721 OnPathMtuIncreased(kDefaultLength + 100));
1795 QuicAckFrame ack_frame = InitAckFrame(1); 1722 QuicAckFrame ack_frame = InitAckFrame(1);
1796 manager_.OnIncomingAck(ack_frame, clock_.Now()); 1723 manager_.OnIncomingAck(ack_frame, clock_.Now());
1797 } 1724 }
1798 1725
1799 } // namespace 1726 } // namespace
1800 } // namespace test 1727 } // namespace test
1801 } // namespace net 1728 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_sent_packet_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698