| 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/test_launcher.h" | 5 #include "base/test/test_launcher.h" |
| 6 | 6 |
| 7 #if defined(OS_POSIX) | 7 #if defined(OS_POSIX) |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 test_run_count_, | 344 test_run_count_, |
| 345 test_started_count_, | 345 test_started_count_, |
| 346 result.GetFullName().c_str())); | 346 result.GetFullName().c_str())); |
| 347 if (result.completed()) { | 347 if (result.completed()) { |
| 348 status_line.append(StringPrintf("(%" PRId64 " ms)", | 348 status_line.append(StringPrintf("(%" PRId64 " ms)", |
| 349 result.elapsed_time.InMilliseconds())); | 349 result.elapsed_time.InMilliseconds())); |
| 350 } else if (result.status == TestResult::TEST_TIMEOUT) { | 350 } else if (result.status == TestResult::TEST_TIMEOUT) { |
| 351 status_line.append("(TIMED OUT)"); | 351 status_line.append("(TIMED OUT)"); |
| 352 } else if (result.status == TestResult::TEST_CRASH) { | 352 } else if (result.status == TestResult::TEST_CRASH) { |
| 353 status_line.append("(CRASHED)"); | 353 status_line.append("(CRASHED)"); |
| 354 } else if (result.status == TestResult::TEST_SKIPPED) { |
| 355 status_line.append("(SKIPPED)"); |
| 354 } else if (result.status == TestResult::TEST_UNKNOWN) { | 356 } else if (result.status == TestResult::TEST_UNKNOWN) { |
| 355 status_line.append("(UNKNOWN)"); | 357 status_line.append("(UNKNOWN)"); |
| 356 } else { | 358 } else { |
| 357 // Fail very loudly so it's not ignored. | 359 // Fail very loudly so it's not ignored. |
| 358 CHECK(false) << "Unhandled test result status: " << result.status; | 360 CHECK(false) << "Unhandled test result status: " << result.status; |
| 359 } | 361 } |
| 360 fprintf(stdout, "%s\n", status_line.c_str()); | 362 fprintf(stdout, "%s\n", status_line.c_str()); |
| 361 fflush(stdout); | 363 fflush(stdout); |
| 362 | 364 |
| 363 tests_by_status_[result.status].push_back(result.GetFullName()); | 365 tests_by_status_[result.status].push_back(result.GetFullName()); |
| 364 | 366 |
| 365 if (test_run_count_ == test_started_count_) { | 367 if (test_run_count_ == test_started_count_) { |
| 366 fprintf(stdout, "%" PRIuS " test%s run\n", | 368 fprintf(stdout, "%" PRIuS " test%s run\n", |
| 367 test_run_count_, | 369 test_run_count_, |
| 368 test_run_count_ > 1 ? "s" : ""); | 370 test_run_count_ > 1 ? "s" : ""); |
| 369 fflush(stdout); | 371 fflush(stdout); |
| 370 | 372 |
| 371 PrintTestsByStatus(TestResult::TEST_FAILURE, "failed"); | 373 PrintTestsByStatus(TestResult::TEST_FAILURE, "failed"); |
| 372 PrintTestsByStatus(TestResult::TEST_TIMEOUT, "timed out"); | 374 PrintTestsByStatus(TestResult::TEST_TIMEOUT, "timed out"); |
| 373 PrintTestsByStatus(TestResult::TEST_CRASH, "crashed"); | 375 PrintTestsByStatus(TestResult::TEST_CRASH, "crashed"); |
| 376 PrintTestsByStatus(TestResult::TEST_SKIPPED, "skipped"); |
| 374 PrintTestsByStatus(TestResult::TEST_UNKNOWN, "had unknown result"); | 377 PrintTestsByStatus(TestResult::TEST_UNKNOWN, "had unknown result"); |
| 375 | 378 |
| 376 callback_.Run( | 379 callback_.Run( |
| 377 tests_by_status_[TestResult::TEST_SUCCESS].size() == test_run_count_); | 380 tests_by_status_[TestResult::TEST_SUCCESS].size() == test_run_count_); |
| 378 | 381 |
| 379 delete this; | 382 delete this; |
| 380 } | 383 } |
| 381 } | 384 } |
| 382 | 385 |
| 383 WeakPtr<ResultsPrinter> ResultsPrinter::GetWeakPtr() { | 386 WeakPtr<ResultsPrinter> ResultsPrinter::GetWeakPtr() { |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 cycles, | 779 cycles, |
| 777 &exit_code, | 780 &exit_code, |
| 778 true)); | 781 true)); |
| 779 | 782 |
| 780 MessageLoop::current()->Run(); | 783 MessageLoop::current()->Run(); |
| 781 | 784 |
| 782 return exit_code; | 785 return exit_code; |
| 783 } | 786 } |
| 784 | 787 |
| 785 } // namespace base | 788 } // namespace base |
| OLD | NEW |