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

Unified Diff: base/test/launcher/test_launcher.cc

Issue 833243008: Update from https://crrev.com/311145 (Closed) Base URL: git@github.com:domokit/mojo.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
« no previous file with comments | « base/process/process_util_unittest.cc ('k') | base/test/multiprocess_test.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/launcher/test_launcher.cc
diff --git a/base/test/launcher/test_launcher.cc b/base/test/launcher/test_launcher.cc
index 707a4d7a98c951cf4962e8198f58eb96b2807a28..af2e461bc01d28361c103ec3a5b616801116810c 100644
--- a/base/test/launcher/test_launcher.cc
+++ b/base/test/launcher/test_launcher.cc
@@ -287,7 +287,7 @@ int LaunchChildTestProcessWithOptions(const CommandLine& command_line,
new_options.allow_new_privs = true;
#endif
- ProcessHandle process_handle;
+ Process process;
{
// Note how we grab the lock before the process possibly gets created.
@@ -295,19 +295,22 @@ int LaunchChildTestProcessWithOptions(const CommandLine& command_line,
// in the set.
AutoLock lock(g_live_processes_lock.Get());
- if (!LaunchProcess(command_line, new_options, &process_handle))
+ process = LaunchProcess(command_line, new_options);
+ if (!process.IsValid())
return -1;
- g_live_processes.Get().insert(std::make_pair(process_handle, command_line));
+ // TODO(rvargas) crbug.com/417532: Don't store process handles.
+ g_live_processes.Get().insert(std::make_pair(process.Handle(),
+ command_line));
}
int exit_code = 0;
- if (!WaitForExitCodeWithTimeout(process_handle, &exit_code, timeout)) {
+ if (!process.WaitForExitWithTimeout(timeout, &exit_code)) {
*was_timeout = true;
exit_code = -1; // Set a non-zero exit code to signal a failure.
// Ensure that the process terminates.
- KillProcess(process_handle, -1, true);
+ KillProcess(process.Handle(), -1, true);
}
{
@@ -322,15 +325,13 @@ int LaunchChildTestProcessWithOptions(const CommandLine& command_line,
// or due to it timing out, we need to clean up any child processes that
// it might have created. On Windows, child processes are automatically
// cleaned up using JobObjects.
- KillProcessGroup(process_handle);
+ KillProcessGroup(process.Handle());
}
#endif
- g_live_processes.Get().erase(process_handle);
+ g_live_processes.Get().erase(process.Handle());
}
- CloseProcessHandle(process_handle);
-
return exit_code;
}
« no previous file with comments | « base/process/process_util_unittest.cc ('k') | base/test/multiprocess_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698