Chromium Code Reviews| Index: base/test/test_suite.cc |
| diff --git a/base/test/test_suite.cc b/base/test/test_suite.cc |
| index 74bd9ddf7bd5bd238fb4997630c7dc5bdf51370b..486320ebad4416399b5c2faae086b84e10b91e9e 100644 |
| --- a/base/test/test_suite.cc |
| +++ b/base/test/test_suite.cc |
| @@ -212,6 +212,12 @@ int TestSuite::Run() { |
| mac::ScopedNSAutoreleasePool scoped_pool; |
| #endif |
| + // Set up a FeatureList instance, so that code using that API will not hit a |
|
Paweł Hajdan Jr.
2016/04/04 16:45:17
While you're here: could you move this code to Ini
Alexei Svitkine (slow)
2016/04/04 20:01:55
Seems to work. Done.
|
| + // 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 ClearInstanceForTesting() below. |
| + const bool created_feature_list = |
| + FeatureList::InitializeInstance(std::string(), std::string()); |
| + |
| Initialize(); |
| std::string client_func = |
| CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| @@ -224,14 +230,11 @@ 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(make_scoped_ptr(new base::FeatureList)); |
| - |
| int result = RUN_ALL_TESTS(); |
| // Clear the FeatureList that was registered above. |
| - FeatureList::ClearInstanceForTesting(); |
| + if (created_feature_list) |
| + FeatureList::ClearInstanceForTesting(); |
| #if defined(OS_MACOSX) |
| // This MUST happen before Shutdown() since Shutdown() tears down |