Index: base/test/unit_test_launcher.cc |
diff --git a/base/test/unit_test_launcher.cc b/base/test/unit_test_launcher.cc |
index af2998aa816cb7514479d8426bba50c12968fc4e..daf264d8309c1221ebd1344d067dab3313c85099 100644 |
--- a/base/test/unit_test_launcher.cc |
+++ b/base/test/unit_test_launcher.cc |
@@ -159,7 +159,7 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate { |
// Note: do NOT parse child's stdout to do that, it's known to be |
// unreliable (e.g. buffering issues can mix up the output). |
base::TimeDelta timeout = |
- test_names.size() * TestTimeouts::action_timeout(); |
+ test_names.size() * TestTimeouts::test_launcher_timeout(); |
parallel_launcher_.LaunchChildGTestProcess( |
cmd_line, |
@@ -234,6 +234,17 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate { |
// a crash. |
test_result.status = TestResult::TEST_TIMEOUT; |
} |
+ } else if (test_result.status == TestResult::TEST_SUCCESS || |
+ test_result.status == TestResult::TEST_FAILURE) { |
+ // We run multiple tests in a batch with a timeout applied |
+ // to the entire batch. It is possible that with other tests |
+ // running quickly some tests take longer than the per-test timeout. |
+ // For consistent handling of tests independent of order and other |
+ // factors, mark them as timing out. |
+ if (test_result.elapsed_time > |
+ TestTimeouts::test_launcher_timeout()) { |
+ test_result.status = TestResult::TEST_TIMEOUT; |
+ } |
} |
PrintTestOutputSnippetOnFailure(test_result, output); |
tests[i].callback.Run(test_result); |