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

Side by Side Diff: base/feature_list.h

Issue 2484613002: Migrate more tests to ScopedFeatureList. (Closed)
Patch Set: fix weakptrfactory must be last member error Created 4 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/offline_page_utils_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef BASE_FEATURE_LIST_H_ 5 #ifndef BASE_FEATURE_LIST_H_
6 #define BASE_FEATURE_LIST_H_ 6 #define BASE_FEATURE_LIST_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // about |enable_features| and |disable_features| parameters. 156 // about |enable_features| and |disable_features| parameters.
157 static bool InitializeInstance(const std::string& enable_features, 157 static bool InitializeInstance(const std::string& enable_features,
158 const std::string& disable_features); 158 const std::string& disable_features);
159 159
160 // Returns the singleton instance of FeatureList. Will return null until an 160 // Returns the singleton instance of FeatureList. Will return null until an
161 // instance is registered via SetInstance(). 161 // instance is registered via SetInstance().
162 static FeatureList* GetInstance(); 162 static FeatureList* GetInstance();
163 163
164 // Registers the given |instance| to be the singleton feature list for this 164 // Registers the given |instance| to be the singleton feature list for this
165 // process. This should only be called once and |instance| must not be null. 165 // process. This should only be called once and |instance| must not be null.
166 // Note: If you are considering using this for the purposes of testing, take
167 // a look at using base/test/scoped_feature_list.h instead.
Ilya Sherman 2016/11/08 00:20:00 Maybe we should remove ClearInstanceForTesting() f
Alexei Svitkine (slow) 2016/11/08 08:03:58 It's still being used from a few places - such as
166 static void SetInstance(std::unique_ptr<FeatureList> instance); 168 static void SetInstance(std::unique_ptr<FeatureList> instance);
167 169
168 // Clears the previously-registered singleton instance for tests and returns 170 // Clears the previously-registered singleton instance for tests and returns
169 // the old instance. 171 // the old instance.
170 // Note: Most tests should never call this directly. Instead consider using 172 // Note: Most tests should never call this directly. Instead consider using
171 // base::test::ScopedFeatureList. 173 // base::test::ScopedFeatureList.
172 static std::unique_ptr<FeatureList> ClearInstanceForTesting(); 174 static std::unique_ptr<FeatureList> ClearInstanceForTesting();
173 175
174 // Sets a given (initialized) |instance| to be the singleton feature list, 176 // Sets a given (initialized) |instance| to be the singleton feature list,
175 // for testing. Existing instance must be null. This is primarily intended 177 // for testing. Existing instance must be null. This is primarily intended
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 261
260 // Whether this object has been initialized from command line. 262 // Whether this object has been initialized from command line.
261 bool initialized_from_command_line_ = false; 263 bool initialized_from_command_line_ = false;
262 264
263 DISALLOW_COPY_AND_ASSIGN(FeatureList); 265 DISALLOW_COPY_AND_ASSIGN(FeatureList);
264 }; 266 };
265 267
266 } // namespace base 268 } // namespace base
267 269
268 #endif // BASE_FEATURE_LIST_H_ 270 #endif // BASE_FEATURE_LIST_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/offline_page_utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698