diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-16 07:41:22 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-16 07:41:22 +0000 |
commit | 8004e68a8f23602f928eb4f0180f041b97d7ea0a (patch) | |
tree | 62fb0d4e19bd39aefd60e6cbd9fe51568c21d202 /base/process_util_posix.cc | |
parent | 30248507aa0aac429bdd2b9f68dae9a2a5f08848 (diff) | |
download | chromium_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 'base/process_util_posix.cc')
-rw-r--r-- | base/process_util_posix.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/base/process_util_posix.cc b/base/process_util_posix.cc index e9f2990..7dc0589 100644 --- a/base/process_util_posix.cc +++ b/base/process_util_posix.cc @@ -689,6 +689,25 @@ bool WaitForExitCode(ProcessHandle handle, int* exit_code) { return false; } +bool WaitForExitCodeWithTimeout(ProcessHandle handle, int* exit_code, + int64 timeout_milliseconds) { + bool waitpid_success = false; + int status = WaitpidWithTimeout(handle, timeout_milliseconds, + &waitpid_success); + if (status == -1) + return false; + if (!waitpid_success) + return false; + if (!WIFEXITED(status)) + return false; + if (WIFSIGNALED(status)) { + *exit_code = -1; + return true; + } + *exit_code = WEXITSTATUS(status); + return true; +} + bool WaitForSingleProcess(ProcessHandle handle, int64 wait_milliseconds) { bool waitpid_success; int status; |