Index: net/base/network_quality_estimator_unittest.cc |
diff --git a/net/base/network_quality_estimator_unittest.cc b/net/base/network_quality_estimator_unittest.cc |
index 3f6854b00d7a2fe52e8199c996ff4769a8fc3cba..781fccc96c3f654a6c3153d03f0f0db5fa5ce5a0 100644 |
--- a/net/base/network_quality_estimator_unittest.cc |
+++ b/net/base/network_quality_estimator_unittest.cc |
@@ -250,18 +250,22 @@ TEST(NetworkQualityEstimatorTest, PercentileSameTimestamps) { |
// samples. This helps in verifying that the order of samples does not matter. |
for (int i = 1; i <= 99; i += 2) { |
estimator.downstream_throughput_kbps_observations_.AddObservation( |
- NetworkQualityEstimator::Observation(i, now)); |
+ NetworkQualityEstimator::Observation( |
+ i, now, NetworkQualityEstimator::URL_REQUEST)); |
estimator.rtt_msec_observations_.AddObservation( |
- NetworkQualityEstimator::Observation(i, now)); |
+ NetworkQualityEstimator::Observation( |
+ i, now, NetworkQualityEstimator::URL_REQUEST)); |
EXPECT_TRUE(estimator.GetRTTEstimate(&rtt)); |
EXPECT_TRUE(estimator.GetDownlinkThroughputKbpsEstimate(&kbps)); |
} |
for (int i = 2; i <= 100; i += 2) { |
estimator.downstream_throughput_kbps_observations_.AddObservation( |
- NetworkQualityEstimator::Observation(i, now)); |
+ NetworkQualityEstimator::Observation( |
+ i, now, NetworkQualityEstimator::URL_REQUEST)); |
estimator.rtt_msec_observations_.AddObservation( |
- NetworkQualityEstimator::Observation(i, now)); |
+ NetworkQualityEstimator::Observation( |
+ i, now, NetworkQualityEstimator::URL_REQUEST)); |
EXPECT_TRUE(estimator.GetRTTEstimate(&rtt)); |
EXPECT_TRUE(estimator.GetDownlinkThroughputKbpsEstimate(&kbps)); |
} |
@@ -302,17 +306,21 @@ TEST(NetworkQualityEstimatorTest, PercentileDifferentTimestamps) { |
// First 50 samples have very old timestamp. |
for (int i = 1; i <= 50; ++i) { |
estimator.downstream_throughput_kbps_observations_.AddObservation( |
- NetworkQualityEstimator::Observation(i, very_old)); |
+ NetworkQualityEstimator::Observation( |
+ i, very_old, NetworkQualityEstimator::URL_REQUEST)); |
estimator.rtt_msec_observations_.AddObservation( |
- NetworkQualityEstimator::Observation(i, very_old)); |
+ NetworkQualityEstimator::Observation( |
+ i, very_old, NetworkQualityEstimator::URL_REQUEST)); |
} |
// Next 50 (i.e., from 51 to 100) have recent timestamp. |
for (int i = 51; i <= 100; ++i) { |
estimator.downstream_throughput_kbps_observations_.AddObservation( |
- NetworkQualityEstimator::Observation(i, now)); |
+ NetworkQualityEstimator::Observation( |
+ i, now, NetworkQualityEstimator::URL_REQUEST)); |
estimator.rtt_msec_observations_.AddObservation( |
- NetworkQualityEstimator::Observation(i, now)); |
+ NetworkQualityEstimator::Observation( |
+ i, now, NetworkQualityEstimator::URL_REQUEST)); |
} |
// Older samples have very little weight. So, all percentiles are >= 51 |
@@ -513,9 +521,11 @@ TEST(NetworkQualityEstimatorTest, TestCaching) { |
// Cache entry will not be added for (NONE, ""). |
estimator.downstream_throughput_kbps_observations_.AddObservation( |
- NetworkQualityEstimator::Observation(1, base::TimeTicks::Now())); |
+ NetworkQualityEstimator::Observation( |
+ 1, base::TimeTicks::Now(), NetworkQualityEstimator::URL_REQUEST)); |
estimator.rtt_msec_observations_.AddObservation( |
- NetworkQualityEstimator::Observation(1000, base::TimeTicks::Now())); |
+ NetworkQualityEstimator::Observation( |
+ 1000, base::TimeTicks::Now(), NetworkQualityEstimator::URL_REQUEST)); |
estimator.SimulateNetworkChangeTo( |
NetworkChangeNotifier::ConnectionType::CONNECTION_2G, "test-1"); |
EXPECT_EQ(expected_cache_size, estimator.cached_network_qualities_.size()); |
@@ -524,9 +534,11 @@ TEST(NetworkQualityEstimatorTest, TestCaching) { |
// Also, set the network quality for (2G, "test1") so that it is stored in |
// the cache. |
estimator.downstream_throughput_kbps_observations_.AddObservation( |
- NetworkQualityEstimator::Observation(1, base::TimeTicks::Now())); |
+ NetworkQualityEstimator::Observation( |
+ 1, base::TimeTicks::Now(), NetworkQualityEstimator::URL_REQUEST)); |
estimator.rtt_msec_observations_.AddObservation( |
- NetworkQualityEstimator::Observation(1000, base::TimeTicks::Now())); |
+ NetworkQualityEstimator::Observation( |
+ 1000, base::TimeTicks::Now(), NetworkQualityEstimator::URL_REQUEST)); |
estimator.SimulateNetworkChangeTo( |
NetworkChangeNotifier::ConnectionType::CONNECTION_3G, "test-1"); |
@@ -537,9 +549,11 @@ TEST(NetworkQualityEstimatorTest, TestCaching) { |
// Also, set the network quality for (3G, "test1") so that it is stored in |
// the cache. |
estimator.downstream_throughput_kbps_observations_.AddObservation( |
- NetworkQualityEstimator::Observation(2, base::TimeTicks::Now())); |
+ NetworkQualityEstimator::Observation( |
+ 2, base::TimeTicks::Now(), NetworkQualityEstimator::URL_REQUEST)); |
estimator.rtt_msec_observations_.AddObservation( |
- NetworkQualityEstimator::Observation(500, base::TimeTicks::Now())); |
+ NetworkQualityEstimator::Observation( |
+ 500, base::TimeTicks::Now(), NetworkQualityEstimator::URL_REQUEST)); |
estimator.SimulateNetworkChangeTo( |
NetworkChangeNotifier::ConnectionType::CONNECTION_3G, "test-2"); |
++expected_cache_size; |
@@ -603,9 +617,11 @@ TEST(NetworkQualityEstimatorTest, TestLRUCacheMaximumSize) { |
base::TimeTicks update_time_of_network_100; |
for (size_t i = 0; i < network_count; ++i) { |
estimator.downstream_throughput_kbps_observations_.AddObservation( |
- NetworkQualityEstimator::Observation(2, base::TimeTicks::Now())); |
+ NetworkQualityEstimator::Observation( |
+ 2, base::TimeTicks::Now(), NetworkQualityEstimator::URL_REQUEST)); |
estimator.rtt_msec_observations_.AddObservation( |
- NetworkQualityEstimator::Observation(500, base::TimeTicks::Now())); |
+ NetworkQualityEstimator::Observation( |
+ 500, base::TimeTicks::Now(), NetworkQualityEstimator::URL_REQUEST)); |
if (i == 100) |
update_time_of_network_100 = base::TimeTicks::Now(); |
@@ -621,9 +637,11 @@ TEST(NetworkQualityEstimatorTest, TestLRUCacheMaximumSize) { |
} |
// One more call so that the last network is also written to cache. |
estimator.downstream_throughput_kbps_observations_.AddObservation( |
- NetworkQualityEstimator::Observation(2, base::TimeTicks::Now())); |
+ NetworkQualityEstimator::Observation( |
+ 2, base::TimeTicks::Now(), NetworkQualityEstimator::URL_REQUEST)); |
estimator.rtt_msec_observations_.AddObservation( |
- NetworkQualityEstimator::Observation(500, base::TimeTicks::Now())); |
+ NetworkQualityEstimator::Observation( |
+ 500, base::TimeTicks::Now(), NetworkQualityEstimator::URL_REQUEST)); |
estimator.SimulateNetworkChangeTo( |
net::NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI, |
base::SizeTToString(network_count - 1)); |
@@ -649,14 +667,18 @@ TEST(NetworkQualityEstimatorTest, TestGetMedianRTTSince) { |
// First sample has very old timestamp. |
estimator.downstream_throughput_kbps_observations_.AddObservation( |
- NetworkQualityEstimator::Observation(1, old)); |
+ NetworkQualityEstimator::Observation( |
+ 1, old, NetworkQualityEstimator::URL_REQUEST)); |
estimator.rtt_msec_observations_.AddObservation( |
- NetworkQualityEstimator::Observation(1, old)); |
+ NetworkQualityEstimator::Observation( |
+ 1, old, NetworkQualityEstimator::URL_REQUEST)); |
estimator.downstream_throughput_kbps_observations_.AddObservation( |
- NetworkQualityEstimator::Observation(100, now)); |
+ NetworkQualityEstimator::Observation( |
+ 100, now, NetworkQualityEstimator::URL_REQUEST)); |
estimator.rtt_msec_observations_.AddObservation( |
- NetworkQualityEstimator::Observation(100, now)); |
+ NetworkQualityEstimator::Observation( |
+ 100, now, NetworkQualityEstimator::URL_REQUEST)); |
base::TimeDelta rtt; |
EXPECT_FALSE(estimator.GetRecentMedianRTT( |