Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "base/test/test_suite.h" | 5 #include "base/test/test_suite.h" |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/base_paths.h" | 8 #include "base/base_paths.h" |
| 9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 205 // Initialize(). See bug 6436. | 205 // Initialize(). See bug 6436. |
| 206 int TestSuite::Run() { | 206 int TestSuite::Run() { |
| 207 #if defined(OS_IOS) | 207 #if defined(OS_IOS) |
| 208 RunTestsFromIOSApp(); | 208 RunTestsFromIOSApp(); |
| 209 #endif | 209 #endif |
| 210 | 210 |
| 211 #if defined(OS_MACOSX) | 211 #if defined(OS_MACOSX) |
| 212 mac::ScopedNSAutoreleasePool scoped_pool; | 212 mac::ScopedNSAutoreleasePool scoped_pool; |
| 213 #endif | 213 #endif |
| 214 | 214 |
| 215 // 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.
| |
| 216 // an error that it's not set. If a FeatureList was created in this way (i.e. | |
| 217 // one didn't exist previously), it will be ClearInstanceForTesting() below. | |
| 218 const bool created_feature_list = | |
| 219 FeatureList::InitializeInstance(std::string(), std::string()); | |
| 220 | |
| 215 Initialize(); | 221 Initialize(); |
| 216 std::string client_func = | 222 std::string client_func = |
| 217 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 223 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 218 switches::kTestChildProcess); | 224 switches::kTestChildProcess); |
| 219 | 225 |
| 220 // Check to see if we are being run as a client process. | 226 // Check to see if we are being run as a client process. |
| 221 if (!client_func.empty()) | 227 if (!client_func.empty()) |
| 222 return multi_process_function_list::InvokeChildProcessTest(client_func); | 228 return multi_process_function_list::InvokeChildProcessTest(client_func); |
| 223 #if defined(OS_IOS) | 229 #if defined(OS_IOS) |
| 224 test_listener_ios::RegisterTestEndListener(); | 230 test_listener_ios::RegisterTestEndListener(); |
| 225 #endif | 231 #endif |
| 226 | 232 |
| 227 // Set up a FeatureList instance, so that code using that API will not hit a | |
| 228 // an error that it's not set. Cleared by ClearInstanceForTesting() below. | |
| 229 base::FeatureList::SetInstance(make_scoped_ptr(new base::FeatureList)); | |
| 230 | |
| 231 int result = RUN_ALL_TESTS(); | 233 int result = RUN_ALL_TESTS(); |
| 232 | 234 |
| 233 // Clear the FeatureList that was registered above. | 235 // Clear the FeatureList that was registered above. |
| 234 FeatureList::ClearInstanceForTesting(); | 236 if (created_feature_list) |
| 237 FeatureList::ClearInstanceForTesting(); | |
| 235 | 238 |
| 236 #if defined(OS_MACOSX) | 239 #if defined(OS_MACOSX) |
| 237 // This MUST happen before Shutdown() since Shutdown() tears down | 240 // This MUST happen before Shutdown() since Shutdown() tears down |
| 238 // objects (such as NotificationService::current()) that Cocoa | 241 // objects (such as NotificationService::current()) that Cocoa |
| 239 // objects use to remove themselves as observers. | 242 // objects use to remove themselves as observers. |
| 240 scoped_pool.Recycle(); | 243 scoped_pool.Recycle(); |
| 241 #endif | 244 #endif |
| 242 | 245 |
| 243 Shutdown(); | 246 Shutdown(); |
| 244 | 247 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 358 | 361 |
| 359 TestTimeouts::Initialize(); | 362 TestTimeouts::Initialize(); |
| 360 | 363 |
| 361 trace_to_file_.BeginTracingFromCommandLineOptions(); | 364 trace_to_file_.BeginTracingFromCommandLineOptions(); |
| 362 } | 365 } |
| 363 | 366 |
| 364 void TestSuite::Shutdown() { | 367 void TestSuite::Shutdown() { |
| 365 } | 368 } |
| 366 | 369 |
| 367 } // namespace base | 370 } // namespace base |
| OLD | NEW |