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 <memory> | 5 #include <memory> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
9 #include "base/win/scoped_handle.h" | 9 #include "base/win/scoped_handle.h" |
10 #include "base/win/scoped_process_information.h" | 10 #include "base/win/scoped_process_information.h" |
11 #include "sandbox/src/sandbox.h" | 11 #include "sandbox/win/src/sandbox.h" |
12 #include "sandbox/src/sandbox_policy.h" | 12 #include "sandbox/win/src/sandbox_policy.h" |
13 #include "sandbox/src/sandbox_factory.h" | 13 #include "sandbox/win/src/sandbox_factory.h" |
14 #include "sandbox/tests/common/controller.h" | 14 #include "sandbox/win/tests/common/controller.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 // While the shell API provides better calls than this home brew function | 19 // While the shell API provides better calls than this home brew function |
20 // we use GetSystemWindowsDirectoryW which does not query the registry so | 20 // we use GetSystemWindowsDirectoryW which does not query the registry so |
21 // it is safe to use after revert. | 21 // it is safe to use after revert. |
22 std::wstring MakeFullPathToSystem32(const wchar_t* name) { | 22 std::wstring MakeFullPathToSystem32(const wchar_t* name) { |
23 wchar_t windows_path[MAX_PATH] = {0}; | 23 wchar_t windows_path[MAX_PATH] = {0}; |
24 ::GetSystemWindowsDirectoryW(windows_path, MAX_PATH); | 24 ::GetSystemWindowsDirectoryW(windows_path, MAX_PATH); |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 ASSERT_TRUE(!exe_path.empty()); | 286 ASSERT_TRUE(!exe_path.empty()); |
287 EXPECT_TRUE(runner.AddRule(TargetPolicy::SUBSYS_PROCESS, | 287 EXPECT_TRUE(runner.AddRule(TargetPolicy::SUBSYS_PROCESS, |
288 TargetPolicy::PROCESS_ALL_EXEC, | 288 TargetPolicy::PROCESS_ALL_EXEC, |
289 exe_path.c_str())); | 289 exe_path.c_str())); |
290 | 290 |
291 EXPECT_EQ(SBOX_TEST_SUCCEEDED, | 291 EXPECT_EQ(SBOX_TEST_SUCCEEDED, |
292 runner.RunTest(L"Process_GetChildProcessToken findstr.exe")); | 292 runner.RunTest(L"Process_GetChildProcessToken findstr.exe")); |
293 } | 293 } |
294 | 294 |
295 } // namespace sandbox | 295 } // namespace sandbox |
OLD | NEW |