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

Side by Side Diff: net/quic/congestion_control/tcp_cubic_sender_bytes_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
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 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 LoseNPackets(9); 797 LoseNPackets(9);
798 AckNPackets(1); 798 AckNPackets(1);
799 799
800 // We should now have fallen out of slow start with a reduced window. 800 // We should now have fallen out of slow start with a reduced window.
801 EXPECT_EQ(kRenoBeta * kDefaultWindowTCP, sender_->GetCongestionWindow()); 801 EXPECT_EQ(kRenoBeta * kDefaultWindowTCP, sender_->GetCongestionWindow());
802 const QuicPacketCount window_in_packets = 802 const QuicPacketCount window_in_packets =
803 kRenoBeta * kDefaultWindowTCP / kDefaultTCPMSS; 803 kRenoBeta * kDefaultWindowTCP / kDefaultTCPMSS;
804 const QuicBandwidth expected_pacing_rate = 804 const QuicBandwidth expected_pacing_rate =
805 QuicBandwidth::FromBytesAndTimeDelta(kRenoBeta * kDefaultWindowTCP, 805 QuicBandwidth::FromBytesAndTimeDelta(kRenoBeta * kDefaultWindowTCP,
806 sender_->rtt_stats_.smoothed_rtt()); 806 sender_->rtt_stats_.smoothed_rtt());
807 EXPECT_EQ(expected_pacing_rate, sender_->PacingRate()); 807 EXPECT_EQ(expected_pacing_rate, sender_->PacingRate(0));
808 EXPECT_EQ(window_in_packets, 808 EXPECT_EQ(window_in_packets,
809 static_cast<uint64_t>(SendAvailableSendWindow())); 809 static_cast<uint64_t>(SendAvailableSendWindow()));
810 EXPECT_EQ(expected_pacing_rate, sender_->PacingRate()); 810 EXPECT_EQ(expected_pacing_rate,
811 sender_->PacingRate(kRenoBeta * kDefaultWindowTCP));
812 }
813
814 TEST_F(TcpCubicSenderBytesTest, PaceSlowerAboveCwnd) {
815 ValueRestore<bool> old_flag(&FLAGS_quic_rate_based_sending, true);
816 QuicTime::Delta rtt(QuicTime::Delta::FromMilliseconds(60));
817 sender_->rtt_stats_.UpdateRtt(rtt, QuicTime::Delta::Zero(), clock_.Now());
818
819 QuicConfig config;
820 QuicTagVector options;
821 options.push_back(kRATE);
822 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
823 sender_->SetFromConfig(config, Perspective::IS_SERVER);
824 EXPECT_EQ(10 * kDefaultTCPMSS, sender_->GetCongestionWindow());
825 sender_->SetNumEmulatedConnections(1);
826 // Lose a packet to exit slow start.
827 LoseNPackets(1);
828 const QuicPacketCount cwnd = 7;
829 EXPECT_EQ(cwnd * kDefaultTCPMSS, sender_->GetCongestionWindow());
830
831 EXPECT_TRUE(
832 sender_->TimeUntilSend(QuicTime::Zero(), kDefaultTCPMSS).IsZero());
833 EXPECT_EQ(sender_->PacingRate(kDefaultTCPMSS),
834 QuicBandwidth::FromBytesAndTimeDelta(7 * kDefaultTCPMSS, rtt)
835 .Scale(1.25));
836 for (QuicPacketCount i = cwnd + 1; i < 1.5 * cwnd; ++i) {
837 EXPECT_TRUE(
838 sender_->TimeUntilSend(QuicTime::Zero(), i * kDefaultTCPMSS).IsZero());
839 EXPECT_EQ(sender_->PacingRate(i * kDefaultTCPMSS),
840 QuicBandwidth::FromBytesAndTimeDelta(cwnd * kDefaultTCPMSS, rtt)
841 .Scale(0.75));
842 }
843 EXPECT_FALSE(
844 sender_->TimeUntilSend(QuicTime::Zero(), 11 * kDefaultTCPMSS).IsZero());
811 } 845 }
812 846
813 TEST_F(TcpCubicSenderBytesTest, ResetAfterConnectionMigration) { 847 TEST_F(TcpCubicSenderBytesTest, ResetAfterConnectionMigration) {
814 // Starts from slow start. 848 // Starts from slow start.
815 sender_->SetNumEmulatedConnections(1); 849 sender_->SetNumEmulatedConnections(1);
816 const int kNumberOfAcks = 10; 850 const int kNumberOfAcks = 10;
817 for (int i = 0; i < kNumberOfAcks; ++i) { 851 for (int i = 0; i < kNumberOfAcks; ++i) {
818 // Send our full send window. 852 // Send our full send window.
819 SendAvailableSendWindow(); 853 SendAvailableSendWindow();
820 AckNPackets(2); 854 AckNPackets(2);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 acked_packets.push_back(std::make_pair(i, 1350)); 889 acked_packets.push_back(std::make_pair(i, 1350));
856 sender->OnCongestionEvent(true, sender->GetCongestionWindow(), 890 sender->OnCongestionEvent(true, sender->GetCongestionWindow(),
857 acked_packets, missing_packets); 891 acked_packets, missing_packets);
858 } 892 }
859 EXPECT_EQ(kDefaultMaxCongestionWindowPackets, 893 EXPECT_EQ(kDefaultMaxCongestionWindowPackets,
860 sender->GetCongestionWindow() / kDefaultTCPMSS); 894 sender->GetCongestionWindow() / kDefaultTCPMSS);
861 } 895 }
862 896
863 } // namespace test 897 } // namespace test
864 } // namespace net 898 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_sender_base.cc ('k') | net/quic/congestion_control/tcp_cubic_sender_packets_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698