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

Unified Diff: base/test/test_suite.cc

Issue 1848523002: Changes to support using base/feature_list.h from gin/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 8 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 | « base/test/test_suite.h ('k') | content/ppapi_plugin/ppapi_plugin_main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/test_suite.cc
diff --git a/base/test/test_suite.cc b/base/test/test_suite.cc
index 7211ff5a4b1007c99faae5865c76e06871ac3a4e..81ea744e5088545126dd56bd9bc44dc37d50454f 100644
--- a/base/test/test_suite.cc
+++ b/base/test/test_suite.cc
@@ -100,14 +100,15 @@ int RunUnitTestsUsingBaseTestSuite(int argc, char **argv) {
Bind(&TestSuite::Run, Unretained(&test_suite)));
}
-TestSuite::TestSuite(int argc, char** argv) : initialized_command_line_(false) {
+TestSuite::TestSuite(int argc, char** argv)
+ : initialized_command_line_(false), created_feature_list_(false) {
PreInitialize();
InitializeFromCommandLine(argc, argv);
}
#if defined(OS_WIN)
TestSuite::TestSuite(int argc, wchar_t** argv)
- : initialized_command_line_(false) {
+ : initialized_command_line_(false), created_feature_list_(false) {
PreInitialize();
InitializeFromCommandLine(argc, argv);
}
@@ -226,15 +227,8 @@ int TestSuite::Run() {
test_listener_ios::RegisterTestEndListener();
#endif
- // Set up a FeatureList instance, so that code using that API will not hit a
- // an error that it's not set. Cleared by ClearInstanceForTesting() below.
- base::FeatureList::SetInstance(WrapUnique(new base::FeatureList));
-
int result = RUN_ALL_TESTS();
- // Clear the FeatureList that was registered above.
- FeatureList::ClearInstanceForTesting();
-
#if defined(OS_MACOSX)
// This MUST happen before Shutdown() since Shutdown() tears down
// objects (such as NotificationService::current()) that Cocoa
@@ -296,6 +290,13 @@ void TestSuite::Initialize() {
}
#endif
+ // Set up a FeatureList instance, so that code using that API will not hit a
+ // an error that it's not set. If a FeatureList was created in this way (i.e.
+ // one didn't exist previously), it will be cleared in Shutdown() via
+ // ClearInstanceForTesting().
+ created_feature_list_ =
+ FeatureList::InitializeInstance(std::string(), std::string());
+
#if defined(OS_IOS)
InitIOSTestMessageLoop();
#endif // OS_IOS
@@ -364,6 +365,9 @@ void TestSuite::Initialize() {
}
void TestSuite::Shutdown() {
+ // Clear the FeatureList that was created by Initialize().
+ if (created_feature_list_)
+ FeatureList::ClearInstanceForTesting();
}
} // namespace base
« no previous file with comments | « base/test/test_suite.h ('k') | content/ppapi_plugin/ppapi_plugin_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698