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 <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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 232 // Do not add the result printer if output path already exists. It's an | 232 // Do not add the result printer if output path already exists. It's an |
| 233 // indicator there is a process printing to that file, and we're likely | 233 // indicator there is a process printing to that file, and we're likely |
| 234 // its child. Do not clobber the results in that case. | 234 // its child. Do not clobber the results in that case. |
| 235 if (PathExists(output_path)) { | 235 if (PathExists(output_path)) { |
| 236 LOG(WARNING) << "Test launcher output path " << output_path.AsUTF8Unsafe() | 236 LOG(WARNING) << "Test launcher output path " << output_path.AsUTF8Unsafe() |
| 237 << " exists. Not adding test launcher result printer."; | 237 << " exists. Not adding test launcher result printer."; |
| 238 return; | 238 return; |
| 239 } | 239 } |
| 240 | 240 |
| 241 printer_ = new XmlUnitTestResultPrinter; | 241 printer_ = new XmlUnitTestResultPrinter; |
| 242 | |
| 243 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
|
Paweł Hajdan Jr.
2017/05/05 17:33:03
Can we just move this code to the printer?
alex-ac
2017/05/07 12:07:24
Done.
| |
| 244 switches::kTestLauncherTestPartResultsLimit)) { | |
| 245 std::string limit_str = | |
| 246 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | |
| 247 switches::kTestLauncherTestPartResultsLimit); | |
| 248 long int limit = std::strtol(limit_str.c_str(), nullptr, 10); | |
| 249 printer_->set_test_part_results_limit(limit); | |
| 250 } | |
| 251 | |
| 242 CHECK(printer_->Initialize(output_path)); | 252 CHECK(printer_->Initialize(output_path)); |
| 243 testing::TestEventListeners& listeners = | 253 testing::TestEventListeners& listeners = |
| 244 testing::UnitTest::GetInstance()->listeners(); | 254 testing::UnitTest::GetInstance()->listeners(); |
| 245 listeners.Append(printer_); | 255 listeners.Append(printer_); |
| 246 } | 256 } |
| 247 | 257 |
| 248 // Don't add additional code to this method. Instead add it to | 258 // Don't add additional code to this method. Instead add it to |
| 249 // Initialize(). See bug 6436. | 259 // Initialize(). See bug 6436. |
| 250 int TestSuite::Run() { | 260 int TestSuite::Run() { |
| 251 #if defined(OS_IOS) | 261 #if defined(OS_IOS) |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 412 | 422 |
| 413 void TestSuite::Shutdown() { | 423 void TestSuite::Shutdown() { |
| 414 base::debug::StopProfiling(); | 424 base::debug::StopProfiling(); |
| 415 | 425 |
| 416 // Clear the FeatureList that was created by Initialize(). | 426 // Clear the FeatureList that was created by Initialize(). |
| 417 if (created_feature_list_) | 427 if (created_feature_list_) |
| 418 FeatureList::ClearInstanceForTesting(); | 428 FeatureList::ClearInstanceForTesting(); |
| 419 } | 429 } |
| 420 | 430 |
| 421 } // namespace base | 431 } // namespace base |
| OLD | NEW |