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

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: rebased Created 4 years, 5 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 | « net/nqe/network_quality_estimator.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ce660825a042d5215c7b3d83ff064b9ef6930ace..a7777f50d6c158ea2229a9841daed1da7dc390b5 100644
--- a/net/nqe/network_quality_estimator_unittest.cc
+++ b/net/nqe/network_quality_estimator_unittest.cc
@@ -1949,4 +1949,39 @@ TEST(NetworkQualityEstimatorTest, NameConnectionTypeConversion) {
}
}
+TEST(NetworkQualityEstimatorTest, TestRecordNetworkIDAvailability) {
+ base::HistogramTester histogram_tester;
+ std::map<std::string, std::string> variation_params;
+ TestNetworkQualityEstimator estimator(variation_params);
+
+ // The NetworkID is recorded as available on Wi-Fi connection.
+ estimator.SimulateNetworkChangeTo(
+ NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI, "test-1");
+ histogram_tester.ExpectUniqueSample("NQE.NetworkIdAvailable", 1, 1);
+
+ // The histogram is not recorded on an unknown connection.
+ estimator.SimulateNetworkChangeTo(
+ NetworkChangeNotifier::ConnectionType::CONNECTION_UNKNOWN, "");
+ histogram_tester.ExpectTotalCount("NQE.NetworkIdAvailable", 1);
+
+ // The NetworkID is recorded as not being available on a Wi-Fi connection
+ // with an empty SSID.
+ estimator.SimulateNetworkChangeTo(
+ NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI, "");
+ histogram_tester.ExpectBucketCount("NQE.NetworkIdAvailable", 0, 1);
+ histogram_tester.ExpectTotalCount("NQE.NetworkIdAvailable", 2);
+
+ // The NetworkID is recorded as being available on a Wi-Fi connection.
+ estimator.SimulateNetworkChangeTo(
+ NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI, "test-1");
+ histogram_tester.ExpectBucketCount("NQE.NetworkIdAvailable", 1, 2);
+ histogram_tester.ExpectTotalCount("NQE.NetworkIdAvailable", 3);
+
+ // The NetworkID is recorded as being available on a cellular connection.
+ estimator.SimulateNetworkChangeTo(
+ NetworkChangeNotifier::ConnectionType::CONNECTION_2G, "test-1");
+ histogram_tester.ExpectBucketCount("NQE.NetworkIdAvailable", 1, 3);
+ histogram_tester.ExpectTotalCount("NQE.NetworkIdAvailable", 4);
+}
+
} // namespace net
« no previous file with comments | « net/nqe/network_quality_estimator.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698