| 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..581fc328baf94da9a712e392518cea50d373966c 100644
|
| --- a/net/nqe/network_quality_estimator_unittest.cc
|
| +++ b/net/nqe/network_quality_estimator_unittest.cc
|
| @@ -491,6 +491,28 @@ TEST(NetworkQualityEstimatorTest, ObtainOperatingParams) {
|
| EXPECT_FALSE(estimator.GetDownlinkThroughputKbpsEstimate(&kbps));
|
| }
|
|
|
| +TEST(NetworkQualityEstimatorTest, ObtainAlgorithmToUseFromParams) {
|
| + const struct {
|
| + bool set_variation_param;
|
| + std::string algorithm;
|
| + std::string expected_algorithm;
|
| + } tests[] = {
|
| + {false, "", "HttpRTTAndDownstreamThroughput"},
|
| + {true, "", "HttpRTTAndDownstreamThroughput"},
|
| + {true, "HttpRTTAndDownstreamThroughput",
|
| + "HttpRTTAndDownstreamThroughput"},
|
| + };
|
| +
|
| + for (const auto& test : tests) {
|
| + std::map<std::string, std::string> variation_params;
|
| + if (test.set_variation_param)
|
| + 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 +535,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 +605,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 +658,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) {
|
|
|