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 <windows.h> | 5 #include <windows.h> |
6 | 6 |
7 #define _ATL_NO_EXCEPTIONS | 7 #define _ATL_NO_EXCEPTIONS |
8 #include <atlbase.h> | 8 #include <atlbase.h> |
9 #include <atlsecurity.h> | 9 #include <atlsecurity.h> |
10 | 10 |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "base/win/scoped_handle.h" | 12 #include "base/win/scoped_handle.h" |
13 #include "base/win/windows_version.h" | 13 #include "base/win/windows_version.h" |
14 #include "sandbox/win/src/sync_policy_test.h" | 14 #include "sandbox/win/src/sync_policy_test.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 const wchar_t kAppContainerName[] = L"sbox_test"; | 19 const wchar_t kAppContainerName[] = L"sbox_test"; |
20 const wchar_t kAppContainerSid[] = | 20 const wchar_t kAppContainerSid[] = |
21 L"S-1-15-2-3251537155-1984446955-2931258699-841473695-1938553385-" | 21 L"S-1-15-2-3251537155-1984446955-2931258699-841473695-1938553385-" |
22 L"924012148-2839372144"; | 22 L"924012148-2839372144"; |
23 | 23 |
24 const ULONG kSharing = FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE; | 24 const ULONG kSharing = FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE; |
25 | 25 |
26 HANDLE CreateTaggedEvent(const string16& name, const string16& sid) { | 26 HANDLE CreateTaggedEvent(const base::string16& name, |
| 27 const base::string16& sid) { |
27 base::win::ScopedHandle event(CreateEvent(NULL, FALSE, FALSE, name.c_str())); | 28 base::win::ScopedHandle event(CreateEvent(NULL, FALSE, FALSE, name.c_str())); |
28 if (!event.IsValid()) | 29 if (!event.IsValid()) |
29 return NULL; | 30 return NULL; |
30 | 31 |
31 wchar_t file_name[MAX_PATH] = {}; | 32 wchar_t file_name[MAX_PATH] = {}; |
32 wchar_t temp_directory[MAX_PATH] = {}; | 33 wchar_t temp_directory[MAX_PATH] = {}; |
33 GetTempPath(MAX_PATH, temp_directory); | 34 GetTempPath(MAX_PATH, temp_directory); |
34 GetTempFileName(temp_directory, L"test", 0, file_name); | 35 GetTempFileName(temp_directory, L"test", 0, file_name); |
35 | 36 |
36 base::win::ScopedHandle file; | 37 base::win::ScopedHandle file; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 TEST(AppContainerTest, RequiresImpersonation) { | 135 TEST(AppContainerTest, RequiresImpersonation) { |
135 if (base::win::OSInfo::GetInstance()->version() < base::win::VERSION_WIN8) | 136 if (base::win::OSInfo::GetInstance()->version() < base::win::VERSION_WIN8) |
136 return; | 137 return; |
137 | 138 |
138 TestRunner runner(JOB_UNPROTECTED, USER_RESTRICTED, USER_RESTRICTED); | 139 TestRunner runner(JOB_UNPROTECTED, USER_RESTRICTED, USER_RESTRICTED); |
139 EXPECT_EQ(SBOX_ERROR_CANNOT_INIT_APPCONTAINER, | 140 EXPECT_EQ(SBOX_ERROR_CANNOT_INIT_APPCONTAINER, |
140 runner.GetPolicy()->SetAppContainer(kAppContainerSid)); | 141 runner.GetPolicy()->SetAppContainer(kAppContainerSid)); |
141 } | 142 } |
142 | 143 |
143 } // namespace sandbox | 144 } // namespace sandbox |
OLD | NEW |