OLD | NEW |
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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 if (!policy_) | 129 if (!policy_) |
130 return; | 130 return; |
131 | 131 |
132 policy_->SetJobLevel(job_level, 0); | 132 policy_->SetJobLevel(job_level, 0); |
133 policy_->SetTokenLevel(startup_token, main_token); | 133 policy_->SetTokenLevel(startup_token, main_token); |
134 | 134 |
135 is_init_ = true; | 135 is_init_ = true; |
136 } | 136 } |
137 | 137 |
138 TargetPolicy* TestRunner::GetPolicy() { | 138 TargetPolicy* TestRunner::GetPolicy() { |
139 return policy_.get(); | 139 return policy_; |
140 } | 140 } |
141 | 141 |
142 TestRunner::~TestRunner() { | 142 TestRunner::~TestRunner() { |
143 if (target_process_.IsValid() && kill_on_destruction_) | 143 if (target_process_.IsValid() && kill_on_destruction_) |
144 ::TerminateProcess(target_process_.Get(), 0); | 144 ::TerminateProcess(target_process_.Get(), 0); |
| 145 |
| 146 if (policy_) |
| 147 policy_->Release(); |
145 } | 148 } |
146 | 149 |
147 bool TestRunner::AddRule(TargetPolicy::SubSystem subsystem, | 150 bool TestRunner::AddRule(TargetPolicy::SubSystem subsystem, |
148 TargetPolicy::Semantics semantics, | 151 TargetPolicy::Semantics semantics, |
149 const wchar_t* pattern) { | 152 const wchar_t* pattern) { |
150 if (!is_init_) | 153 if (!is_init_) |
151 return false; | 154 return false; |
152 | 155 |
153 return (SBOX_ALL_OK == policy_->AddRule(subsystem, semantics, pattern)); | 156 return (SBOX_ALL_OK == policy_->AddRule(subsystem, semantics, pattern)); |
154 } | 157 } |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 | 368 |
366 target->LowerToken(); | 369 target->LowerToken(); |
367 } else if (0 != _wcsicmp(argv[1], L"-child-no-sandbox")) { | 370 } else if (0 != _wcsicmp(argv[1], L"-child-no-sandbox")) { |
368 return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND; | 371 return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND; |
369 } | 372 } |
370 | 373 |
371 return command(argc - 4, argv + 4); | 374 return command(argc - 4, argv + 4); |
372 } | 375 } |
373 | 376 |
374 } // namespace sandbox | 377 } // namespace sandbox |
OLD | NEW |