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

Unified Diff: net/nqe/network_quality_estimator_unittest.cc

Issue 2032443003: NQE: Allow algorithm to be set using variation params (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 a8e7002075c5d9476c05e940a2385a1b7e1e2379..6c28cdd11b494bba2db5786419d29249568f3204 100644
--- a/net/nqe/network_quality_estimator_unittest.cc
+++ b/net/nqe/network_quality_estimator_unittest.cc
@@ -491,6 +491,23 @@ TEST(NetworkQualityEstimatorTest, ObtainOperatingParams) {
EXPECT_FALSE(estimator.GetDownlinkThroughputKbpsEstimate(&kbps));
}
+TEST(NetworkQualityEstimatorTest, ObtainAlgorithmToUseFromParams) {
+ const struct {
+ std::string algorithm;
+ int32_t expected_algorithm;
+ } tests[] = {
+ {"", 0}, {"0", 0}, {"1", 1}, {"2", 2}, {"100", 100},
+ };
+
+ for (const auto& test : tests) {
+ std::map<std::string, std::string> variation_params;
+ variation_params["algorithm"] = test.algorithm;
+
+ TestNetworkQualityEstimator estimator(variation_params);
+ EXPECT_EQ(test.expected_algorithm, estimator.algorithm_) << test.algorithm;
+ }
+}
+
// Tests that |GetEffectiveConnectionType| returns correct connection type when
// no variation params are specified.
TEST(NetworkQualityEstimatorTest, ObtainThresholdsNone) {
@@ -513,6 +530,7 @@ TEST(NetworkQualityEstimatorTest, ObtainThresholdsNone) {
for (const auto& test : tests) {
estimator.set_http_rtt(base::TimeDelta::FromMilliseconds(test.rtt_msec));
+ estimator.set_downlink_throughput_kbps(INT32_MAX);
EXPECT_EQ(test.expected_conn_type, estimator.GetEffectiveConnectionType());
}
}
@@ -582,6 +600,7 @@ TEST(NetworkQualityEstimatorTest, ObtainThresholdsOnlyRTT) {
for (const auto& test : tests) {
estimator.set_http_rtt(base::TimeDelta::FromMilliseconds(test.rtt_msec));
+ estimator.set_downlink_throughput_kbps(INT32_MAX);
EXPECT_EQ(test.expected_conn_type, estimator.GetEffectiveConnectionType());
}
}
@@ -634,9 +653,6 @@ TEST(NetworkQualityEstimatorTest, ObtainThresholdsRTTandThroughput) {
// Set both RTT and throughput. RTT is the bottleneck.
{3000, 25000, NetworkQualityEstimator::EFFECTIVE_CONNECTION_TYPE_SLOW_2G},
{700, 25000, NetworkQualityEstimator::EFFECTIVE_CONNECTION_TYPE_3G},
- // Set throughput to an invalid value.
- {3000, 0, NetworkQualityEstimator::EFFECTIVE_CONNECTION_TYPE_SLOW_2G},
- {700, 0, NetworkQualityEstimator::EFFECTIVE_CONNECTION_TYPE_3G},
};
for (const auto& test : tests) {
« net/nqe/network_quality_estimator.cc ('K') | « net/nqe/network_quality_estimator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698