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

Unified Diff: base/feature_list.h

Issue 2226063002: Add a ScopedFeatureList class for testing and start using it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix issue in previous patchset. Created 4 years, 4 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 | « no previous file | base/feature_list.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/feature_list.h
diff --git a/base/feature_list.h b/base/feature_list.h
index e9ed00a124ad8f701d05391ede500e0c5f84138b..698ecd533423e06c85a6748bd7d85ab23a46fb96 100644
--- a/base/feature_list.h
+++ b/base/feature_list.h
@@ -165,8 +165,16 @@ class BASE_EXPORT FeatureList {
// process. This should only be called once and |instance| must not be null.
static void SetInstance(std::unique_ptr<FeatureList> instance);
- // Clears the previously-registered singleton instance for tests.
- static void ClearInstanceForTesting();
+ // Clears the previously-registered singleton instance for tests and returns
+ // the old instance.
+ // Note: Most tests should never call this directly. Instead consider using
+ // base::test::ScopedFeatureList.
+ static std::unique_ptr<FeatureList> ClearInstanceForTesting();
+
+ // Sets a given (initialized) |instance| to be the singleton feature list,
+ // for testing. Existing instance must be null. This is primarily intended
+ // to support base::test::ScopedFeatureList helper class.
+ static void RestoreInstanceForTesting(std::unique_ptr<FeatureList> instance);
private:
FRIEND_TEST_ALL_PREFIXES(FeatureListTest, CheckFeatureIdentity);
« no previous file with comments | « no previous file | base/feature_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698