diff options
author | jschuh@chromium.org <jschuh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-11 00:47:12 +0000 |
---|---|---|
committer | jschuh@chromium.org <jschuh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-11 00:47:12 +0000 |
commit | f11a2162332dbbc8130e9ece793bc6c7859ac848 (patch) | |
tree | eb3a40a98e6e099a393d262c4a8de6011bdf6891 /sandbox/tests/common | |
parent | d09419413a2f888a9aefe4d0a1b7c1806339fbe9 (diff) | |
download | chromium_src-f11a2162332dbbc8130e9ece793bc6c7859ac848.zip chromium_src-f11a2162332dbbc8130e9ece793bc6c7859ac848.tar.gz chromium_src-f11a2162332dbbc8130e9ece793bc6c7859ac848.tar.bz2 |
Revert 131671 - Add sandbox support for associating peer processes
TEST=HandlePolicyTest.DuplicatePeerHandle
Review URL: https://chromiumcodereview.appspot.com/9960045
TBR=jschuh@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10052001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131684 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox/tests/common')
-rw-r--r-- | sandbox/tests/common/controller.cc | 46 | ||||
-rw-r--r-- | sandbox/tests/common/controller.h | 4 |
2 files changed, 14 insertions, 36 deletions
diff --git a/sandbox/tests/common/controller.cc b/sandbox/tests/common/controller.cc index e691646..3de3221 100644 --- a/sandbox/tests/common/controller.cc +++ b/sandbox/tests/common/controller.cc @@ -6,8 +6,6 @@ #include <string> -#include "base/process.h" -#include "base/process_util.h" #include "base/sys_string_conversions.h" #include "base/win/windows_version.h" #include "sandbox/src/sandbox_factory.h" @@ -91,14 +89,12 @@ BrokerServices* GetBroker() { TestRunner::TestRunner(JobLevel job_level, TokenLevel startup_token, TokenLevel main_token) - : is_init_(false), is_async_(false), no_sandbox_(false), - target_process_id_(0) { + : is_init_(false), is_async_(false), target_process_id_(0) { Init(job_level, startup_token, main_token); } TestRunner::TestRunner() - : is_init_(false), is_async_(false), no_sandbox_(false), - target_process_id_(0) { + : is_init_(false), is_async_(false), target_process_id_(0) { Init(JOB_LOCKDOWN, USER_RESTRICTED_SAME_ACCESS, USER_LOCKDOWN); } @@ -213,23 +209,11 @@ int TestRunner::InternalRunTest(const wchar_t* command) { std::wstring arguments(L"\""); arguments += prog_name; - arguments += L"\" -child"; - arguments += no_sandbox_ ? L"-no-sandbox " : L" "; + arguments += L"\" -child "; arguments += command; - if (no_sandbox_) { - STARTUPINFO startup_info = {sizeof(STARTUPINFO)}; - if (::CreateProcessW(prog_name, &arguments[0], NULL, NULL, FALSE, 0, - NULL, NULL, &startup_info, &target)) { - result = SBOX_ALL_OK; - SandboxFactory::GetBrokerServices()->AddTargetPeer(target.hProcess); - } else { - result = SBOX_ERROR_GENERIC; - } - } else { - result = broker_->SpawnTarget(prog_name, arguments.c_str(), policy_, - &target); - } + result = broker_->SpawnTarget(prog_name, arguments.c_str(), policy_, + &target); if (SBOX_ALL_OK != result) return SBOX_TEST_FAILED_TO_RUN_TEST; @@ -320,20 +304,18 @@ int DispatchCall(int argc, wchar_t **argv) { command(argc - 4, argv + 4); TargetServices* target = SandboxFactory::GetTargetServices(); - if (target) { - if (SBOX_ALL_OK != target->Init()) - return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND; - - if (BEFORE_REVERT == state) - return command(argc - 4, argv + 4); - else if (EVERY_STATE == state) - command(argc - 4, argv + 4); + if (!target) + return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND; - target->LowerToken(); - } else if (0 != _wcsicmp(argv[1], L"-child-no-sandbox")) { + if (SBOX_ALL_OK != target->Init()) return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND; - } + if (BEFORE_REVERT == state) + return command(argc - 4, argv + 4); + else if (EVERY_STATE == state) + command(argc - 4, argv + 4); + + target->LowerToken(); return command(argc - 4, argv + 4); } diff --git a/sandbox/tests/common/controller.h b/sandbox/tests/common/controller.h index 5c2a471..0a78a0e 100644 --- a/sandbox/tests/common/controller.h +++ b/sandbox/tests/common/controller.h @@ -95,9 +95,6 @@ class TestRunner { // Sets TestRunner to return without waiting for the process to exit. void SetAsynchronous(bool is_async) { is_async_ = is_async; } - // Sets TestRunner to return without waiting for the process to exit. - void SetUnsandboxed(bool is_no_sandbox) { no_sandbox_ = is_no_sandbox; } - // Sets the desired state for the test to run. void SetTestState(SboxTestsState desired_state); @@ -126,7 +123,6 @@ class TestRunner { SboxTestsState state_; bool is_init_; bool is_async_; - bool no_sandbox_; base::win::ScopedHandle target_process_; DWORD target_process_id_; }; |