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

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: Minor fix in DCHECK evaluation Created 4 years, 6 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.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 c48d4f34578110923037dd4a2b46af05b58e0c23..52d5bf7b81646c31193df6016d0e377591a97eda 100644
--- a/net/nqe/network_quality_estimator_unittest.cc
+++ b/net/nqe/network_quality_estimator_unittest.cc
@@ -572,6 +572,34 @@ TEST(NetworkQualityEstimatorTest, ObtainOperatingParams) {
EXPECT_FALSE(estimator.GetDownlinkThroughputKbpsEstimate(&kbps));
}
+TEST(NetworkQualityEstimatorTest, ObtainAlgorithmToUseFromParams) {
+ const struct {
+ bool set_variation_param;
+ std::string algorithm;
+ NetworkQualityEstimator::EffectiveConnectionTypeAlgorithm
+ expected_algorithm;
+ } tests[] = {
+ {false, "", NetworkQualityEstimator::EffectiveConnectionTypeAlgorithm::
+ HTTP_RTT_AND_DOWNSTREAM_THROUGHOUT},
+ {true, "", NetworkQualityEstimator::EffectiveConnectionTypeAlgorithm::
+ HTTP_RTT_AND_DOWNSTREAM_THROUGHOUT},
+ {true, "HttpRTTAndDownstreamThroughput",
+ NetworkQualityEstimator::EffectiveConnectionTypeAlgorithm::
+ HTTP_RTT_AND_DOWNSTREAM_THROUGHOUT},
+ };
+
+ for (const auto& test : tests) {
+ std::map<std::string, std::string> variation_params;
+ if (test.set_variation_param)
+ variation_params["effective_connection_type_algorithm"] = test.algorithm;
+
+ TestNetworkQualityEstimator estimator(variation_params);
+ EXPECT_EQ(test.expected_algorithm,
+ estimator.effective_connection_type_algorithm_)
+ << test.algorithm;
+ }
+}
+
// Tests that |GetEffectiveConnectionType| returns correct connection type when
// no variation params are specified.
TEST(NetworkQualityEstimatorTest, ObtainThresholdsNone) {
@@ -596,6 +624,7 @@ TEST(NetworkQualityEstimatorTest, ObtainThresholdsNone) {
estimator.set_http_rtt(base::TimeDelta::FromMilliseconds(test.rtt_msec));
estimator.set_recent_http_rtt(
base::TimeDelta::FromMilliseconds(test.rtt_msec));
+ estimator.set_downlink_throughput_kbps(INT32_MAX);
EXPECT_EQ(test.expected_conn_type, estimator.GetEffectiveConnectionType());
}
}
@@ -667,6 +696,7 @@ TEST(NetworkQualityEstimatorTest, ObtainThresholdsOnlyRTT) {
estimator.set_http_rtt(base::TimeDelta::FromMilliseconds(test.rtt_msec));
estimator.set_recent_http_rtt(
base::TimeDelta::FromMilliseconds(test.rtt_msec));
+ estimator.set_downlink_throughput_kbps(INT32_MAX);
EXPECT_EQ(test.expected_conn_type, estimator.GetEffectiveConnectionType());
}
}
@@ -719,9 +749,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) {
« no previous file with comments | « net/nqe/network_quality_estimator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698