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

Unified Diff: net/nqe/network_quality_estimator_unittest.cc

Issue 2081493002: Obtain WiFi SSID on Android using Android APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix 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 52d5bf7b81646c31193df6016d0e377591a97eda..dce5817b17cf3f63df9d3360c3978ae29be29117 100644
--- a/net/nqe/network_quality_estimator_unittest.cc
+++ b/net/nqe/network_quality_estimator_unittest.cc
@@ -1678,4 +1678,39 @@ TEST(NetworkQualityEstimatorTest, MAYBE_RecordAccuracy) {
}
}
+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.
+ estimator.SimulateNetworkChangeTo(
+ NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI, "test-1");
+ histogram_tester.ExpectUniqueSample("NQE.NetworkIdAvailable", 1, 1);
+
+ // Histogram is not recorded on unknown connection.
+ 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
+ // 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.
+ 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.
+ 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