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

Side by Side Diff: net/quic/congestion_control/tcp_cubic_sender_test.cc

Issue 1413193009: Remove the kMaxSegmentSize constant from QUIC's TcpCubicSender and TcpCubicBytesSender and replace … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@106333315
Patch Set: Created 5 years, 1 month 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/congestion_control/tcp_cubic_sender.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/congestion_control/tcp_cubic_sender.h" 5 #include "net/quic/congestion_control/tcp_cubic_sender.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 741
742 TEST_F(TcpCubicSenderTest, BandwidthResumption) { 742 TEST_F(TcpCubicSenderTest, BandwidthResumption) {
743 // Test that when provided with CachedNetworkParameters and opted in to the 743 // Test that when provided with CachedNetworkParameters and opted in to the
744 // bandwidth resumption experiment, that the TcpCubicSender sets initial CWND 744 // bandwidth resumption experiment, that the TcpCubicSender sets initial CWND
745 // appropriately. 745 // appropriately.
746 746
747 // Set some common values. 747 // Set some common values.
748 CachedNetworkParameters cached_network_params; 748 CachedNetworkParameters cached_network_params;
749 const QuicPacketCount kNumberOfPackets = 123; 749 const QuicPacketCount kNumberOfPackets = 123;
750 const int kBandwidthEstimateBytesPerSecond = 750 const int kBandwidthEstimateBytesPerSecond =
751 kNumberOfPackets * kMaxPacketSize; 751 kNumberOfPackets * kDefaultTCPMSS;
752 cached_network_params.set_bandwidth_estimate_bytes_per_second( 752 cached_network_params.set_bandwidth_estimate_bytes_per_second(
753 kBandwidthEstimateBytesPerSecond); 753 kBandwidthEstimateBytesPerSecond);
754 cached_network_params.set_min_rtt_ms(1000); 754 cached_network_params.set_min_rtt_ms(1000);
755 755
756 // Make sure that a bandwidth estimate results in a changed CWND. 756 // Make sure that a bandwidth estimate results in a changed CWND.
757 cached_network_params.set_timestamp(clock_.WallNow().ToUNIXSeconds() - 757 cached_network_params.set_timestamp(clock_.WallNow().ToUNIXSeconds() -
758 (kNumSecondsPerHour - 1)); 758 (kNumSecondsPerHour - 1));
759 sender_->ResumeConnectionState(cached_network_params, false); 759 sender_->ResumeConnectionState(cached_network_params, false);
760 EXPECT_EQ(kNumberOfPackets, sender_->congestion_window()); 760 EXPECT_EQ(kNumberOfPackets, sender_->congestion_window());
761 761
762 // Resumed CWND is limited to be in a sensible range. 762 // Resumed CWND is limited to be in a sensible range.
763 cached_network_params.set_bandwidth_estimate_bytes_per_second( 763 cached_network_params.set_bandwidth_estimate_bytes_per_second(
764 (kMaxCongestionWindow + 1) * kMaxPacketSize); 764 (kMaxCongestionWindow + 1) * kDefaultTCPMSS);
765 sender_->ResumeConnectionState(cached_network_params, false); 765 sender_->ResumeConnectionState(cached_network_params, false);
766 EXPECT_EQ(kMaxCongestionWindow, sender_->congestion_window()); 766 EXPECT_EQ(kMaxCongestionWindow, sender_->congestion_window());
767 767
768 cached_network_params.set_bandwidth_estimate_bytes_per_second( 768 cached_network_params.set_bandwidth_estimate_bytes_per_second(
769 (kMinCongestionWindowForBandwidthResumption - 1) * kMaxPacketSize); 769 (kMinCongestionWindowForBandwidthResumption - 1) * kDefaultTCPMSS);
770 sender_->ResumeConnectionState(cached_network_params, false); 770 sender_->ResumeConnectionState(cached_network_params, false);
771 EXPECT_EQ(kMinCongestionWindowForBandwidthResumption, 771 EXPECT_EQ(kMinCongestionWindowForBandwidthResumption,
772 sender_->congestion_window()); 772 sender_->congestion_window());
773 773
774 // Resume to the max value. 774 // Resume to the max value.
775 cached_network_params.set_max_bandwidth_estimate_bytes_per_second( 775 cached_network_params.set_max_bandwidth_estimate_bytes_per_second(
776 (kMinCongestionWindowForBandwidthResumption + 10) * kDefaultTCPMSS); 776 (kMinCongestionWindowForBandwidthResumption + 10) * kDefaultTCPMSS);
777 sender_->ResumeConnectionState(cached_network_params, true); 777 sender_->ResumeConnectionState(cached_network_params, true);
778 EXPECT_EQ((kMinCongestionWindowForBandwidthResumption + 10) * kDefaultTCPMSS, 778 EXPECT_EQ((kMinCongestionWindowForBandwidthResumption + 10) * kDefaultTCPMSS,
779 sender_->GetCongestionWindow()); 779 sender_->GetCongestionWindow());
(...skipping 15 matching lines...) Expand all
795 EXPECT_TRUE(sender_->TimeUntilSend(QuicTime::Zero(), 2 * kDefaultTCPMSS, 795 EXPECT_TRUE(sender_->TimeUntilSend(QuicTime::Zero(), 2 * kDefaultTCPMSS,
796 HAS_RETRANSMITTABLE_DATA).IsZero()); 796 HAS_RETRANSMITTABLE_DATA).IsZero());
797 EXPECT_TRUE(sender_->TimeUntilSend(QuicTime::Zero(), 3 * kDefaultTCPMSS, 797 EXPECT_TRUE(sender_->TimeUntilSend(QuicTime::Zero(), 3 * kDefaultTCPMSS,
798 HAS_RETRANSMITTABLE_DATA).IsZero()); 798 HAS_RETRANSMITTABLE_DATA).IsZero());
799 EXPECT_FALSE(sender_->TimeUntilSend(QuicTime::Zero(), 4 * kDefaultTCPMSS, 799 EXPECT_FALSE(sender_->TimeUntilSend(QuicTime::Zero(), 4 * kDefaultTCPMSS,
800 HAS_RETRANSMITTABLE_DATA).IsZero()); 800 HAS_RETRANSMITTABLE_DATA).IsZero());
801 } 801 }
802 802
803 } // namespace test 803 } // namespace test
804 } // namespace net 804 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_sender.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698