summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbruening@chromium.org <bruening@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-23 17:35:14 +0000
committerbruening@chromium.org <bruening@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-23 17:35:14 +0000
commitaff8b47835f1f9faa471fd23b8db782cdb492ddd (patch)
tree4bbebd764641059d9ee9830817750fc344304cc1
parent3fa1e6f635218c2838ad9de205bd8e32df3a9905 (diff)
downloadchromium_src-aff8b47835f1f9faa471fd23b8db782cdb492ddd.zip
chromium_src-aff8b47835f1f9faa471fd23b8db782cdb492ddd.tar.gz
chromium_src-aff8b47835f1f9faa471fd23b8db782cdb492ddd.tar.bz2
check for successful exit code in WaitForSingleProcess on Windows to
match other platforms. consequentially, in browser tests, add PROCESS_QUERY_INFORMATION to the rights requested when opening a child serviceprocess handle so the exit code can be queried. BUG=106234 TEST=Ran base_unittests.exe --gtest_filter="ProcessUtilTest.SpawnChild" with the child custom-tweaked to fail and verified that prior to my change (with HEAD) the failure is NOT detected and the test passes; with this change the failure is detected. Review URL: http://codereview.chromium.org/8964004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118695 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/process_util_win.cc8
-rw-r--r--chrome/browser/service/service_process_control_browsertest.cc4
2 files changed, 8 insertions, 4 deletions
diff --git a/base/process_util_win.cc b/base/process_util_win.cc
index dc165ec..19041cc 100644
--- a/base/process_util_win.cc
+++ b/base/process_util_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -607,8 +607,10 @@ bool WaitForProcessesToExit(const std::wstring& executable_name,
}
bool WaitForSingleProcess(ProcessHandle handle, int64 wait_milliseconds) {
- bool retval = WaitForSingleObject(handle, wait_milliseconds) == WAIT_OBJECT_0;
- return retval;
+ int exit_code;
+ if (!WaitForExitCodeWithTimeout(handle, &exit_code, wait_milliseconds))
+ return false;
+ return exit_code == 0;
}
bool CleanupProcesses(const std::wstring& executable_name,
diff --git a/chrome/browser/service/service_process_control_browsertest.cc b/chrome/browser/service/service_process_control_browsertest.cc
index 638ec51..714c59a 100644
--- a/chrome/browser/service/service_process_control_browsertest.cc
+++ b/chrome/browser/service/service_process_control_browsertest.cc
@@ -75,7 +75,9 @@ class ServiceProcessControlBrowserTest
EXPECT_NE(static_cast<base::ProcessId>(0), service_pid);
EXPECT_TRUE(base::OpenProcessHandleWithAccess(
service_pid,
- base::kProcessAccessWaitForTermination,
+ base::kProcessAccessWaitForTermination |
+ // we need query permission to get exit code
+ base::kProcessAccessQueryInformation,
&service_process_handle_));
// Quit the current message. Post a QuitTask instead of just calling Quit()
// because this can get invoked in the context of a Launch() call and we