| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/launcher/unit_test_launcher.h" | 5 #include "base/test/launcher/unit_test_launcher.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 return true; | 550 return true; |
| 551 } | 551 } |
| 552 | 552 |
| 553 size_t UnitTestLauncherDelegate::RunTests( | 553 size_t UnitTestLauncherDelegate::RunTests( |
| 554 TestLauncher* test_launcher, | 554 TestLauncher* test_launcher, |
| 555 const std::vector<std::string>& test_names) { | 555 const std::vector<std::string>& test_names) { |
| 556 DCHECK(thread_checker_.CalledOnValidThread()); | 556 DCHECK(thread_checker_.CalledOnValidThread()); |
| 557 | 557 |
| 558 int launch_flags = use_job_objects_ ? TestLauncher::USE_JOB_OBJECTS : 0; | 558 int launch_flags = use_job_objects_ ? TestLauncher::USE_JOB_OBJECTS : 0; |
| 559 | 559 |
| 560 std::vector<std::string> serialized; |
| 560 std::vector<std::string> batch; | 561 std::vector<std::string> batch; |
| 561 for (size_t i = 0; i < test_names.size(); i++) { | 562 for (const auto& test_name : test_names) { |
| 562 batch.push_back(test_names[i]); | 563 if (test_name.find(".SERIALIZE_") != std::string::npos) { |
| 564 serialized.push_back(test_name); |
| 565 continue; |
| 566 } |
| 567 batch.push_back(test_name); |
| 563 | 568 |
| 564 // Use 0 to indicate unlimited batch size. | 569 // Use 0 to indicate unlimited batch size. |
| 565 if (batch.size() >= batch_limit_ && batch_limit_ != 0) { | 570 if (batch.size() >= batch_limit_ && batch_limit_ != 0) { |
| 566 RunUnitTestsBatch(test_launcher, platform_delegate_, batch, launch_flags); | 571 RunUnitTestsBatch(test_launcher, platform_delegate_, batch, launch_flags); |
| 567 batch.clear(); | 572 batch.clear(); |
| 568 } | 573 } |
| 569 } | 574 } |
| 570 | 575 |
| 571 RunUnitTestsBatch(test_launcher, platform_delegate_, batch, launch_flags); | 576 RunUnitTestsBatch(test_launcher, platform_delegate_, batch, launch_flags); |
| 572 | 577 |
| 578 RunUnitTestsSerially(test_launcher, platform_delegate_, serialized, |
| 579 launch_flags); |
| 580 |
| 573 return test_names.size(); | 581 return test_names.size(); |
| 574 } | 582 } |
| 575 | 583 |
| 576 size_t UnitTestLauncherDelegate::RetryTests( | 584 size_t UnitTestLauncherDelegate::RetryTests( |
| 577 TestLauncher* test_launcher, | 585 TestLauncher* test_launcher, |
| 578 const std::vector<std::string>& test_names) { | 586 const std::vector<std::string>& test_names) { |
| 579 MessageLoop::current()->PostTask( | 587 MessageLoop::current()->PostTask( |
| 580 FROM_HERE, | 588 FROM_HERE, |
| 581 Bind(&RunUnitTestsSerially, | 589 Bind(&RunUnitTestsSerially, |
| 582 test_launcher, | 590 test_launcher, |
| 583 platform_delegate_, | 591 platform_delegate_, |
| 584 test_names, | 592 test_names, |
| 585 use_job_objects_ ? TestLauncher::USE_JOB_OBJECTS : 0)); | 593 use_job_objects_ ? TestLauncher::USE_JOB_OBJECTS : 0)); |
| 586 return test_names.size(); | 594 return test_names.size(); |
| 587 } | 595 } |
| 588 | 596 |
| 589 } // namespace base | 597 } // namespace base |
| OLD | NEW |