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

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

Issue 2064543002: Add a new rate based sending connection option which uses the pacing rate to keep the bytes_in_flig… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@124273380
Patch Set: Rebase. Created 4 years, 6 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_http_stream_test.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 <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 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 } 1068 }
1069 1069
1070 TEST_P(QuicSentPacketManagerTest, NewRetransmissionTimeout) { 1070 TEST_P(QuicSentPacketManagerTest, NewRetransmissionTimeout) {
1071 QuicConfig client_config; 1071 QuicConfig client_config;
1072 QuicTagVector options; 1072 QuicTagVector options;
1073 options.push_back(kNRTO); 1073 options.push_back(kNRTO);
1074 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT); 1074 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT);
1075 client_config.SetConnectionOptionsToSend(options); 1075 client_config.SetConnectionOptionsToSend(options);
1076 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()); 1076 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1077 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); 1077 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1078 EXPECT_CALL(*send_algorithm_, PacingRate()) 1078 EXPECT_CALL(*send_algorithm_, PacingRate(_))
1079 .WillRepeatedly(Return(QuicBandwidth::Zero())); 1079 .WillRepeatedly(Return(QuicBandwidth::Zero()));
1080 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()) 1080 EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
1081 .WillOnce(Return(10 * kDefaultTCPMSS)); 1081 .WillOnce(Return(10 * kDefaultTCPMSS));
1082 manager_.SetFromConfig(client_config); 1082 manager_.SetFromConfig(client_config);
1083 EXPECT_TRUE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_)); 1083 EXPECT_TRUE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_));
1084 1084
1085 // Send 100 packets. 1085 // Send 100 packets.
1086 const size_t kNumSentPackets = 100; 1086 const size_t kNumSentPackets = 100;
1087 for (size_t i = 1; i <= kNumSentPackets; ++i) { 1087 for (size_t i = 1; i <= kNumSentPackets; ++i) {
1088 SendDataPacket(i); 1088 SendDataPacket(i);
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
1569 options.push_back(kUNDO); 1569 options.push_back(kUNDO);
1570 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 1570 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1571 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()); 1571 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1572 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); 1572 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1573 manager_.SetFromConfig(config); 1573 manager_.SetFromConfig(config);
1574 EXPECT_TRUE(QuicSentPacketManagerPeer::GetUndoRetransmits(&manager_)); 1574 EXPECT_TRUE(QuicSentPacketManagerPeer::GetUndoRetransmits(&manager_));
1575 1575
1576 // Ensure undo works as intended. 1576 // Ensure undo works as intended.
1577 // Send 5 packets, mark the first 4 for retransmission, and then cancel 1577 // Send 5 packets, mark the first 4 for retransmission, and then cancel
1578 // them when 1 is acked. 1578 // them when 1 is acked.
1579 EXPECT_CALL(*send_algorithm_, PacingRate()) 1579 EXPECT_CALL(*send_algorithm_, PacingRate(_))
1580 .WillRepeatedly(Return(QuicBandwidth::Zero())); 1580 .WillRepeatedly(Return(QuicBandwidth::Zero()));
1581 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()) 1581 EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
1582 .WillOnce(Return(10 * kDefaultTCPMSS)); 1582 .WillOnce(Return(10 * kDefaultTCPMSS));
1583 const size_t kNumSentPackets = 5; 1583 const size_t kNumSentPackets = 5;
1584 for (size_t i = 1; i <= kNumSentPackets; ++i) { 1584 for (size_t i = 1; i <= kNumSentPackets; ++i) {
1585 SendDataPacket(i); 1585 SendDataPacket(i);
1586 } 1586 }
1587 MockLossAlgorithm* loss_algorithm = new MockLossAlgorithm(); 1587 MockLossAlgorithm* loss_algorithm = new MockLossAlgorithm();
1588 QuicSentPacketManagerPeer::SetLossAlgorithm(&manager_, loss_algorithm); 1588 QuicSentPacketManagerPeer::SetLossAlgorithm(&manager_, loss_algorithm);
1589 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); 1589 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1632 ValueRestore<bool> old_flag(&FLAGS_quic_ignore_srbf, false); 1632 ValueRestore<bool> old_flag(&FLAGS_quic_ignore_srbf, false);
1633 EXPECT_EQ(kDefaultSocketReceiveBuffer, 1633 EXPECT_EQ(kDefaultSocketReceiveBuffer,
1634 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); 1634 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_));
1635 1635
1636 // Try to set a size below the minimum and ensure it gets set to the min. 1636 // Try to set a size below the minimum and ensure it gets set to the min.
1637 QuicConfig client_config; 1637 QuicConfig client_config;
1638 QuicConfigPeer::SetReceivedSocketReceiveBuffer(&client_config, 1024); 1638 QuicConfigPeer::SetReceivedSocketReceiveBuffer(&client_config, 1024);
1639 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); 1639 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1640 EXPECT_CALL(*send_algorithm_, 1640 EXPECT_CALL(*send_algorithm_,
1641 SetMaxCongestionWindow(kMinSocketReceiveBuffer * 0.6)); 1641 SetMaxCongestionWindow(kMinSocketReceiveBuffer * 0.6));
1642 EXPECT_CALL(*send_algorithm_, PacingRate()) 1642 EXPECT_CALL(*send_algorithm_, PacingRate(_))
1643 .WillRepeatedly(Return(QuicBandwidth::Zero())); 1643 .WillRepeatedly(Return(QuicBandwidth::Zero()));
1644 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()) 1644 EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
1645 .WillOnce(Return(10 * kDefaultTCPMSS)); 1645 .WillOnce(Return(10 * kDefaultTCPMSS));
1646 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()); 1646 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1647 manager_.SetFromConfig(client_config); 1647 manager_.SetFromConfig(client_config);
1648 1648
1649 EXPECT_EQ(kMinSocketReceiveBuffer, 1649 EXPECT_EQ(kMinSocketReceiveBuffer,
1650 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); 1650 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_));
1651 1651
1652 // Ensure the smaller send window only allows 16 packets to be sent. 1652 // Ensure the smaller send window only allows 16 packets to be sent.
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1779 manager_.OnConnectionMigration(kDefaultPathId, PORT_CHANGE); 1779 manager_.OnConnectionMigration(kDefaultPathId, PORT_CHANGE);
1780 1780
1781 EXPECT_EQ(2 * default_init_rtt, rtt_stats->initial_rtt_us()); 1781 EXPECT_EQ(2 * default_init_rtt, rtt_stats->initial_rtt_us());
1782 EXPECT_EQ(1u, manager_.GetConsecutiveRtoCount()); 1782 EXPECT_EQ(1u, manager_.GetConsecutiveRtoCount());
1783 EXPECT_EQ(2u, manager_.GetConsecutiveTlpCount()); 1783 EXPECT_EQ(2u, manager_.GetConsecutiveTlpCount());
1784 } 1784 }
1785 1785
1786 } // namespace 1786 } // namespace
1787 } // namespace test 1787 } // namespace test
1788 } // namespace net 1788 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_http_stream_test.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