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

Unified Diff: base/test/scoped_feature_list.h

Issue 2879293002: Move setup of base::test::ScopedFeatureList earlier, to avoid data race. (Closed)
Patch Set: . Created 3 years, 7 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 | content/browser/top_document_isolation_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/scoped_feature_list.h
diff --git a/base/test/scoped_feature_list.h b/base/test/scoped_feature_list.h
index 99e07f5374a96bf9668e9805da592cc9cd4e5805..572a263b4e23cee8692a7e1cddd3a72371d848d9 100644
--- a/base/test/scoped_feature_list.h
+++ b/base/test/scoped_feature_list.h
@@ -17,6 +17,16 @@ namespace test {
// Note: Re-using the same object is not allowed. To reset the feature
// list and initialize it anew, destroy an existing scoped list and init
// a new one.
+//
+// ScopedFeatureList needs to be initialized (via one of Init... methods)
+// before running code that inspects the state of features. In practice this
+// means:
+// - In browser tests, one of Init... methods should be called from the
+// overriden ::testing::Test::SetUp method. For example:
+// void SetUp() override {
+// scoped_feature_list_.InitAndEnableFeature(features::kMyFeatureHere);
+// InProcessBrowserTest::SetUp();
+// }
class ScopedFeatureList final {
public:
ScopedFeatureList();
« no previous file with comments | « no previous file | content/browser/top_document_isolation_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698