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

Unified Diff: chrome/browser/net/nqe/ui_network_quality_estimator_service_browsertest.cc

Issue 2672733002: Read NQE prefs to network quality store under all cases (Closed)
Patch Set: ps Created 3 years, 11 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 | « chrome/browser/net/nqe/ui_network_quality_estimator_service.cc ('k') | net/nqe/network_quality_estimator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/nqe/ui_network_quality_estimator_service_browsertest.cc
diff --git a/chrome/browser/net/nqe/ui_network_quality_estimator_service_browsertest.cc b/chrome/browser/net/nqe/ui_network_quality_estimator_service_browsertest.cc
index 07611d605f449131ba16d3c22702d6acbd9bf450..d33beb0aa4d47ebc52416993b8129a65bd41383d 100644
--- a/chrome/browser/net/nqe/ui_network_quality_estimator_service_browsertest.cc
+++ b/chrome/browser/net/nqe/ui_network_quality_estimator_service_browsertest.cc
@@ -59,16 +59,10 @@ class UINetworkQualityEstimatorServiceBrowserTest
UINetworkQualityEstimatorServiceBrowserTest() {}
// Verifies that the network quality prefs are written amd read correctly.
- void VerifyWritingReadingPrefs(bool persistent_cache_writing_enabled,
- bool persistent_cache_reading_enabled) {
+ void VerifyWritingReadingPrefs() {
variations::testing::ClearAllVariationParams();
std::map<std::string, std::string> variation_params;
- variation_params["persistent_cache_writing_enabled"] =
- persistent_cache_writing_enabled ? "true" : "false";
- variation_params["persistent_cache_reading_enabled"] =
- persistent_cache_reading_enabled ? "true" : "false";
-
variations::AssociateVariationParams("NetworkQualityEstimator", "Enabled",
variation_params);
base::FieldTrialList::CreateFieldTrial("NetworkQualityEstimator",
@@ -104,7 +98,7 @@ class UINetworkQualityEstimatorServiceBrowserTest
// Prefs are written only if the network id was available, and persistent
// caching was enabled.
- EXPECT_NE(network_id_available && persistent_cache_writing_enabled,
+ EXPECT_NE(network_id_available,
histogram_tester.GetAllSamples("NQE.Prefs.WriteCount").empty());
histogram_tester.ExpectTotalCount("NQE.Prefs.ReadCount", 0);
@@ -120,9 +114,8 @@ class UINetworkQualityEstimatorServiceBrowserTest
EXPECT_EQ(net::EFFECTIVE_CONNECTION_TYPE_SLOW_2G,
nqe_service->GetEffectiveConnectionType());
- // Prefs are written only if the network id was available, and persistent
- // caching was enabled.
- EXPECT_NE(network_id_available && persistent_cache_writing_enabled,
+ // Prefs are written only if the network id was available.
+ EXPECT_NE(network_id_available,
histogram_tester.GetAllSamples("NQE.Prefs.WriteCount").empty());
histogram_tester.ExpectTotalCount("NQE.Prefs.ReadCount", 0);
@@ -134,13 +127,8 @@ class UINetworkQualityEstimatorServiceBrowserTest
std::map<net::nqe::internal::NetworkID,
net::nqe::internal::CachedNetworkQuality>
read_prefs = nqe_service->ForceReadPrefsForTesting();
- EXPECT_EQ(network_id_available && persistent_cache_writing_enabled &&
- persistent_cache_reading_enabled
- ? 1u
- : 0u,
- read_prefs.size());
- if (network_id_available && persistent_cache_writing_enabled &&
- persistent_cache_reading_enabled) {
+ EXPECT_EQ(network_id_available ? 1u : 0u, read_prefs.size());
+ if (network_id_available) {
// Verify that the cached network quality was written correctly.
EXPECT_EQ(net::EFFECTIVE_CONNECTION_TYPE_SLOW_2G,
read_prefs.begin()->second.effective_connection_type());
@@ -217,15 +205,8 @@ IN_PROC_BROWSER_TEST_F(UINetworkQualityEstimatorServiceBrowserTest,
nqe_observer_3.effective_connection_type());
}
-// Verify that prefs are not read when reading of the prefs is not enabled
-// via field trial.
-IN_PROC_BROWSER_TEST_F(UINetworkQualityEstimatorServiceBrowserTest,
- ReadingFromPrefsDisabled) {
- VerifyWritingReadingPrefs(true, false);
-}
-
// Verify that prefs are writen and read correctly.
IN_PROC_BROWSER_TEST_F(UINetworkQualityEstimatorServiceBrowserTest,
WritingReadingToPrefsEnabled) {
- VerifyWritingReadingPrefs(true, true);
+ VerifyWritingReadingPrefs();
}
« no previous file with comments | « chrome/browser/net/nqe/ui_network_quality_estimator_service.cc ('k') | net/nqe/network_quality_estimator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698