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

Unified Diff: net/nqe/network_quality_estimator_unittest.cc

Issue 2453653002: Separate out observation sources as either HTTP layer or transport layer (Closed)
Patch Set: ps Created 4 years, 1 month 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
Index: net/nqe/network_quality_estimator_unittest.cc
diff --git a/net/nqe/network_quality_estimator_unittest.cc b/net/nqe/network_quality_estimator_unittest.cc
index 81ae4622d86c426f1302a1adda9cba1241d109e7..e5bc8a6da577dc963e5e37ae2a86b9d74be4739b 100644
--- a/net/nqe/network_quality_estimator_unittest.cc
+++ b/net/nqe/network_quality_estimator_unittest.cc
@@ -368,9 +368,9 @@ TEST(NetworkQualityEstimatorTest, ComputedPercentiles) {
std::vector<NetworkQualityObservationSource> disallowed_observation_sources;
disallowed_observation_sources.push_back(
- NETWORK_QUALITY_OBSERVATION_SOURCE_TCP);
+ NETWORK_QUALITY_OBSERVATION_SOURCE_TRANSPORT);
disallowed_observation_sources.push_back(
- NETWORK_QUALITY_OBSERVATION_SOURCE_QUIC);
+ NETWORK_QUALITY_OBSERVATION_SOURCE_TRANSPORT);
EXPECT_EQ(nqe::internal::InvalidRTT(),
estimator.GetRTTEstimateInternal(disallowed_observation_sources,
@@ -951,14 +951,13 @@ TEST(NetworkQualityEstimatorTest, TestGetMetricsSince) {
for (size_t i = 0; i < 2; ++i) {
estimator.downstream_throughput_kbps_observations_.AddObservation(
NetworkQualityEstimator::ThroughputObservation(
- old_downlink_kbps, old,
- NETWORK_QUALITY_OBSERVATION_SOURCE_URL_REQUEST));
+ old_downlink_kbps, old, NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP));
estimator.rtt_observations_.AddObservation(
NetworkQualityEstimator::RttObservation(
- old_url_rtt, old, NETWORK_QUALITY_OBSERVATION_SOURCE_URL_REQUEST));
+ old_url_rtt, old, NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP));
estimator.rtt_observations_.AddObservation(
NetworkQualityEstimator::RttObservation(
- old_tcp_rtt, old, NETWORK_QUALITY_OBSERVATION_SOURCE_TCP));
+ old_tcp_rtt, old, NETWORK_QUALITY_OBSERVATION_SOURCE_TRANSPORT));
}
const int32_t new_downlink_kbps = 100;
@@ -975,14 +974,13 @@ TEST(NetworkQualityEstimatorTest, TestGetMetricsSince) {
estimator.downstream_throughput_kbps_observations_.AddObservation(
NetworkQualityEstimator::ThroughputObservation(
- new_downlink_kbps, now,
- NETWORK_QUALITY_OBSERVATION_SOURCE_URL_REQUEST));
+ new_downlink_kbps, now, NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP));
estimator.rtt_observations_.AddObservation(
NetworkQualityEstimator::RttObservation(
- new_url_rtt, now, NETWORK_QUALITY_OBSERVATION_SOURCE_URL_REQUEST));
+ new_url_rtt, now, NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP));
estimator.rtt_observations_.AddObservation(
NetworkQualityEstimator::RttObservation(
- new_tcp_rtt, now, NETWORK_QUALITY_OBSERVATION_SOURCE_TCP));
+ new_tcp_rtt, now, NETWORK_QUALITY_OBSERVATION_SOURCE_TRANSPORT));
const struct {
base::TimeTicks start_timestamp;
@@ -1477,7 +1475,7 @@ TEST(NetworkQualityEstimatorTest, UnknownEffectiveConnectionType) {
NetworkQualityEstimator::RttObservation rtt_observation(
base::TimeDelta::FromSeconds(5), tick_clock_ptr->NowTicks(),
- NETWORK_QUALITY_OBSERVATION_SOURCE_URL_REQUEST);
+ NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP);
for (size_t i = 0; i < 10; ++i) {
estimator.NotifyObserversOfRTT(rtt_observation);
@@ -1491,7 +1489,7 @@ TEST(NetworkQualityEstimatorTest, UnknownEffectiveConnectionType) {
// type since the last computed effective connection type was unknown.
estimator.NotifyObserversOfRTT(NetworkQualityEstimator::RttObservation(
base::TimeDelta::FromSeconds(5), tick_clock_ptr->NowTicks(),
- NETWORK_QUALITY_OBSERVATION_SOURCE_URL_REQUEST));
+ NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP));
++expected_effective_connection_type_notifications;
EXPECT_EQ(expected_effective_connection_type_notifications,
observer.effective_connection_types().size());
@@ -1564,11 +1562,11 @@ TEST(NetworkQualityEstimatorTest,
estimator.rtt_observations_.AddObservation(
NetworkQualityEstimator::RttObservation(
base::TimeDelta::FromSeconds(5), tick_clock_ptr->NowTicks(),
- NETWORK_QUALITY_OBSERVATION_SOURCE_URL_REQUEST));
+ NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP));
estimator.NotifyObserversOfRTT(NetworkQualityEstimator::RttObservation(
base::TimeDelta::FromSeconds(5), tick_clock_ptr->NowTicks(),
- NETWORK_QUALITY_OBSERVATION_SOURCE_URL_REQUEST));
+ NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP));
if (i == rtt_observations_count) {
// Effective connection type must be recomputed since the number of RTT
@@ -1623,14 +1621,12 @@ TEST(NetworkQualityEstimatorTest, TestRttThroughputObservers) {
for (const auto& observation : rtt_observer.observations()) {
EXPECT_LE(0, observation.rtt_ms);
EXPECT_LE(0, (observation.timestamp - then).InMilliseconds());
- EXPECT_EQ(NETWORK_QUALITY_OBSERVATION_SOURCE_URL_REQUEST,
- observation.source);
+ EXPECT_EQ(NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP, observation.source);
}
for (const auto& observation : throughput_observer.observations()) {
EXPECT_LE(0, observation.throughput_kbps);
EXPECT_LE(0, (observation.timestamp - then).InMilliseconds());
- EXPECT_EQ(NETWORK_QUALITY_OBSERVATION_SOURCE_URL_REQUEST,
- observation.source);
+ EXPECT_EQ(NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP, observation.source);
}
EXPECT_FALSE(estimator.GetTransportRTT(&rtt));
@@ -1703,7 +1699,7 @@ TEST(NetworkQualityEstimatorTest, MAYBE_TestTCPSocketRTT) {
for (size_t i = 0; i < num_requests; ++i) {
size_t before_count_tcp_rtt_observations = 0;
for (const auto& observation : rtt_observer.observations()) {
- if (observation.source == NETWORK_QUALITY_OBSERVATION_SOURCE_TCP)
+ if (observation.source == NETWORK_QUALITY_OBSERVATION_SOURCE_TRANSPORT)
++before_count_tcp_rtt_observations;
}
@@ -1715,7 +1711,7 @@ TEST(NetworkQualityEstimatorTest, MAYBE_TestTCPSocketRTT) {
size_t after_count_tcp_rtt_observations = 0;
for (const auto& observation : rtt_observer.observations()) {
- if (observation.source == NETWORK_QUALITY_OBSERVATION_SOURCE_TCP)
+ if (observation.source == NETWORK_QUALITY_OBSERVATION_SOURCE_TRANSPORT)
++after_count_tcp_rtt_observations;
}
// At least one notification should be received per socket performance

Powered by Google App Engine
This is Rietveld 408576698