| 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 f3a4962e11ee14296925ad4e49a70e241c76d075..f0a102081ab3aed7886a641901fa0ddfc2fab8ca 100644
|
| --- a/net/nqe/network_quality_estimator_unittest.cc
|
| +++ b/net/nqe/network_quality_estimator_unittest.cc
|
| @@ -75,7 +75,7 @@ class TestNetworkQualityEstimator : public NetworkQualityEstimator {
|
| // Overrides the current network type and id.
|
| // Notifies network quality estimator of change in connection.
|
| void SimulateNetworkChangeTo(NetworkChangeNotifier::ConnectionType type,
|
| - std::string network_id) {
|
| + const std::string& network_id) {
|
| current_network_type_ = type;
|
| current_network_id_ = network_id;
|
| OnConnectionTypeChanged(type);
|
| @@ -431,6 +431,32 @@ TEST(NetworkQualityEstimatorTest, ObtainThresholdsNone) {
|
| }
|
| }
|
|
|
| +// Tests that |GetEffectiveConnectionType| returns
|
| +// EFFECTIVE_CONNECTION_TYPE_OFFLINE when the device is currently offline.
|
| +TEST(NetworkQualityEstimatorTest, Offline) {
|
| + std::map<std::string, std::string> variation_params;
|
| +
|
| + TestNetworkQualityEstimator estimator(variation_params);
|
| +
|
| + const struct {
|
| + NetworkChangeNotifier::ConnectionType connection_type;
|
| + NetworkQualityEstimator::EffectiveConnectionType expected_connection_type;
|
| + } tests[] = {
|
| + {NetworkChangeNotifier::CONNECTION_2G,
|
| + NetworkQualityEstimator::EFFECTIVE_CONNECTION_TYPE_UNKNOWN},
|
| + {NetworkChangeNotifier::CONNECTION_NONE,
|
| + NetworkQualityEstimator::EFFECTIVE_CONNECTION_TYPE_OFFLINE},
|
| + {NetworkChangeNotifier::CONNECTION_3G,
|
| + NetworkQualityEstimator::EFFECTIVE_CONNECTION_TYPE_UNKNOWN},
|
| + };
|
| +
|
| + for (const auto& test : tests) {
|
| + estimator.SimulateNetworkChangeTo(test.connection_type, "test");
|
| + EXPECT_EQ(test.expected_connection_type,
|
| + estimator.GetEffectiveConnectionType());
|
| + }
|
| +}
|
| +
|
| // Tests that |GetEffectiveConnectionType| returns correct connection type when
|
| // only RTT thresholds are specified in the variation params.
|
| TEST(NetworkQualityEstimatorTest, ObtainThresholdsOnlyRTT) {
|
|
|