summaryrefslogtreecommitdiffstats
path: root/chrome/test/test_launcher
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-16 07:41:22 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-16 07:41:22 +0000
commit8004e68a8f23602f928eb4f0180f041b97d7ea0a (patch)
tree62fb0d4e19bd39aefd60e6cbd9fe51568c21d202 /chrome/test/test_launcher
parent30248507aa0aac429bdd2b9f68dae9a2a5f08848 (diff)
downloadchromium_src-8004e68a8f23602f928eb4f0180f041b97d7ea0a.zip
chromium_src-8004e68a8f23602f928eb4f0180f041b97d7ea0a.tar.gz
chromium_src-8004e68a8f23602f928eb4f0180f041b97d7ea0a.tar.bz2
[GTTF] Add an always-working timeout for browser_tests.
This one is implemented in the out-of-process launcher, so it's guaranteed to work. Not removing the MessageLoop delayed task sent inside the test because currently not all browser tests use the launcher (sync tests?). TEST=browser_tests BUG=38053 Review URL: http://codereview.chromium.org/949002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41694 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/test_launcher')
-rw-r--r--chrome/test/test_launcher/out_of_proc_test_runner.cc17
1 files changed, 12 insertions, 5 deletions
diff --git a/chrome/test/test_launcher/out_of_proc_test_runner.cc b/chrome/test/test_launcher/out_of_proc_test_runner.cc
index 98bdeca..4d929a9 100644
--- a/chrome/test/test_launcher/out_of_proc_test_runner.cc
+++ b/chrome/test/test_launcher/out_of_proc_test_runner.cc
@@ -24,6 +24,8 @@ const char kSingleProcessAltFlag[] = "single_process";
const char kChildProcessFlag[] = "child";
const char kHelpFlag[] = "help";
+const int64 kTestTimeoutMs = 30000;
+
class OutOfProcTestRunner : public tests::TestRunner {
public:
OutOfProcTestRunner() {
@@ -53,14 +55,19 @@ class OutOfProcTestRunner : public tests::TestRunner {
new_cmd_line.AppendSwitch(kChildProcessFlag);
base::ProcessHandle process_handle;
- bool r = base::LaunchApp(new_cmd_line, false, false, &process_handle);
- if (!r)
+ if (!base::LaunchApp(new_cmd_line, false, false, &process_handle))
return false;
int exit_code = 0;
- r = base::WaitForExitCode(process_handle, &exit_code);
- if (!r)
- return false;
+ if (!base::WaitForExitCodeWithTimeout(process_handle, &exit_code,
+ kTestTimeoutMs)) {
+ LOG(ERROR) << "Test timeout exceeded!";
+
+ exit_code = -1; // Set a non-zero exit code to signal a failure.
+
+ // Ensure that the process terminates.
+ base::KillProcess(process_handle, -1, true);
+ }
return exit_code == 0;
}