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

Unified Diff: net/quic/quic_sustained_bandwidth_recorder_test.cc

Issue 479443002: Not used in production. Add InRecovery() method to QUIC send algorithm (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Add_flag_to_enable_BBR_73146298
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_sustained_bandwidth_recorder.cc ('k') | net/quic/test_tools/quic_test_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_sustained_bandwidth_recorder_test.cc
diff --git a/net/quic/quic_sustained_bandwidth_recorder_test.cc b/net/quic/quic_sustained_bandwidth_recorder_test.cc
index 060b9fab9495759e0c8b0ada161d856f87303ebd..a2d2bf04afebb44b586a36306674998b7d71beae 100644
--- a/net/quic/quic_sustained_bandwidth_recorder_test.cc
+++ b/net/quic/quic_sustained_bandwidth_recorder_test.cc
@@ -24,19 +24,22 @@ TEST(QuicSustainedBandwidthRecorderTest, BandwidthEstimates) {
QuicBandwidth::FromBitsPerSecond(kBandwidthBitsPerSecond);
// This triggers recording, but should not yield a valid estimate yet.
- recorder.RecordEstimate(true, bandwidth, estimate_time, wall_time, srtt);
+ recorder.RecordEstimate(true, false, bandwidth, estimate_time, wall_time,
+ srtt);
EXPECT_FALSE(recorder.HasEstimate());
// Send a second reading, again this should not result in a valid estimate,
// as not enough time has passed.
estimate_time = estimate_time.Add(srtt);
- recorder.RecordEstimate(true, bandwidth, estimate_time, wall_time, srtt);
+ recorder.RecordEstimate(true, false, bandwidth, estimate_time, wall_time,
+ srtt);
EXPECT_FALSE(recorder.HasEstimate());
// Now 3 * kSRTT has elapsed since first recording, expect a valid estimate.
estimate_time = estimate_time.Add(srtt);
estimate_time = estimate_time.Add(srtt);
- recorder.RecordEstimate(true, bandwidth, estimate_time, wall_time, srtt);
+ recorder.RecordEstimate(true, false, bandwidth, estimate_time, wall_time,
+ srtt);
EXPECT_TRUE(recorder.HasEstimate());
EXPECT_EQ(recorder.BandwidthEstimate(), bandwidth);
EXPECT_EQ(recorder.BandwidthEstimate(), recorder.MaxBandwidthEstimate());
@@ -46,17 +49,17 @@ TEST(QuicSustainedBandwidthRecorderTest, BandwidthEstimates) {
QuicBandwidth second_bandwidth =
QuicBandwidth::FromBitsPerSecond(2 * kBandwidthBitsPerSecond);
// Reset the recorder by passing in an unreliable measurement.
- recorder.RecordEstimate(false, second_bandwidth, estimate_time, wall_time,
- srtt);
- recorder.RecordEstimate(true, second_bandwidth, estimate_time, wall_time,
- srtt);
+ recorder.RecordEstimate(false, false, second_bandwidth, estimate_time,
+ wall_time, srtt);
+ recorder.RecordEstimate(true, false, second_bandwidth, estimate_time,
+ wall_time, srtt);
EXPECT_EQ(recorder.BandwidthEstimate(), bandwidth);
estimate_time = estimate_time.Add(srtt.Multiply(3));
const int32 kSeconds = 556677;
QuicWallTime second_bandwidth_wall_time =
QuicWallTime::FromUNIXSeconds(kSeconds);
- recorder.RecordEstimate(true, second_bandwidth, estimate_time,
+ recorder.RecordEstimate(true, false, second_bandwidth, estimate_time,
second_bandwidth_wall_time, srtt);
EXPECT_EQ(recorder.BandwidthEstimate(), second_bandwidth);
EXPECT_EQ(recorder.BandwidthEstimate(), recorder.MaxBandwidthEstimate());
@@ -66,15 +69,15 @@ TEST(QuicSustainedBandwidthRecorderTest, BandwidthEstimates) {
QuicBandwidth third_bandwidth =
QuicBandwidth::FromBitsPerSecond(0.5 * kBandwidthBitsPerSecond);
// Reset the recorder by passing in an unreliable measurement.
- recorder.RecordEstimate(false, third_bandwidth, estimate_time, wall_time,
- srtt);
- recorder.RecordEstimate(true, third_bandwidth, estimate_time, wall_time,
- srtt);
+ recorder.RecordEstimate(false, false, third_bandwidth, estimate_time,
+ wall_time, srtt);
+ recorder.RecordEstimate(true, false, third_bandwidth, estimate_time,
+ wall_time, srtt);
EXPECT_EQ(recorder.BandwidthEstimate(), second_bandwidth);
estimate_time = estimate_time.Add(srtt.Multiply(3));
- recorder.RecordEstimate(true, third_bandwidth, estimate_time, wall_time,
- srtt);
+ recorder.RecordEstimate(true, false, third_bandwidth, estimate_time,
+ wall_time, srtt);
EXPECT_EQ(recorder.BandwidthEstimate(), third_bandwidth);
// Max bandwidth should not have changed.
@@ -83,6 +86,40 @@ TEST(QuicSustainedBandwidthRecorderTest, BandwidthEstimates) {
EXPECT_EQ(recorder.MaxBandwidthTimestamp(), kSeconds);
}
+TEST(QuicSustainedBandwidthRecorderTest, SlowStart) {
+ // Verify that slow start status is correctly recorded.
+ QuicSustainedBandwidthRecorder recorder;
+ EXPECT_FALSE(recorder.HasEstimate());
+
+ QuicTime estimate_time = QuicTime::Zero();
+ QuicWallTime wall_time = QuicWallTime::Zero();
+ QuicTime::Delta srtt = QuicTime::Delta::FromMilliseconds(150);
+ const int kBandwidthBitsPerSecond = 12345678;
+ QuicBandwidth bandwidth =
+ QuicBandwidth::FromBitsPerSecond(kBandwidthBitsPerSecond);
+
+ bool in_slow_start = true;
+
+ // This triggers recording, but should not yield a valid estimate yet.
+ recorder.RecordEstimate(true, in_slow_start, bandwidth, estimate_time,
+ wall_time, srtt);
+
+ // Now 3 * kSRTT has elapsed since first recording, expect a valid estimate.
+ estimate_time = estimate_time.Add(srtt.Multiply(3));
+ recorder.RecordEstimate(true, in_slow_start, bandwidth, estimate_time,
+ wall_time, srtt);
+ EXPECT_TRUE(recorder.HasEstimate());
+ EXPECT_TRUE(recorder.EstimateRecordedDuringSlowStart());
+
+ // Now send another estimate, this time not in slow start.
+ estimate_time = estimate_time.Add(srtt.Multiply(3));
+ in_slow_start = false;
+ recorder.RecordEstimate(true, in_slow_start, bandwidth, estimate_time,
+ wall_time, srtt);
+ EXPECT_TRUE(recorder.HasEstimate());
+ EXPECT_FALSE(recorder.EstimateRecordedDuringSlowStart());
+}
+
} // namespace
} // namespace test
} // namespace net
« no previous file with comments | « net/quic/quic_sustained_bandwidth_recorder.cc ('k') | net/quic/test_tools/quic_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698