diff options
author | blundell <blundell@chromium.org> | 2015-08-28 02:59:17 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-28 09:59:53 +0000 |
commit | 642578a171c7acee3de6b514bf2738fcb0339aac (patch) | |
tree | e6a65a98c11384331ea0480847e1bd7497cf20aa | |
parent | bda141b2492ca1971a7b36c6a6a609fa5c5bf4ac (diff) | |
download | chromium_src-642578a171c7acee3de6b514bf2738fcb0339aac.zip chromium_src-642578a171c7acee3de6b514bf2738fcb0339aac.tar.gz chromium_src-642578a171c7acee3de6b514bf2738fcb0339aac.tar.bz2 |
Turn VariationsService::GetVariationsServerURL into instance method
This will allow for followup work that uses |client_| within that
method.
BUG=516678
TBR=bartfab
Review URL: https://codereview.chromium.org/1312423003
Cr-Commit-Position: refs/heads/master@{#346111}
5 files changed, 17 insertions, 14 deletions
diff --git a/chrome/browser/chromeos/policy/variations_service_policy_browsertest.cc b/chrome/browser/chromeos/policy/variations_service_policy_browsertest.cc index a997ec9..603a981 100644 --- a/chrome/browser/chromeos/policy/variations_service_policy_browsertest.cc +++ b/chrome/browser/chromeos/policy/variations_service_policy_browsertest.cc @@ -42,8 +42,9 @@ IN_PROC_BROWSER_TEST_F(VariationsServiceDevicePolicyTest, VariationsURLValid) { GetDefaultVariationsServerURLForTesting(); // Device policy has updated the cros settings. - const GURL url = chrome_variations::VariationsService::GetVariationsServerURL( - g_browser_process->local_state(), std::string()); + const GURL url = + g_browser_process->variations_service()->GetVariationsServerURL( + g_browser_process->local_state(), std::string()); EXPECT_TRUE(base::StartsWith(url.spec(), default_variations_url, base::CompareCase::SENSITIVE)); std::string value; diff --git a/chrome/browser/metrics/variations/variations_service.cc b/chrome/browser/metrics/variations/variations_service.cc index 642b1ef..d5b4df4 100644 --- a/chrome/browser/metrics/variations/variations_service.cc +++ b/chrome/browser/metrics/variations/variations_service.cc @@ -365,7 +365,6 @@ void VariationsService::SetCreateTrialsFromSeedCalledForTesting(bool called) { create_trials_from_seed_called_ = called; } -// static GURL VariationsService::GetVariationsServerURL( PrefService* policy_pref_service, const std::string& restrict_mode_override) { diff --git a/chrome/browser/metrics/variations/variations_service.h b/chrome/browser/metrics/variations/variations_service.h index 668f48d..c0540d2 100644 --- a/chrome/browser/metrics/variations/variations_service.h +++ b/chrome/browser/metrics/variations/variations_service.h @@ -109,8 +109,8 @@ class VariationsService // Returns the variations server URL, which can vary if a command-line flag is // set and/or the variations restrict pref is set in |local_prefs|. Declared // static for test purposes. - static GURL GetVariationsServerURL(PrefService* local_prefs, - const std::string& restrict_mode_override); + GURL GetVariationsServerURL(PrefService* local_prefs, + const std::string& restrict_mode_override); // Exposed for testing. static std::string GetDefaultVariationsServerURLForTesting(); diff --git a/chrome/browser/metrics/variations/variations_service_unittest.cc b/chrome/browser/metrics/variations/variations_service_unittest.cc index dee8dfa..aea69fe 100644 --- a/chrome/browser/metrics/variations/variations_service_unittest.cc +++ b/chrome/browser/metrics/variations/variations_service_unittest.cc @@ -264,20 +264,22 @@ TEST_F(VariationsServiceTest, GetVariationsServerURL) { VariationsService::GetDefaultVariationsServerURLForTesting(); std::string value; - GURL url = VariationsService::GetVariationsServerURL(prefs, std::string()); + TestVariationsService service( + new web_resource::TestRequestAllowedNotifier(prefs), prefs); + GURL url = service.GetVariationsServerURL(prefs, std::string()); EXPECT_TRUE(base::StartsWith(url.spec(), default_variations_url, base::CompareCase::SENSITIVE)); EXPECT_FALSE(net::GetValueForKeyInQuery(url, "restrict", &value)); prefs_store.SetVariationsRestrictParameterPolicyValue("restricted"); - url = VariationsService::GetVariationsServerURL(prefs, std::string()); + url = service.GetVariationsServerURL(prefs, std::string()); EXPECT_TRUE(base::StartsWith(url.spec(), default_variations_url, base::CompareCase::SENSITIVE)); EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); EXPECT_EQ("restricted", value); // The override value should take precedence over what's in prefs. - url = VariationsService::GetVariationsServerURL(prefs, "override"); + url = service.GetVariationsServerURL(prefs, "override"); EXPECT_TRUE(base::StartsWith(url.spec(), default_variations_url, base::CompareCase::SENSITIVE)); EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); @@ -287,8 +289,9 @@ TEST_F(VariationsServiceTest, GetVariationsServerURL) { TEST_F(VariationsServiceTest, VariationsURLHasOSNameParam) { TestingPrefServiceSimple prefs; VariationsService::RegisterPrefs(prefs.registry()); - const GURL url = - VariationsService::GetVariationsServerURL(&prefs, std::string()); + TestVariationsService service( + new web_resource::TestRequestAllowedNotifier(&prefs), &prefs); + const GURL url = service.GetVariationsServerURL(&prefs, std::string()); std::string value; EXPECT_TRUE(net::GetValueForKeyInQuery(url, "osname", &value)); @@ -336,7 +339,7 @@ TEST_F(VariationsServiceTest, SeedStoredWhenOKStatus) { TestVariationsService service( new web_resource::TestRequestAllowedNotifier(&prefs), &prefs); service.variations_server_url_ = - VariationsService::GetVariationsServerURL(&prefs, std::string()); + service.GetVariationsServerURL(&prefs, std::string()); service.set_intercepts_fetch(false); net::TestURLFetcherFactory factory; @@ -367,7 +370,7 @@ TEST_F(VariationsServiceTest, SeedNotStoredWhenNonOKStatus) { make_scoped_ptr(new ChromeVariationsServiceClient()), new web_resource::TestRequestAllowedNotifier(&prefs), &prefs, NULL); service.variations_server_url_ = - VariationsService::GetVariationsServerURL(&prefs, std::string()); + service.GetVariationsServerURL(&prefs, std::string()); for (size_t i = 0; i < arraysize(non_ok_status_codes); ++i) { net::TestURLFetcherFactory factory; service.DoActualFetch(); @@ -388,7 +391,7 @@ TEST_F(VariationsServiceTest, CountryHeader) { TestVariationsService service( new web_resource::TestRequestAllowedNotifier(&prefs), &prefs); service.variations_server_url_ = - VariationsService::GetVariationsServerURL(&prefs, std::string()); + service.GetVariationsServerURL(&prefs, std::string()); service.set_intercepts_fetch(false); net::TestURLFetcherFactory factory; diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc index 9b2ee7c..00c4118 100644 --- a/chrome/browser/policy/policy_browsertest.cc +++ b/chrome/browser/policy/policy_browsertest.cc @@ -3775,7 +3775,7 @@ IN_PROC_BROWSER_TEST_F(PolicyVariationsServiceTest, VariationsURLIsValid) { GetDefaultVariationsServerURLForTesting(); const GURL url = - chrome_variations::VariationsService::GetVariationsServerURL( + g_browser_process->variations_service()->GetVariationsServerURL( g_browser_process->local_state(), std::string()); EXPECT_TRUE(base::StartsWith(url.spec(), default_variations_url, base::CompareCase::SENSITIVE)); |