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

Unified Diff: net/quic/quic_sustained_bandwidth_recorder_test.cc

Issue 497553004: Landing Recent QUIC Changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase with TOT 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/quic_unacked_packet_map.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 2d24858afcfef9c1d0b31816f150c11675b50702..6a5fbb25ce2c109d29ed3f4aea3b9ede37eca8ad 100644
--- a/net/quic/quic_sustained_bandwidth_recorder_test.cc
+++ b/net/quic/quic_sustained_bandwidth_recorder_test.cc
@@ -23,23 +23,26 @@ TEST(QuicSustainedBandwidthRecorderTest, BandwidthEstimates) {
QuicBandwidth bandwidth =
QuicBandwidth::FromBitsPerSecond(kBandwidthBitsPerSecond);
+ bool in_recovery = false;
+ bool in_slow_start = false;
+
// This triggers recording, but should not yield a valid estimate yet.
- recorder.RecordEstimate(true, false, bandwidth, estimate_time, wall_time,
- srtt);
+ recorder.RecordEstimate(in_recovery, in_slow_start, 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, false, bandwidth, estimate_time, wall_time,
- srtt);
+ recorder.RecordEstimate(in_recovery, in_slow_start, 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, false, bandwidth, estimate_time, wall_time,
- srtt);
+ recorder.RecordEstimate(in_recovery, in_slow_start, bandwidth, estimate_time,
+ wall_time, srtt);
EXPECT_TRUE(recorder.HasEstimate());
EXPECT_EQ(recorder.BandwidthEstimate(), bandwidth);
EXPECT_EQ(recorder.BandwidthEstimate(), recorder.MaxBandwidthEstimate());
@@ -48,19 +51,21 @@ TEST(QuicSustainedBandwidthRecorderTest, BandwidthEstimates) {
// a further 3 * kSRTT has passed.
QuicBandwidth second_bandwidth =
QuicBandwidth::FromBitsPerSecond(2 * kBandwidthBitsPerSecond);
- // Reset the recorder by passing in an unreliable measurement.
- recorder.RecordEstimate(false, false, second_bandwidth, estimate_time,
+ // Reset the recorder by passing in a measurement while in recovery.
+ in_recovery = true;
+ recorder.RecordEstimate(in_recovery, in_slow_start, bandwidth, estimate_time,
wall_time, srtt);
- recorder.RecordEstimate(true, false, second_bandwidth, estimate_time,
+ in_recovery = false;
+ recorder.RecordEstimate(in_recovery, in_slow_start, bandwidth, estimate_time,
wall_time, srtt);
EXPECT_EQ(recorder.BandwidthEstimate(), bandwidth);
estimate_time = estimate_time.Add(srtt.Multiply(3));
- const int32 kSeconds = 556677;
+ const int64 kSeconds = 556677;
QuicWallTime second_bandwidth_wall_time =
QuicWallTime::FromUNIXSeconds(kSeconds);
- recorder.RecordEstimate(true, false, second_bandwidth, estimate_time,
- second_bandwidth_wall_time, srtt);
+ recorder.RecordEstimate(in_recovery, in_slow_start, second_bandwidth,
+ estimate_time, second_bandwidth_wall_time, srtt);
EXPECT_EQ(recorder.BandwidthEstimate(), second_bandwidth);
EXPECT_EQ(recorder.BandwidthEstimate(), recorder.MaxBandwidthEstimate());
EXPECT_EQ(recorder.MaxBandwidthTimestamp(), kSeconds);
@@ -69,15 +74,15 @@ TEST(QuicSustainedBandwidthRecorderTest, BandwidthEstimates) {
QuicBandwidth third_bandwidth =
QuicBandwidth::FromBitsPerSecond(0.5 * kBandwidthBitsPerSecond);
// Reset the recorder by passing in an unreliable measurement.
- 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);
+ recorder.RecordEstimate(in_recovery, in_slow_start, third_bandwidth,
+ estimate_time, wall_time, srtt);
+ recorder.RecordEstimate(in_recovery, in_slow_start, third_bandwidth,
+ estimate_time, wall_time, srtt);
+ EXPECT_EQ(recorder.BandwidthEstimate(), third_bandwidth);
estimate_time = estimate_time.Add(srtt.Multiply(3));
- recorder.RecordEstimate(true, false, third_bandwidth, estimate_time,
- wall_time, srtt);
+ recorder.RecordEstimate(in_recovery, in_slow_start, third_bandwidth,
+ estimate_time, wall_time, srtt);
EXPECT_EQ(recorder.BandwidthEstimate(), third_bandwidth);
// Max bandwidth should not have changed.
@@ -98,15 +103,16 @@ TEST(QuicSustainedBandwidthRecorderTest, SlowStart) {
QuicBandwidth bandwidth =
QuicBandwidth::FromBitsPerSecond(kBandwidthBitsPerSecond);
+ bool in_recovery = false;
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,
+ recorder.RecordEstimate(in_recovery, 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,
+ recorder.RecordEstimate(in_recovery, in_slow_start, bandwidth, estimate_time,
wall_time, srtt);
EXPECT_TRUE(recorder.HasEstimate());
EXPECT_TRUE(recorder.EstimateRecordedDuringSlowStart());
@@ -114,7 +120,7 @@ TEST(QuicSustainedBandwidthRecorderTest, SlowStart) {
// 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,
+ recorder.RecordEstimate(in_recovery, in_slow_start, bandwidth, estimate_time,
wall_time, srtt);
EXPECT_TRUE(recorder.HasEstimate());
EXPECT_FALSE(recorder.EstimateRecordedDuringSlowStart());
« no previous file with comments | « net/quic/quic_sustained_bandwidth_recorder.cc ('k') | net/quic/quic_unacked_packet_map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698