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

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

Issue 1277723003: Landing Recent QUIC changes until 8/4/2015 20:30 UTC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Dont enable FLAGS_quic_require_handshake_confirmation to fix crypto tests Created 5 years, 4 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_reliable_client_stream.cc ('k') | net/quic/quic_session.cc » ('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 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 QuicConfig client_config; 1110 QuicConfig client_config;
1111 QuicTagVector options; 1111 QuicTagVector options;
1112 options.push_back(kNRTO); 1112 options.push_back(kNRTO);
1113 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT); 1113 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT);
1114 client_config.SetConnectionOptionsToSend(options); 1114 client_config.SetConnectionOptionsToSend(options);
1115 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 1115 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
1116 EXPECT_CALL(*network_change_visitor_, OnRttChange()); 1116 EXPECT_CALL(*network_change_visitor_, OnRttChange());
1117 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); 1117 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1118 EXPECT_CALL(*send_algorithm_, PacingRate()) 1118 EXPECT_CALL(*send_algorithm_, PacingRate())
1119 .WillRepeatedly(Return(QuicBandwidth::Zero())); 1119 .WillRepeatedly(Return(QuicBandwidth::Zero()));
1120 if (FLAGS_quic_limit_pacing_burst) {
1121 EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
1122 .WillOnce(Return(10 * kDefaultTCPMSS));
1123 }
1120 manager_.SetFromConfig(client_config); 1124 manager_.SetFromConfig(client_config);
1121 EXPECT_TRUE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_)); 1125 EXPECT_TRUE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_));
1122 1126
1123 // Send 100 packets. 1127 // Send 100 packets.
1124 const size_t kNumSentPackets = 100; 1128 const size_t kNumSentPackets = 100;
1125 for (size_t i = 1; i <= kNumSentPackets; ++i) { 1129 for (size_t i = 1; i <= kNumSentPackets; ++i) {
1126 SendDataPacket(i); 1130 SendDataPacket(i);
1127 } 1131 }
1128 1132
1129 EXPECT_FALSE(manager_.MaybeRetransmitTailLossProbe()); 1133 EXPECT_FALSE(manager_.MaybeRetransmitTailLossProbe());
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
1583 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); 1587 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_));
1584 1588
1585 // Try to set a size below the minimum and ensure it gets set to the min. 1589 // Try to set a size below the minimum and ensure it gets set to the min.
1586 QuicConfig client_config; 1590 QuicConfig client_config;
1587 QuicConfigPeer::SetReceivedSocketReceiveBuffer(&client_config, 1024); 1591 QuicConfigPeer::SetReceivedSocketReceiveBuffer(&client_config, 1024);
1588 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); 1592 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1589 EXPECT_CALL(*send_algorithm_, 1593 EXPECT_CALL(*send_algorithm_,
1590 SetMaxCongestionWindow(kMinSocketReceiveBuffer * 0.95)); 1594 SetMaxCongestionWindow(kMinSocketReceiveBuffer * 0.95));
1591 EXPECT_CALL(*send_algorithm_, PacingRate()) 1595 EXPECT_CALL(*send_algorithm_, PacingRate())
1592 .WillRepeatedly(Return(QuicBandwidth::Zero())); 1596 .WillRepeatedly(Return(QuicBandwidth::Zero()));
1597 if (FLAGS_quic_limit_pacing_burst) {
1598 EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
1599 .WillOnce(Return(10 * kDefaultTCPMSS));
1600 }
1593 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 1601 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
1594 EXPECT_CALL(*network_change_visitor_, OnRttChange()); 1602 EXPECT_CALL(*network_change_visitor_, OnRttChange());
1595 manager_.SetFromConfig(client_config); 1603 manager_.SetFromConfig(client_config);
1596 1604
1597 EXPECT_EQ(kMinSocketReceiveBuffer, 1605 EXPECT_EQ(kMinSocketReceiveBuffer,
1598 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); 1606 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_));
1599 1607
1600 // Ensure the smaller send window only allows 16 packets to be sent. 1608 // Ensure the smaller send window only allows 16 packets to be sent.
1601 for (QuicPacketSequenceNumber i = 1; i <= 16; ++i) { 1609 for (QuicPacketSequenceNumber i = 1; i <= 16; ++i) {
1602 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)).WillOnce(Return( 1610 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)).WillOnce(Return(
(...skipping 21 matching lines...) Expand all
1624 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); 1632 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_));
1625 1633
1626 // Try to set a size below the minimum and ensure it gets set to the min. 1634 // Try to set a size below the minimum and ensure it gets set to the min.
1627 QuicConfig client_config; 1635 QuicConfig client_config;
1628 QuicConfigPeer::SetReceivedSocketReceiveBuffer(&client_config, 1024); 1636 QuicConfigPeer::SetReceivedSocketReceiveBuffer(&client_config, 1024);
1629 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); 1637 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1630 EXPECT_CALL(*send_algorithm_, 1638 EXPECT_CALL(*send_algorithm_,
1631 SetMaxCongestionWindow(kMinSocketReceiveBuffer * 0.6)); 1639 SetMaxCongestionWindow(kMinSocketReceiveBuffer * 0.6));
1632 EXPECT_CALL(*send_algorithm_, PacingRate()) 1640 EXPECT_CALL(*send_algorithm_, PacingRate())
1633 .WillRepeatedly(Return(QuicBandwidth::Zero())); 1641 .WillRepeatedly(Return(QuicBandwidth::Zero()));
1642 if (FLAGS_quic_limit_pacing_burst) {
1643 EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
1644 .WillOnce(Return(10 * kDefaultTCPMSS));
1645 }
1634 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 1646 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
1635 EXPECT_CALL(*network_change_visitor_, OnRttChange()); 1647 EXPECT_CALL(*network_change_visitor_, OnRttChange());
1636 manager_.SetFromConfig(client_config); 1648 manager_.SetFromConfig(client_config);
1637 1649
1638 EXPECT_EQ(kMinSocketReceiveBuffer, 1650 EXPECT_EQ(kMinSocketReceiveBuffer,
1639 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); 1651 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_));
1640 1652
1641 // Ensure the smaller send window only allows 16 packets to be sent. 1653 // Ensure the smaller send window only allows 16 packets to be sent.
1642 for (QuicPacketSequenceNumber i = 1; i <= 16; ++i) { 1654 for (QuicPacketSequenceNumber i = 1; i <= 16; ++i) {
1643 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)) 1655 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _))
1644 .WillOnce(Return(QuicTime::Delta::Zero())); 1656 .WillOnce(Return(QuicTime::Delta::Zero()));
1645 EXPECT_EQ(QuicTime::Delta::Zero(), 1657 EXPECT_EQ(QuicTime::Delta::Zero(),
1646 manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA)); 1658 manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA));
1647 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, BytesInFlight(), i, 1659 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, BytesInFlight(), i, 1024,
1648 1024, HAS_RETRANSMITTABLE_DATA)) 1660 HAS_RETRANSMITTABLE_DATA))
1649 .WillOnce(Return(true)); 1661 .WillOnce(Return(true));
1650 SerializedPacket packet(CreatePacket(i, true)); 1662 SerializedPacket packet(CreatePacket(i, true));
1651 manager_.OnPacketSent(&packet, 0, clock_.Now(), 1024, 1663 manager_.OnPacketSent(&packet, 0, clock_.Now(), 1024, NOT_RETRANSMISSION,
1652 NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA); 1664 HAS_RETRANSMITTABLE_DATA);
1653 } 1665 }
1654 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)) 1666 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _))
1655 .WillOnce(Return(QuicTime::Delta::Infinite())); 1667 .WillOnce(Return(QuicTime::Delta::Infinite()));
1656 EXPECT_EQ(QuicTime::Delta::Infinite(), 1668 EXPECT_EQ(QuicTime::Delta::Infinite(),
1657 manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA)); 1669 manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA));
1658 } 1670 }
1659 1671
1660 TEST_F(QuicSentPacketManagerTest, ReceiveWindowLimited) { 1672 TEST_F(QuicSentPacketManagerTest, ReceiveWindowLimited) {
1661 EXPECT_EQ(kDefaultSocketReceiveBuffer, 1673 EXPECT_EQ(kDefaultSocketReceiveBuffer,
1662 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); 1674 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_));
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1705 1717
1706 EXPECT_CALL(*send_algorithm_, ResumeConnectionState(_, false)); 1718 EXPECT_CALL(*send_algorithm_, ResumeConnectionState(_, false));
1707 manager_.ResumeConnectionState(cached_network_params, false); 1719 manager_.ResumeConnectionState(cached_network_params, false);
1708 EXPECT_EQ(kRttMs * kNumMicrosPerMilli, 1720 EXPECT_EQ(kRttMs * kNumMicrosPerMilli,
1709 static_cast<uint64>(manager_.GetRttStats()->initial_rtt_us())); 1721 static_cast<uint64>(manager_.GetRttStats()->initial_rtt_us()));
1710 } 1722 }
1711 1723
1712 } // namespace 1724 } // namespace
1713 } // namespace test 1725 } // namespace test
1714 } // namespace net 1726 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_reliable_client_stream.cc ('k') | net/quic/quic_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698