Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(826)

Unified Diff: components/browser_watcher/watcher_client_win_unittest.cc

Issue 859413003: Remove uses of CloseProcessHandle. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/browser_watcher/watcher_client_win_unittest.cc
diff --git a/components/browser_watcher/watcher_client_win_unittest.cc b/components/browser_watcher/watcher_client_win_unittest.cc
index 2e19f42064140d6d2b017580496e8bfcdf1b1719..bfe4a57972e4c9911e7e6c122498ccbf3125def9 100644
--- a/components/browser_watcher/watcher_client_win_unittest.cc
+++ b/components/browser_watcher/watcher_client_win_unittest.cc
@@ -10,8 +10,8 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/logging.h"
-#include "base/process/process_handle.h"
#include "base/process/kill.h"
+#include "base/process/process.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/test/multiprocess_test.h"
@@ -142,19 +142,19 @@ class WatcherClientTest : public base::MultiProcessTest {
// Duplicate the process handle to work around the fact that
// WaitForExitCode closes it(!!!).
Sigurður Ásgeirsson 2015/01/26 14:21:29 Stale comment. I think the dupe is still necessar
rvargas (doing something else) 2015/02/02 20:57:00 Done.
- base::ProcessHandle dupe = NULL;
+ base::ProcessHandle duped_handle = NULL;
ASSERT_TRUE(::DuplicateHandle(base::GetCurrentProcessHandle(),
handle,
base::GetCurrentProcessHandle(),
- &dupe,
+ &duped_handle,
SYNCHRONIZE | PROCESS_QUERY_INFORMATION,
FALSE,
0));
- ASSERT_NE(base::kNullProcessHandle, dupe);
+ base::Process duped_process(duped_handle);
+ ASSERT_TRUE(duped_process.IsValid());
int exit_code = 0;
- if (!base::WaitForExitCode(dupe, &exit_code)) {
- base::CloseProcessHandle(dupe);
- FAIL() << "WaitForExitCode failed.";
+ if (!duped_process.WaitForExit(&exit_code)) {
+ FAIL() << "WaitForExit failed.";
}
ASSERT_EQ(0, exit_code);
}

Powered by Google App Engine
This is Rietveld 408576698