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

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

Issue 2002103002: Implement a QUIC No PRR connection option, NPRR. Protected by FLAGS_quic_allow_no_prr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@122422703
Patch Set: Created 4 years, 7 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_sender_bytes.h" 5 #include "net/quic/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 762 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 EXPECT_TRUE( 773 EXPECT_TRUE(
774 sender_->TimeUntilSend(QuicTime::Zero(), kDefaultTCPMSS).IsZero()); 774 sender_->TimeUntilSend(QuicTime::Zero(), kDefaultTCPMSS).IsZero());
775 EXPECT_TRUE( 775 EXPECT_TRUE(
776 sender_->TimeUntilSend(QuicTime::Zero(), 2 * kDefaultTCPMSS).IsZero()); 776 sender_->TimeUntilSend(QuicTime::Zero(), 2 * kDefaultTCPMSS).IsZero());
777 EXPECT_TRUE( 777 EXPECT_TRUE(
778 sender_->TimeUntilSend(QuicTime::Zero(), 3 * kDefaultTCPMSS).IsZero()); 778 sender_->TimeUntilSend(QuicTime::Zero(), 3 * kDefaultTCPMSS).IsZero());
779 EXPECT_FALSE( 779 EXPECT_FALSE(
780 sender_->TimeUntilSend(QuicTime::Zero(), 4 * kDefaultTCPMSS).IsZero()); 780 sender_->TimeUntilSend(QuicTime::Zero(), 4 * kDefaultTCPMSS).IsZero());
781 } 781 }
782 782
783 TEST_F(TcpCubicSenderBytesTest, NoPRR) {
784 ValueRestore<bool> old_flag(&FLAGS_quic_allow_noprr, true);
785 QuicTime::Delta rtt = QuicTime::Delta::FromMilliseconds(100);
786 sender_->rtt_stats_.UpdateRtt(rtt, QuicTime::Delta::Zero(), QuicTime::Zero());
787
788 sender_->SetNumEmulatedConnections(1);
789 // Verify that kCOPT: kNPRR allows all packets to be sent, even if only one
790 // ack has been received.
791 QuicTagVector options;
792 options.push_back(kNPRR);
793 QuicConfig config;
794 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
795 sender_->SetFromConfig(config, Perspective::IS_SERVER);
796 SendAvailableSendWindow();
797 LoseNPackets(9);
798 AckNPackets(1);
799
800 // We should now have fallen out of slow start with a reduced window.
801 EXPECT_EQ(kRenoBeta * kDefaultWindowTCP, sender_->GetCongestionWindow());
802 const QuicPacketCount window_in_packets =
803 kRenoBeta * kDefaultWindowTCP / kDefaultTCPMSS;
804 const QuicBandwidth expected_pacing_rate =
805 QuicBandwidth::FromBytesAndTimeDelta(kRenoBeta * kDefaultWindowTCP,
806 sender_->rtt_stats_.smoothed_rtt());
807 EXPECT_EQ(expected_pacing_rate, sender_->PacingRate());
808 EXPECT_EQ(window_in_packets,
809 static_cast<uint64_t>(SendAvailableSendWindow()));
810 EXPECT_EQ(expected_pacing_rate, sender_->PacingRate());
811 }
812
783 TEST_F(TcpCubicSenderBytesTest, ResetAfterConnectionMigration) { 813 TEST_F(TcpCubicSenderBytesTest, ResetAfterConnectionMigration) {
784 // Starts from slow start. 814 // Starts from slow start.
785 sender_->SetNumEmulatedConnections(1); 815 sender_->SetNumEmulatedConnections(1);
786 const int kNumberOfAcks = 10; 816 const int kNumberOfAcks = 10;
787 for (int i = 0; i < kNumberOfAcks; ++i) { 817 for (int i = 0; i < kNumberOfAcks; ++i) {
788 // Send our full send window. 818 // Send our full send window.
789 SendAvailableSendWindow(); 819 SendAvailableSendWindow();
790 AckNPackets(2); 820 AckNPackets(2);
791 } 821 }
792 SendAvailableSendWindow(); 822 SendAvailableSendWindow();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 acked_packets.push_back(std::make_pair(i, 1350)); 855 acked_packets.push_back(std::make_pair(i, 1350));
826 sender->OnCongestionEvent(true, sender->GetCongestionWindow(), 856 sender->OnCongestionEvent(true, sender->GetCongestionWindow(),
827 acked_packets, missing_packets); 857 acked_packets, missing_packets);
828 } 858 }
829 EXPECT_EQ(kDefaultMaxCongestionWindowPackets, 859 EXPECT_EQ(kDefaultMaxCongestionWindowPackets,
830 sender->GetCongestionWindow() / kDefaultTCPMSS); 860 sender->GetCongestionWindow() / kDefaultTCPMSS);
831 } 861 }
832 862
833 } // namespace test 863 } // namespace test
834 } // namespace net 864 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_sender_bytes.cc ('k') | net/quic/congestion_control/tcp_cubic_sender_packets.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698