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

Unified Diff: components/metrics/net/network_metrics_provider_unittest.cc

Issue 2661563004: Mark ECT as ambiguous if there is a change in the connection type. (Closed)
Patch Set: ps Created 3 years, 11 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 | « components/metrics/net/network_metrics_provider.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/metrics/net/network_metrics_provider_unittest.cc
diff --git a/components/metrics/net/network_metrics_provider_unittest.cc b/components/metrics/net/network_metrics_provider_unittest.cc
index a8b2c2ab04e4c8302ae58590e023f6a3845b3ac6..b1d57f8b557e728dcdf326df38b31148406ec7bc 100644
--- a/components/metrics/net/network_metrics_provider_unittest.cc
+++ b/components/metrics/net/network_metrics_provider_unittest.cc
@@ -111,4 +111,35 @@ TEST(NetworkMetricsProviderTest, EffectiveConnectionType) {
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(NetworkMetricsProviderTest, ECTAmbiguousOnConnectionTypeChange) {
+ base::MessageLoop loop(base::MessageLoop::TYPE_IO);
+
+#if defined(OS_CHROMEOS)
+ chromeos::DBusThreadManager::Initialize();
+ chromeos::NetworkHandler::Initialize();
+#endif // OS_CHROMEOS
Alexei Svitkine (slow) 2017/01/27 22:01:40 Nit: Can this goop go into the test harness ctor?
tbansal1 2017/01/29 07:12:27 Done.
+
+ 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 previous file with comments | « components/metrics/net/network_metrics_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698