Chromium Code Reviews| Index: base/test/test_launcher.cc |
| diff --git a/base/test/test_launcher.cc b/base/test/test_launcher.cc |
| index d0808942ae83e4b8559313467bfa3c4ed5ae9e77..b131506b026bc658b02edeaba95bec4388a31df6 100644 |
| --- a/base/test/test_launcher.cc |
| +++ b/base/test/test_launcher.cc |
| @@ -121,6 +121,10 @@ class ResultsPrinter { |
| // Called when test named |name| is scheduled to be started. |
| void OnTestStarted(const std::string& name); |
| + // Called when all tests that were to be started have been scheduled |
| + // to be started. |
| + void OnAllTestsStarted(); |
| + |
| // Adds |result| to the stored test results. |
| void AddTestResult(const TestResult& result); |
| @@ -228,6 +232,18 @@ void ResultsPrinter::OnTestStarted(const std::string& name) { |
| ++test_started_count_; |
| } |
| +void ResultsPrinter::OnAllTestsStarted() { |
| + if (test_started_count_ == 0) { |
| + fprintf(stdout, "0 tests run\n"); |
|
Ken Russell (switch to Gerrit)
2013/09/04 18:00:30
Did you mean to leave this printf in here?
Paweł Hajdan Jr.
2013/09/04 18:02:30
Yes - it corresponds to "x tests run" below and ex
|
| + fflush(stdout); |
| + |
| + // No tests have actually been started, so fire the callback |
| + // to avoid a hang. |
| + callback_.Run(true); |
| + delete this; |
| + } |
| +} |
| + |
| void ResultsPrinter::AddTestResult(const TestResult& result) { |
| DCHECK(thread_checker_.CalledOnValidThread()); |
| @@ -405,6 +421,10 @@ void RunTests(TestLauncherDelegate* launcher_delegate, |
| FROM_HERE, |
| Bind(&TestLauncherDelegate::RunRemainingTests, |
| Unretained(launcher_delegate))); |
| + |
| + MessageLoop::current()->PostTask( |
| + FROM_HERE, |
| + Bind(&ResultsPrinter::OnAllTestsStarted, Unretained(printer))); |
| } |
| void RunTestIteration(TestLauncherDelegate* launcher_delegate, |