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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
335 #endif // defined(_DEBUG) && defined(_HAS_EXCEPTIONS) && (_HAS_EXCEPTIONS == 1) | 335 #endif // defined(_DEBUG) && defined(_HAS_EXCEPTIONS) && (_HAS_EXCEPTIONS == 1) |
336 #endif // defined(OS_WIN) | 336 #endif // defined(OS_WIN) |
337 } | 337 } |
338 | 338 |
339 void TestSuite::Initialize() { | 339 void TestSuite::Initialize() { |
340 #if !defined(OS_IOS) | 340 #if !defined(OS_IOS) |
341 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kWaitForDebugger)) { | 341 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kWaitForDebugger)) { |
342 debug::WaitForDebugger(60, true); | 342 debug::WaitForDebugger(60, true); |
343 } | 343 } |
344 #endif | 344 #endif |
345 | |
346 // Set up a FeatureList instance, so that code using that API will not hit a | 345 // Set up a FeatureList instance, so that code using that API will not hit a |
347 // an error that it's not set. If a FeatureList was created in this way (i.e. | 346 // an error that it's not set. If a FeatureList was created in this way (i.e. |
348 // one didn't exist previously), it will be cleared in Shutdown() via | 347 // one didn't exist previously), it will be cleared in Shutdown() via |
349 // ClearInstanceForTesting(). | 348 // ClearInstanceForTesting(). |
350 created_feature_list_ = | 349 created_feature_list_ = FeatureList::InitializeInstance( |
Ilya Sherman
2017/05/25 22:48:12
Could you use a ScopedFeatureList here?
| |
351 FeatureList::InitializeInstance(std::string(), std::string()); | 350 CommandLine::ForCurrentProcess()->GetSwitchValueASCII("enable-features"), |
351 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | |
352 "disable-features")); | |
Ilya Sherman
2017/05/25 22:48:12
It looks like the code expects that sometimes this
Ilya Sherman
2017/05/25 22:48:12
nit: Please move the kEnabledFeatures and kDisable
| |
352 | 353 |
353 #if defined(OS_IOS) | 354 #if defined(OS_IOS) |
354 InitIOSTestMessageLoop(); | 355 InitIOSTestMessageLoop(); |
355 #endif // OS_IOS | 356 #endif // OS_IOS |
356 | 357 |
357 #if defined(OS_ANDROID) | 358 #if defined(OS_ANDROID) |
358 InitAndroidTestMessageLoop(); | 359 InitAndroidTestMessageLoop(); |
359 #endif // else defined(OS_ANDROID) | 360 #endif // else defined(OS_ANDROID) |
360 | 361 |
361 CHECK(debug::EnableInProcessStackDumping()); | 362 CHECK(debug::EnableInProcessStackDumping()); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
412 | 413 |
413 void TestSuite::Shutdown() { | 414 void TestSuite::Shutdown() { |
414 base::debug::StopProfiling(); | 415 base::debug::StopProfiling(); |
415 | 416 |
416 // Clear the FeatureList that was created by Initialize(). | 417 // Clear the FeatureList that was created by Initialize(). |
417 if (created_feature_list_) | 418 if (created_feature_list_) |
418 FeatureList::ClearInstanceForTesting(); | 419 FeatureList::ClearInstanceForTesting(); |
419 } | 420 } |
420 | 421 |
421 } // namespace base | 422 } // namespace base |
OLD | NEW |