| 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) {
|
|
|