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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/nqe/network_quality_estimator.h" 5 #include "net/nqe/network_quality_estimator.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <limits> 10 #include <limits>
(...skipping 1660 matching lines...) Expand 10 before | Expand all | Expand 10 after
1671 sign_suffix_with_one_sample + "." + interval_value + ".60_140", 1671 sign_suffix_with_one_sample + "." + interval_value + ".60_140",
1672 diff, 1); 1672 diff, 1);
1673 histogram_tester.ExpectTotalCount( 1673 histogram_tester.ExpectTotalCount(
1674 "NQE.Accuracy.TransportRTT.EstimatedObservedDiff." + 1674 "NQE.Accuracy.TransportRTT.EstimatedObservedDiff." +
1675 sign_suffix_with_zero_samples + "." + interval_value + ".60_140", 1675 sign_suffix_with_zero_samples + "." + interval_value + ".60_140",
1676 0); 1676 0);
1677 } 1677 }
1678 } 1678 }
1679 } 1679 }
1680 1680
1681 TEST(NetworkQualityEstimatorTest, TestRecordNetworkIDAvailability) {
1682 base::HistogramTester histogram_tester;
1683 std::map<std::string, std::string> variation_params;
1684 TestNetworkQualityEstimator estimator(variation_params);
1685
1686 // Network ID is recorded as available on Wi-Fi connection.
1687 estimator.SimulateNetworkChangeTo(
1688 NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI, "test-1");
1689 histogram_tester.ExpectUniqueSample("NQE.NetworkIdAvailable", 1, 1);
1690
1691 // Histogram is not recorded on unknown connection.
1692 estimator.SimulateNetworkChangeTo(
1693 NetworkChangeNotifier::ConnectionType::CONNECTION_UNKNOWN, "");
1694 histogram_tester.ExpectTotalCount("NQE.NetworkIdAvailable", 1);
1695
1696 // Network ID is recorded as not available on Wi-Fi connection with empty
1697 // SSID.
1698 estimator.SimulateNetworkChangeTo(
1699 NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI, "");
1700 histogram_tester.ExpectBucketCount("NQE.NetworkIdAvailable", 0, 1);
1701 histogram_tester.ExpectTotalCount("NQE.NetworkIdAvailable", 2);
1702
1703 // Network ID is recorded as available on Wi-Fi connection.
1704 estimator.SimulateNetworkChangeTo(
1705 NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI, "test-1");
1706 histogram_tester.ExpectBucketCount("NQE.NetworkIdAvailable", 1, 2);
1707 histogram_tester.ExpectTotalCount("NQE.NetworkIdAvailable", 3);
1708
1709 // Network ID is recorded as available on cellular connection.
1710 estimator.SimulateNetworkChangeTo(
1711 NetworkChangeNotifier::ConnectionType::CONNECTION_2G, "test-1");
1712 histogram_tester.ExpectBucketCount("NQE.NetworkIdAvailable", 1, 3);
1713 histogram_tester.ExpectTotalCount("NQE.NetworkIdAvailable", 4);
1714 }
1715
1681 } // namespace net 1716 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698