diff --git a/chromeos/CHROMEOS_LKGM b/chromeos/CHROMEOS_LKGM index 1561b67..935e994 100644 --- a/chromeos/CHROMEOS_LKGM +++ b/chromeos/CHROMEOS_LKGM
@@ -1 +1 @@ -9227.0.0 \ No newline at end of file +9229.0.0 \ No newline at end of file
diff --git a/components/metrics/net/network_metrics_provider.cc b/components/metrics/net/network_metrics_provider.cc index d392bf81..bf56530 100644 --- a/components/metrics/net/network_metrics_provider.cc +++ b/components/metrics/net/network_metrics_provider.cc
@@ -225,6 +225,7 @@ if (type != connection_type_ && connection_type_ != net::NetworkChangeNotifier::CONNECTION_NONE) { connection_type_is_ambiguous_ = true; + effective_connection_type_is_ambiguous_ = true; } connection_type_ = type;
diff --git a/components/metrics/net/network_metrics_provider.h b/components/metrics/net/network_metrics_provider.h index 2eccee04..1c23bea 100644 --- a/components/metrics/net/network_metrics_provider.h +++ b/components/metrics/net/network_metrics_provider.h
@@ -64,6 +64,8 @@ private: FRIEND_TEST_ALL_PREFIXES(NetworkMetricsProviderTest, EffectiveConnectionType); + FRIEND_TEST_ALL_PREFIXES(NetworkMetricsProviderTest, + ECTAmbiguousOnConnectionTypeChange); // Listens to the changes in the effective conection type. class EffectiveConnectionTypeObserver;
diff --git a/components/metrics/net/network_metrics_provider_unittest.cc b/components/metrics/net/network_metrics_provider_unittest.cc index a8b2c2a..7006ee14 100644 --- a/components/metrics/net/network_metrics_provider_unittest.cc +++ b/components/metrics/net/network_metrics_provider_unittest.cc
@@ -47,15 +47,21 @@ } // namespace -// Verifies that the effective connection type is correctly set. -TEST(NetworkMetricsProviderTest, EffectiveConnectionType) { - base::MessageLoop loop(base::MessageLoop::TYPE_IO); - +class NetworkMetricsProviderTest : public testing::Test { + protected: + NetworkMetricsProviderTest() : loop_(base::MessageLoop::TYPE_IO) { #if defined(OS_CHROMEOS) - chromeos::DBusThreadManager::Initialize(); - chromeos::NetworkHandler::Initialize(); + chromeos::DBusThreadManager::Initialize(); + chromeos::NetworkHandler::Initialize(); #endif // OS_CHROMEOS + } + private: + base::MessageLoop loop_; +}; + +// Verifies that the effective connection type is correctly set. +TEST_F(NetworkMetricsProviderTest, EffectiveConnectionType) { net::TestNetworkQualityEstimator estimator; std::unique_ptr<NetworkMetricsProvider::NetworkQualityEstimatorProvider> estimator_provider(base::WrapUnique( @@ -111,4 +117,28 @@ system_profile.network().effective_connection_type()); } +// Verifies that the effective connection type is set to AMBIGUOUS when there is +// a change in the connection type. +TEST_F(NetworkMetricsProviderTest, ECTAmbiguousOnConnectionTypeChange) { + net::TestNetworkQualityEstimator estimator; + std::unique_ptr<NetworkMetricsProvider::NetworkQualityEstimatorProvider> + estimator_provider(base::WrapUnique( + new TestNetworkQualityEstimatorProvider(&estimator))); + SystemProfileProto system_profile; + NetworkMetricsProvider network_metrics_provider( + std::move(estimator_provider), base::ThreadTaskRunnerHandle::Get().get()); + + EXPECT_EQ(net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN, + network_metrics_provider.effective_connection_type_); + EXPECT_FALSE( + network_metrics_provider.effective_connection_type_is_ambiguous_); + + network_metrics_provider.OnConnectionTypeChanged( + net::NetworkChangeNotifier::CONNECTION_2G); + EXPECT_TRUE(network_metrics_provider.effective_connection_type_is_ambiguous_); + network_metrics_provider.ProvideSystemProfileMetrics(&system_profile); + EXPECT_EQ(SystemProfileProto::Network::EFFECTIVE_CONNECTION_TYPE_AMBIGUOUS, + system_profile.network().effective_connection_type()); +} + } // namespace metrics \ No newline at end of file