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 |