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

Side by Side 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, 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 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 1794 matching lines...) Expand 10 before | Expand all | Expand 10 after
1805 std::string connection_type_name = 1805 std::string connection_type_name =
1806 std::string(NetworkQualityEstimator::GetNameForEffectiveConnectionType( 1806 std::string(NetworkQualityEstimator::GetNameForEffectiveConnectionType(
1807 effective_connection_type)); 1807 effective_connection_type));
1808 EXPECT_FALSE(connection_type_name.empty()); 1808 EXPECT_FALSE(connection_type_name.empty());
1809 EXPECT_EQ(effective_connection_type, 1809 EXPECT_EQ(effective_connection_type,
1810 NetworkQualityEstimator::GetEffectiveConnectionTypeForName( 1810 NetworkQualityEstimator::GetEffectiveConnectionTypeForName(
1811 connection_type_name)); 1811 connection_type_name));
1812 } 1812 }
1813 } 1813 }
1814 1814
1815 TEST(NetworkQualityEstimatorTest, TestRecordNetworkIDAvailability) {
1816 base::HistogramTester histogram_tester;
1817 std::map<std::string, std::string> variation_params;
1818 TestNetworkQualityEstimator estimator(variation_params);
1819
1820 // 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.
1821 estimator.SimulateNetworkChangeTo(
1822 NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI, "test-1");
1823 histogram_tester.ExpectUniqueSample("NQE.NetworkIdAvailable", 1, 1);
1824
1825 // 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.
1826 estimator.SimulateNetworkChangeTo(
1827 NetworkChangeNotifier::ConnectionType::CONNECTION_UNKNOWN, "");
1828 histogram_tester.ExpectTotalCount("NQE.NetworkIdAvailable", 1);
1829
1830 // 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.
1831 // SSID.
1832 estimator.SimulateNetworkChangeTo(
1833 NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI, "");
1834 histogram_tester.ExpectBucketCount("NQE.NetworkIdAvailable", 0, 1);
1835 histogram_tester.ExpectTotalCount("NQE.NetworkIdAvailable", 2);
1836
1837 // 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.
1838 estimator.SimulateNetworkChangeTo(
1839 NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI, "test-1");
1840 histogram_tester.ExpectBucketCount("NQE.NetworkIdAvailable", 1, 2);
1841 histogram_tester.ExpectTotalCount("NQE.NetworkIdAvailable", 3);
1842
1843 // 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.
1844 estimator.SimulateNetworkChangeTo(
1845 NetworkChangeNotifier::ConnectionType::CONNECTION_2G, "test-1");
1846 histogram_tester.ExpectBucketCount("NQE.NetworkIdAvailable", 1, 3);
1847 histogram_tester.ExpectTotalCount("NQE.NetworkIdAvailable", 4);
1848 }
1849
1815 } // namespace net 1850 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698