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

Side by Side Diff: chrome/browser/metrics/variations/variations_service.h

Issue 1313213005: Turn VariationsService::GetVariationsServerURL into instance method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use locally-constructed VariationsService in browsertests Created 5 years, 3 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_ 5 #ifndef CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_
6 #define CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_ 6 #define CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 16 matching lines...) Expand all
27 class PrefRegistrySimple; 27 class PrefRegistrySimple;
28 28
29 namespace base { 29 namespace base {
30 class Version; 30 class Version;
31 } 31 }
32 32
33 namespace metrics { 33 namespace metrics {
34 class MetricsStateManager; 34 class MetricsStateManager;
35 } 35 }
36 36
37 namespace policy {
38 FORWARD_DECLARE_TEST(PolicyVariationsServiceTest, VariationsURLIsValid);
39 FORWARD_DECLARE_TEST(VariationsServiceDevicePolicyTest, VariationsURLValid);
40 }
41
37 namespace user_prefs { 42 namespace user_prefs {
38 class PrefRegistrySyncable; 43 class PrefRegistrySyncable;
39 } 44 }
40 45
41 namespace variations { 46 namespace variations {
42 class VariationsSeed; 47 class VariationsSeed;
43 } 48 }
44 49
45 namespace chrome_variations { 50 namespace chrome_variations {
46 51
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // value coming from policy prefs. This should be called prior to any calls 107 // value coming from policy prefs. This should be called prior to any calls
103 // to |StartRepeatedVariationsSeedFetch|. 108 // to |StartRepeatedVariationsSeedFetch|.
104 void SetRestrictMode(const std::string& restrict_mode); 109 void SetRestrictMode(const std::string& restrict_mode);
105 110
106 // Exposed for testing. 111 // Exposed for testing.
107 void SetCreateTrialsFromSeedCalledForTesting(bool called); 112 void SetCreateTrialsFromSeedCalledForTesting(bool called);
108 113
109 // Returns the variations server URL, which can vary if a command-line flag is 114 // Returns the variations server URL, which can vary if a command-line flag is
110 // set and/or the variations restrict pref is set in |local_prefs|. Declared 115 // set and/or the variations restrict pref is set in |local_prefs|. Declared
111 // static for test purposes. 116 // static for test purposes.
112 static GURL GetVariationsServerURL(PrefService* local_prefs, 117 GURL GetVariationsServerURL(PrefService* local_prefs,
113 const std::string& restrict_mode_override); 118 const std::string& restrict_mode_override);
114 119
115 // Exposed for testing. 120 // Exposed for testing.
116 static std::string GetDefaultVariationsServerURLForTesting(); 121 static std::string GetDefaultVariationsServerURLForTesting();
117 122
118 // Register Variations related prefs in Local State. 123 // Register Variations related prefs in Local State.
119 static void RegisterPrefs(PrefRegistrySimple* registry); 124 static void RegisterPrefs(PrefRegistrySimple* registry);
120 125
121 // Register Variations related prefs in the Profile prefs. 126 // Register Variations related prefs in the Profile prefs.
122 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); 127 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
123 128
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 metrics::MetricsStateManager* state_manager); 171 metrics::MetricsStateManager* state_manager);
167 172
168 private: 173 private:
169 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, Observer); 174 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, Observer);
170 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, SeedStoredWhenOKStatus); 175 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, SeedStoredWhenOKStatus);
171 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, SeedNotStoredWhenNonOKStatus); 176 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, SeedNotStoredWhenNonOKStatus);
172 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, SeedDateUpdatedOn304Status); 177 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, SeedDateUpdatedOn304Status);
173 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, 178 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest,
174 LoadPermanentConsistencyCountry); 179 LoadPermanentConsistencyCountry);
175 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, CountryHeader); 180 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, CountryHeader);
181 FRIEND_TEST_ALL_PREFIXES(policy::PolicyVariationsServiceTest,
182 VariationsURLIsValid);
Alexei Svitkine (slow) 2015/08/31 15:03:02 Hmm, once VariationsService moves to a component,
blundell 2015/09/01 10:03:06 Done.
183 FRIEND_TEST_ALL_PREFIXES(policy::VariationsServiceDevicePolicyTest,
184 VariationsURLValid);
176 185
177 // Set of different possible values to report for the 186 // Set of different possible values to report for the
178 // Variations.LoadPermanentConsistencyCountryResult histogram. This enum must 187 // Variations.LoadPermanentConsistencyCountryResult histogram. This enum must
179 // be kept consistent with its counterpart in histograms.xml. 188 // be kept consistent with its counterpart in histograms.xml.
180 enum LoadPermanentConsistencyCountryResult { 189 enum LoadPermanentConsistencyCountryResult {
181 LOAD_COUNTRY_NO_PREF_NO_SEED = 0, 190 LOAD_COUNTRY_NO_PREF_NO_SEED = 0,
182 LOAD_COUNTRY_NO_PREF_HAS_SEED, 191 LOAD_COUNTRY_NO_PREF_HAS_SEED,
183 LOAD_COUNTRY_INVALID_PREF_NO_SEED, 192 LOAD_COUNTRY_INVALID_PREF_NO_SEED,
184 LOAD_COUNTRY_INVALID_PREF_HAS_SEED, 193 LOAD_COUNTRY_INVALID_PREF_HAS_SEED,
185 LOAD_COUNTRY_HAS_PREF_NO_SEED_VERSION_EQ, 194 LOAD_COUNTRY_HAS_PREF_NO_SEED_VERSION_EQ,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 base::ThreadChecker thread_checker_; 293 base::ThreadChecker thread_checker_;
285 294
286 base::WeakPtrFactory<VariationsService> weak_ptr_factory_; 295 base::WeakPtrFactory<VariationsService> weak_ptr_factory_;
287 296
288 DISALLOW_COPY_AND_ASSIGN(VariationsService); 297 DISALLOW_COPY_AND_ASSIGN(VariationsService);
289 }; 298 };
290 299
291 } // namespace chrome_variations 300 } // namespace chrome_variations
292 301
293 #endif // CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_ 302 #endif // CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698