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

Unified Diff: net/nqe/network_quality_estimator_unittest.cc

Issue 2116893002: NQE: Record how frequently NetworkID is available (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
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 40a28c55e53f7c6b7c6f6b608aa9dabc8df9d546..23db17734663537a0fab06588b7a7979f2e3eb74 100644
--- a/net/nqe/network_quality_estimator_unittest.cc
+++ b/net/nqe/network_quality_estimator_unittest.cc
@@ -1812,4 +1812,39 @@ TEST(NetworkQualityEstimatorTest, NameConnectionTypeConversion) {
}
}
+TEST(NetworkQualityEstimatorTest, TestRecordNetworkIDAvailability) {
+ base::HistogramTester histogram_tester;
+ std::map<std::string, std::string> variation_params;
+ TestNetworkQualityEstimator estimator(variation_params);
+
+ // Network ID is recorded as available on Wi-Fi connection.
bengr 2016/07/08 17:00:07 Network -> The network
tbansal1 2016/07/08 18:39:08 Done.
+ estimator.SimulateNetworkChangeTo(
+ NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI, "test-1");
+ histogram_tester.ExpectUniqueSample("NQE.NetworkIdAvailable", 1, 1);
+
+ // Histogram is not recorded on unknown connection.
bengr 2016/07/08 17:00:07 Histogram -> The histogram on -> on an
tbansal1 2016/07/08 18:39:08 Done.
+ estimator.SimulateNetworkChangeTo(
+ NetworkChangeNotifier::ConnectionType::CONNECTION_UNKNOWN, "");
+ histogram_tester.ExpectTotalCount("NQE.NetworkIdAvailable", 1);
+
+ // Network ID is recorded as not available on Wi-Fi connection with empty
bengr 2016/07/08 17:00:07 Network -> The network not -> not being on -> on a
tbansal1 2016/07/08 18:39:08 Done.
+ // SSID.
+ estimator.SimulateNetworkChangeTo(
+ NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI, "");
+ histogram_tester.ExpectBucketCount("NQE.NetworkIdAvailable", 0, 1);
+ histogram_tester.ExpectTotalCount("NQE.NetworkIdAvailable", 2);
+
+ // Network ID is recorded as available on Wi-Fi connection.
bengr 2016/07/08 17:00:07 Network -> The network as -> as being on -> on a
tbansal1 2016/07/08 18:39:08 Done.
+ estimator.SimulateNetworkChangeTo(
+ NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI, "test-1");
+ histogram_tester.ExpectBucketCount("NQE.NetworkIdAvailable", 1, 2);
+ histogram_tester.ExpectTotalCount("NQE.NetworkIdAvailable", 3);
+
+ // Network ID is recorded as available on cellular connection.
bengr 2016/07/08 17:00:07 Network -> The network as -> as being on -> on a
tbansal1 2016/07/08 18:39:08 Done.
+ estimator.SimulateNetworkChangeTo(
+ NetworkChangeNotifier::ConnectionType::CONNECTION_2G, "test-1");
+ histogram_tester.ExpectBucketCount("NQE.NetworkIdAvailable", 1, 3);
+ histogram_tester.ExpectTotalCount("NQE.NetworkIdAvailable", 4);
+}
+
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698