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

Side by Side Diff: net/quic/core/congestion_control/tcp_cubic_sender_bytes_test.cc

Issue 2403193003: Landing Recent QUIC changes until 9:41 AM, Oct 10, 2016 UTC-7 (Closed)
Patch Set: git cl format Created 4 years, 2 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/core/congestion_control/tcp_cubic_sender_bytes.h" 5 #include "net/quic/core/congestion_control/tcp_cubic_sender_bytes.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstdint> 8 #include <cstdint>
9 #include <memory> 9 #include <memory>
10 10
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 sender_->ResumeConnectionState(cached_network_params, false); 694 sender_->ResumeConnectionState(cached_network_params, false);
695 EXPECT_EQ(kNumberOfPackets * kDefaultTCPMSS, sender_->GetCongestionWindow()); 695 EXPECT_EQ(kNumberOfPackets * kDefaultTCPMSS, sender_->GetCongestionWindow());
696 696
697 // Resumed CWND is limited to be in a sensible range. 697 // Resumed CWND is limited to be in a sensible range.
698 cached_network_params.set_bandwidth_estimate_bytes_per_second( 698 cached_network_params.set_bandwidth_estimate_bytes_per_second(
699 (kMaxCongestionWindowPackets + 1) * kDefaultTCPMSS); 699 (kMaxCongestionWindowPackets + 1) * kDefaultTCPMSS);
700 sender_->ResumeConnectionState(cached_network_params, false); 700 sender_->ResumeConnectionState(cached_network_params, false);
701 EXPECT_EQ(kMaxCongestionWindowPackets * kDefaultTCPMSS, 701 EXPECT_EQ(kMaxCongestionWindowPackets * kDefaultTCPMSS,
702 sender_->GetCongestionWindow()); 702 sender_->GetCongestionWindow());
703 703
704 if (FLAGS_quic_no_lower_bw_resumption_limit) { 704 // Resume with an illegal value of 0 and verify the server uses 1 instead.
705 // Resume with an illegal value of 0 and verify the server uses 1 instead. 705 cached_network_params.set_bandwidth_estimate_bytes_per_second(0);
706 cached_network_params.set_bandwidth_estimate_bytes_per_second(0); 706 sender_->ResumeConnectionState(cached_network_params, false);
707 sender_->ResumeConnectionState(cached_network_params, false); 707 EXPECT_EQ(sender_->min_congestion_window(), sender_->GetCongestionWindow());
708 EXPECT_EQ(sender_->min_congestion_window(), sender_->GetCongestionWindow());
709 } else {
710 cached_network_params.set_bandwidth_estimate_bytes_per_second(
711 (kMinCongestionWindowForBandwidthResumption - 1) * kDefaultTCPMSS);
712 sender_->ResumeConnectionState(cached_network_params, false);
713 EXPECT_EQ(kMinCongestionWindowForBandwidthResumption * kDefaultTCPMSS,
714 sender_->GetCongestionWindow());
715 }
716 708
717 // Resume to the max value. 709 // Resume to the max value.
718 cached_network_params.set_max_bandwidth_estimate_bytes_per_second( 710 cached_network_params.set_max_bandwidth_estimate_bytes_per_second(
719 kMaxCongestionWindowPackets * kDefaultTCPMSS); 711 kMaxCongestionWindowPackets * kDefaultTCPMSS);
720 sender_->ResumeConnectionState(cached_network_params, true); 712 sender_->ResumeConnectionState(cached_network_params, true);
721 EXPECT_EQ(kMaxCongestionWindowPackets * kDefaultTCPMSS, 713 EXPECT_EQ(kMaxCongestionWindowPackets * kDefaultTCPMSS,
722 sender_->GetCongestionWindow()); 714 sender_->GetCongestionWindow());
723 } 715 }
724 716
725 TEST_F(TcpCubicSenderBytesTest, PaceBelowCWND) { 717 TEST_F(TcpCubicSenderBytesTest, PaceBelowCWND) {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 // Advance time 2 seconds waiting for an ack. 878 // Advance time 2 seconds waiting for an ack.
887 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(2000)); 879 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(2000));
888 880
889 // Ack two packets. The CWND should increase by only one packet. 881 // Ack two packets. The CWND should increase by only one packet.
890 AckNPackets(2); 882 AckNPackets(2);
891 EXPECT_EQ(saved_cwnd + kDefaultTCPMSS, sender_->GetCongestionWindow()); 883 EXPECT_EQ(saved_cwnd + kDefaultTCPMSS, sender_->GetCongestionWindow());
892 } 884 }
893 885
894 } // namespace test 886 } // namespace test
895 } // namespace net 887 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698