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

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

Issue 1037633002: Add a QUIC connection option(BWMX) to resume to the max bandwidth (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Populate_RTT_info_89043159
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
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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_bytes_sender.h" 5 #include "net/quic/congestion_control/tcp_cubic_bytes_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 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 const QuicPacketCount kNumberOfPackets = 123; 606 const QuicPacketCount kNumberOfPackets = 123;
607 const int kBandwidthEstimateBytesPerSecond = 607 const int kBandwidthEstimateBytesPerSecond =
608 kNumberOfPackets * kDefaultTCPMSS; 608 kNumberOfPackets * kDefaultTCPMSS;
609 cached_network_params.set_bandwidth_estimate_bytes_per_second( 609 cached_network_params.set_bandwidth_estimate_bytes_per_second(
610 kBandwidthEstimateBytesPerSecond); 610 kBandwidthEstimateBytesPerSecond);
611 cached_network_params.set_min_rtt_ms(1000); 611 cached_network_params.set_min_rtt_ms(1000);
612 612
613 // Ensure that an old estimate is not used for bandwidth resumption. 613 // Ensure that an old estimate is not used for bandwidth resumption.
614 cached_network_params.set_timestamp(clock_.WallNow().ToUNIXSeconds() - 614 cached_network_params.set_timestamp(clock_.WallNow().ToUNIXSeconds() -
615 (kNumSecondsPerHour + 1)); 615 (kNumSecondsPerHour + 1));
616 EXPECT_FALSE(sender_->ResumeConnectionState(cached_network_params)); 616 EXPECT_FALSE(sender_->ResumeConnectionState(cached_network_params, false));
617 EXPECT_EQ(10u * kDefaultTCPMSS, sender_->GetCongestionWindow()); 617 EXPECT_EQ(10u * kDefaultTCPMSS, sender_->GetCongestionWindow());
618 618
619 // If the estimate is new enough, make sure it is used. 619 // If the estimate is new enough, make sure it is used.
620 cached_network_params.set_timestamp(clock_.WallNow().ToUNIXSeconds() - 620 cached_network_params.set_timestamp(clock_.WallNow().ToUNIXSeconds() -
621 (kNumSecondsPerHour - 1)); 621 (kNumSecondsPerHour - 1));
622 EXPECT_TRUE(sender_->ResumeConnectionState(cached_network_params)); 622 EXPECT_TRUE(sender_->ResumeConnectionState(cached_network_params, false));
623 EXPECT_EQ(kNumberOfPackets * kDefaultTCPMSS, sender_->GetCongestionWindow()); 623 EXPECT_EQ(kNumberOfPackets * kDefaultTCPMSS, sender_->GetCongestionWindow());
624 624
625 // Resumed CWND is limited to be in a sensible range. 625 // Resumed CWND is limited to be in a sensible range.
626 cached_network_params.set_bandwidth_estimate_bytes_per_second( 626 cached_network_params.set_bandwidth_estimate_bytes_per_second(
627 (kMaxTcpCongestionWindow + 1) * kDefaultTCPMSS); 627 (kMaxTcpCongestionWindow + 1) * kDefaultTCPMSS);
628 EXPECT_TRUE(sender_->ResumeConnectionState(cached_network_params)); 628 EXPECT_TRUE(sender_->ResumeConnectionState(cached_network_params, false));
629 EXPECT_EQ(kMaxTcpCongestionWindow * kDefaultTCPMSS, 629 EXPECT_EQ(kMaxTcpCongestionWindow * kDefaultTCPMSS,
630 sender_->GetCongestionWindow()); 630 sender_->GetCongestionWindow());
631 631
632 cached_network_params.set_bandwidth_estimate_bytes_per_second( 632 cached_network_params.set_bandwidth_estimate_bytes_per_second(
633 (kMinCongestionWindowForBandwidthResumption - 1) * kDefaultTCPMSS); 633 (kMinCongestionWindowForBandwidthResumption - 1) * kDefaultTCPMSS);
634 EXPECT_TRUE(sender_->ResumeConnectionState(cached_network_params)); 634 EXPECT_TRUE(sender_->ResumeConnectionState(cached_network_params, false));
635 EXPECT_EQ(kMinCongestionWindowForBandwidthResumption * kDefaultTCPMSS, 635 EXPECT_EQ(kMinCongestionWindowForBandwidthResumption * kDefaultTCPMSS,
636 sender_->GetCongestionWindow()); 636 sender_->GetCongestionWindow());
637
638 // Resume to the max value.
639 cached_network_params.set_max_bandwidth_estimate_bytes_per_second(
640 (kMinCongestionWindowForBandwidthResumption + 10) * kDefaultTCPMSS);
641 EXPECT_TRUE(sender_->ResumeConnectionState(cached_network_params, true));
642 EXPECT_EQ((kMinCongestionWindowForBandwidthResumption + 10) * kDefaultTCPMSS,
643 sender_->GetCongestionWindow());
637 } 644 }
638 645
639 } // namespace test 646 } // namespace test
640 } // namespace net 647 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_bytes_sender.cc ('k') | net/quic/congestion_control/tcp_cubic_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698