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

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: 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 deabb9a4add1dc1b8ed692d08b5cb6466f4be403..a644c694f350a065efbed73af6b81e0903412114 100644
--- a/base/test/test_launcher.cc
+++ b/base/test/test_launcher.cc
@@ -540,8 +540,32 @@ 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 |
cpu_(ooo_6.6-7.5) 2013/09/10 21:08:56 but the job closes because its owned by the scoped
Paweł Hajdan Jr. 2013/09/10 21:49:53 Yes, this is intended: by the time this function r
+ JOB_OBJECT_LIMIT_BREAKAWAY_OK)) {
+ LOG(ERROR) << "Could not SetJobObjectLimitFlags.";
cpu_(ooo_6.6-7.5) 2013/09/10 21:08:56 so if the sandbox breaks away from your job then y
Paweł Hajdan Jr. 2013/09/10 21:49:53 This is not worse than the current state of things
+ return false;
sky 2013/09/11 19:29:06 -1?
Paweł Hajdan Jr. 2013/09/11 20:43:08 Done.
+ }
+
+ new_options.job_handle = job_handle.Get();
+#endif // defined(OS_WIN)
+
base::ProcessHandle process_handle;
- if (!base::LaunchProcess(command_line, options, &process_handle))
+ if (!base::LaunchProcess(command_line, new_options, &process_handle))
return -1;
int exit_code = 0;
« 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