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

Unified Diff: net/nqe/network_quality_estimator_params_unittest.cc

Issue 2875073004: Move more variables to NQE params class (Closed)
Patch Set: ryansturm comments Created 3 years, 7 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/nqe/network_quality_estimator_params.cc ('k') | net/nqe/network_quality_estimator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/nqe/network_quality_estimator_params_unittest.cc
diff --git a/net/nqe/network_quality_estimator_params_unittest.cc b/net/nqe/network_quality_estimator_params_unittest.cc
index 60776c35579232f618f4a948d45afa9185e3ca46..12be1723992c23674219a7ba24c0ad457a357cb4 100644
--- a/net/nqe/network_quality_estimator_params_unittest.cc
+++ b/net/nqe/network_quality_estimator_params_unittest.cc
@@ -45,6 +45,66 @@ TEST(NetworkQualityEstimatorParamsTest, HalfLifeParam) {
}
}
+// Test that the typical network qualities are set correctly.
+TEST(NetworkQualityEstimatorParamsTest, TypicalNetworkQualities) {
+ std::map<std::string, std::string> variation_params;
+ NetworkQualityEstimatorParams params(variation_params);
+
+ // Typical network quality should not be set for Unknown and Offline.
+ for (size_t i = EFFECTIVE_CONNECTION_TYPE_UNKNOWN;
+ i <= EFFECTIVE_CONNECTION_TYPE_OFFLINE; ++i) {
+ EffectiveConnectionType ect = static_cast<EffectiveConnectionType>(i);
+ EXPECT_EQ(nqe::internal::InvalidRTT(),
+ params.TypicalNetworkQuality(ect).http_rtt());
+
+ EXPECT_EQ(nqe::internal::InvalidRTT(),
+ params.TypicalNetworkQuality(ect).transport_rtt());
+ }
+
+ // Typical network quality should be set for other effective connection
+ // types.
+ for (size_t i = EFFECTIVE_CONNECTION_TYPE_SLOW_2G;
+ i <= EFFECTIVE_CONNECTION_TYPE_3G; ++i) {
+ EffectiveConnectionType ect = static_cast<EffectiveConnectionType>(i);
+ // The typical RTT for an effective connection type should be at least as
+ // much as the threshold RTT.
+ EXPECT_NE(nqe::internal::InvalidRTT(),
+ params.TypicalNetworkQuality(ect).http_rtt());
+ EXPECT_GT(params.TypicalNetworkQuality(ect).http_rtt(),
+ params.ConnectionThreshold(ect).http_rtt());
+
+ EXPECT_NE(nqe::internal::InvalidRTT(),
+ params.TypicalNetworkQuality(ect).transport_rtt());
+ EXPECT_GT(params.TypicalNetworkQuality(ect).transport_rtt(),
+ params.ConnectionThreshold(ect).transport_rtt());
+
+ // The typical throughput for an effective connection type should not be
+ // more than the threshold throughput.
+ if (params.ConnectionThreshold(ect).downstream_throughput_kbps() !=
+ nqe::internal::kInvalidThroughput) {
+ EXPECT_LT(params.TypicalNetworkQuality(ect).downstream_throughput_kbps(),
+ params.ConnectionThreshold(ect).downstream_throughput_kbps());
+ }
+ }
+
+ // The typical network quality of 4G connection should be at least as fast
+ // as the threshold for 3G connection.
+ EXPECT_LT(
+ params.TypicalNetworkQuality(EFFECTIVE_CONNECTION_TYPE_4G).http_rtt(),
+ params.ConnectionThreshold(EFFECTIVE_CONNECTION_TYPE_3G).http_rtt());
+ EXPECT_LT(
+ params.TypicalNetworkQuality(EFFECTIVE_CONNECTION_TYPE_4G)
+ .transport_rtt(),
+ params.ConnectionThreshold(EFFECTIVE_CONNECTION_TYPE_3G).transport_rtt());
+ if (params.ConnectionThreshold(EFFECTIVE_CONNECTION_TYPE_3G)
+ .downstream_throughput_kbps() != nqe::internal::kInvalidThroughput) {
+ EXPECT_GT(params.TypicalNetworkQuality(EFFECTIVE_CONNECTION_TYPE_4G)
+ .downstream_throughput_kbps(),
+ params.ConnectionThreshold(EFFECTIVE_CONNECTION_TYPE_3G)
+ .downstream_throughput_kbps());
+ }
+}
+
} // namespace
} // namespace internal
« no previous file with comments | « net/nqe/network_quality_estimator_params.cc ('k') | net/nqe/network_quality_estimator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698