diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-05 17:10:48 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-05 17:10:48 +0000 |
commit | d3c534e7b75703e244a87b7c396d075c9a409779 (patch) | |
tree | 4192b7344906d639897cfda8cfb2064894f473f7 /base/process_util.h | |
parent | 7f4956df940f569afabef6885803d4d94f5c0a1e (diff) | |
download | chromium_src-d3c534e7b75703e244a87b7c396d075c9a409779.zip chromium_src-d3c534e7b75703e244a87b7c396d075c9a409779.tar.gz chromium_src-d3c534e7b75703e244a87b7c396d075c9a409779.tar.bz2 |
GTTF: Detect browser crashes on shutdown in UI tests.
Previously the automation framework could miss a browser
crash during shutdown on POSIX (on Windows there is
crash_service.exe that should catch all crashes).
This change makes the automation framework avoid losing
information about the browser process' exit status
(CrashAwareSleep), and fixes a bug in base::WaitForExitCodeWithTimeout
(which on POSIX never reported the process has been signaled).
Finally, it makes the automation framework use WaitForExitCodeWithTimeout
instead of WaitForSingleProcess. This way we can get the exit status
information in an accurate and cross-platform way.
To avoid trying to close the same process handle twice (it's only an issue on Windows) I've changed WaitForExitCodeWithTimeout not to close the passed handle. It's only used in few places and I think this CL fixes all of them.
I've tested this change locally on Mac with a UI test that SIGKILLs the browser.
Before this change the test passed (it shouldn't), and after this change
the test failed with an information that the browser has not exited cleanly.
BUG=56644
Review URL: http://codereview.chromium.org/6689014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80472 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/process_util.h')
-rw-r--r-- | base/process_util.h | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/base/process_util.h b/base/process_util.h index b3d311e..bdf9b9e 100644 --- a/base/process_util.h +++ b/base/process_util.h @@ -373,10 +373,11 @@ BASE_API TerminationStatus GetTerminationStatus(ProcessHandle handle, BASE_API bool WaitForExitCode(ProcessHandle handle, int* exit_code); // Waits for process to exit. If it did exit within |timeout_milliseconds|, -// then puts the exit code in |exit_code|, closes |handle|, and returns true. +// then puts the exit code in |exit_code|, and returns true. // In POSIX systems, if the process has been signaled then |exit_code| is set // to -1. Returns false on failure (the caller is then responsible for closing // |handle|). +// The caller is always responsible for closing the |handle|. BASE_API bool WaitForExitCodeWithTimeout(ProcessHandle handle, int* exit_code, int64 timeout_milliseconds); @@ -395,10 +396,6 @@ BASE_API bool WaitForProcessesToExit( BASE_API bool WaitForSingleProcess(ProcessHandle handle, int64 wait_milliseconds); -// Returns true when |wait_milliseconds| have elapsed and the process -// is still running. -BASE_API bool CrashAwareSleep(ProcessHandle handle, int64 wait_milliseconds); - // Waits a certain amount of time (can be 0) for all the processes with a given // executable name to exit, then kills off any of them that are still around. // If filter is non-null, then only processes selected by the filter are waited |