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

Unified Diff: base/test/test_launcher.cc

Issue 23480061: GTTF: launch test processes using job objects on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 7 years, 3 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/launch_win.cc ('k') | chrome/browser/component_updater/component_patcher_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/test_launcher.cc
diff --git a/base/test/test_launcher.cc b/base/test/test_launcher.cc
index 0dc97d1f990ffe6778494aa652b44020c13484c8..ff884c8113018b56acef4e4a6c630bac95b142fc 100644
--- a/base/test/test_launcher.cc
+++ b/base/test/test_launcher.cc
@@ -625,6 +625,30 @@ int LaunchChildTestProcessWithOptions(const CommandLine& command_line,
DCHECK(options.new_process_group);
#endif
+ LaunchOptions new_options(options);
+
+#if defined(OS_WIN)
+ DCHECK(!new_options.job_handle);
+
+ win::ScopedHandle job_handle(CreateJobObject(NULL, NULL));
+ if (!job_handle.IsValid()) {
+ LOG(ERROR) << "Could not create JobObject.";
+ return -1;
+ }
+
+ // Allow break-away from job since sandbox and few other places rely on it
+ // on Windows versions prior to Windows 8 (which supports nested jobs).
+ // TODO(phajdan.jr): Do not allow break-away on Windows 8.
+ if (!SetJobObjectLimitFlags(job_handle.Get(),
+ JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE |
+ JOB_OBJECT_LIMIT_BREAKAWAY_OK)) {
+ LOG(ERROR) << "Could not SetJobObjectLimitFlags.";
+ return -1;
+ }
+
+ new_options.job_handle = job_handle.Get();
+#endif // defined(OS_WIN)
+
base::ProcessHandle process_handle;
{
@@ -633,7 +657,7 @@ int LaunchChildTestProcessWithOptions(const CommandLine& command_line,
// in the set.
AutoLock lock(g_live_process_handles_lock.Get());
- if (!base::LaunchProcess(command_line, options, &process_handle))
+ if (!base::LaunchProcess(command_line, new_options, &process_handle))
return -1;
g_live_process_handles.Get().insert(process_handle);
« no previous file with comments | « base/process/launch_win.cc ('k') | chrome/browser/component_updater/component_patcher_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698