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; |