| OLD | NEW |
| 1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2010 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 "base/win_util.h" | 5 #include "base/win_util.h" |
| 6 #include "sandbox/src/sandbox.h" | 6 #include "sandbox/src/sandbox.h" |
| 7 #include "sandbox/src/sandbox_factory.h" | 7 #include "sandbox/src/sandbox_factory.h" |
| 8 #include "sandbox/src/sandbox_utils.h" | 8 #include "sandbox/src/sandbox_utils.h" |
| 9 #include "sandbox/src/target_services.h" | 9 #include "sandbox/src/target_services.h" |
| 10 #include "sandbox/tests/common/controller.h" | 10 #include "sandbox/tests/common/controller.h" |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"PolicyTargetTest_thread2")) << | 202 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"PolicyTargetTest_thread2")) << |
| 203 "Creates a new thread and opens it"; | 203 "Creates a new thread and opens it"; |
| 204 } | 204 } |
| 205 | 205 |
| 206 TEST(PolicyTargetTest, OpenProcess) { | 206 TEST(PolicyTargetTest, OpenProcess) { |
| 207 TestRunner runner; | 207 TestRunner runner; |
| 208 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"PolicyTargetTest_process")) << | 208 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"PolicyTargetTest_process")) << |
| 209 "Opens a process"; | 209 "Opens a process"; |
| 210 } | 210 } |
| 211 | 211 |
| 212 #if !defined(_WIN64) | |
| 213 | |
| 214 // Launches the app in the sandbox and ask it to wait in an | 212 // Launches the app in the sandbox and ask it to wait in an |
| 215 // infinite loop. Waits for 2 seconds and then check if the | 213 // infinite loop. Waits for 2 seconds and then check if the |
| 216 // desktop associated with the app thread is not the same as the | 214 // desktop associated with the app thread is not the same as the |
| 217 // current desktop. | 215 // current desktop. |
| 218 TEST(PolicyTargetTest, DesktopPolicy) { | 216 TEST(PolicyTargetTest, DesktopPolicy) { |
| 219 BrokerServices* broker = GetBroker(); | 217 BrokerServices* broker = GetBroker(); |
| 220 | 218 |
| 221 // Precreate the desktop. | 219 // Precreate the desktop. |
| 222 TargetPolicy* temp_policy = broker->CreatePolicy(); | 220 TargetPolicy* temp_policy = broker->CreatePolicy(); |
| 223 temp_policy->CreateAlternateDesktop(false); | 221 temp_policy->CreateAlternateDesktop(false); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 ::WaitForSingleObject(target.hProcess, INFINITE); | 329 ::WaitForSingleObject(target.hProcess, INFINITE); |
| 332 | 330 |
| 333 EXPECT_TRUE(::CloseHandle(target.hProcess)); | 331 EXPECT_TRUE(::CloseHandle(target.hProcess)); |
| 334 EXPECT_TRUE(::CloseHandle(target.hThread)); | 332 EXPECT_TRUE(::CloseHandle(target.hThread)); |
| 335 | 333 |
| 336 // Close the desktop handle. | 334 // Close the desktop handle. |
| 337 temp_policy = broker->CreatePolicy(); | 335 temp_policy = broker->CreatePolicy(); |
| 338 temp_policy->DestroyAlternateDesktop(); | 336 temp_policy->DestroyAlternateDesktop(); |
| 339 temp_policy->Release(); | 337 temp_policy->Release(); |
| 340 } | 338 } |
| 341 #endif // _WIN64 | |
| 342 | 339 |
| 343 } // namespace sandbox | 340 } // namespace sandbox |
| OLD | NEW |