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

Side by Side Diff: sandbox/win/tests/common/controller.cc

Issue 2513163002: Add unittest that sandbox::PolicyBase outlives child process. (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « sandbox/win/tests/common/controller.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "sandbox/win/tests/common/controller.h" 5 #include "sandbox/win/tests/common/controller.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/memory/shared_memory.h" 9 #include "base/memory/shared_memory.h"
10 #include "base/process/process.h" 10 #include "base/process/process.h"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 if (no_sandbox_) { 235 if (no_sandbox_) {
236 STARTUPINFO startup_info = {sizeof(STARTUPINFO)}; 236 STARTUPINFO startup_info = {sizeof(STARTUPINFO)};
237 if (!::CreateProcessW(prog_name, &arguments[0], NULL, NULL, FALSE, 0, 237 if (!::CreateProcessW(prog_name, &arguments[0], NULL, NULL, FALSE, 0,
238 NULL, NULL, &startup_info, &target)) { 238 NULL, NULL, &startup_info, &target)) {
239 return SBOX_ERROR_GENERIC; 239 return SBOX_ERROR_GENERIC;
240 } 240 }
241 } else { 241 } else {
242 result = broker_->SpawnTarget(prog_name, arguments.c_str(), policy_, 242 result = broker_->SpawnTarget(prog_name, arguments.c_str(), policy_,
243 &warning_result, &last_error, &target); 243 &warning_result, &last_error, &target);
244 } 244 }
245 if (release_policy_in_run_) {
246 policy_->Release();
247 policy_ = nullptr;
248 }
245 249
246 if (SBOX_ALL_OK != result) 250 if (SBOX_ALL_OK != result)
247 return SBOX_TEST_FAILED_TO_RUN_TEST; 251 return SBOX_TEST_FAILED_TO_RUN_TEST;
248 252
249 ::ResumeThread(target.hThread); 253 ::ResumeThread(target.hThread);
250 254
251 // For an asynchronous run we don't bother waiting. 255 // For an asynchronous run we don't bother waiting.
252 if (is_async_) { 256 if (is_async_) {
253 target_process_.Set(target.hProcess); 257 target_process_.Set(target.hProcess);
254 target_process_id_ = target.dwProcessId; 258 target_process_id_ = target.dwProcessId;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 372
369 target->LowerToken(); 373 target->LowerToken();
370 } else if (0 != _wcsicmp(argv[1], L"-child-no-sandbox")) { 374 } else if (0 != _wcsicmp(argv[1], L"-child-no-sandbox")) {
371 return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND; 375 return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND;
372 } 376 }
373 377
374 return command(argc - 4, argv + 4); 378 return command(argc - 4, argv + 4);
375 } 379 }
376 380
377 } // namespace sandbox 381 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/win/tests/common/controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698