OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/src/sync_policy_test.h" | 5 #include "sandbox/win/src/sync_policy_test.h" |
6 | 6 |
7 #include "base/win/scoped_handle.h" | 7 #include "base/win/scoped_handle.h" |
8 #include "sandbox/win/src/sandbox.h" | 8 #include "sandbox/win/src/sandbox.h" |
9 #include "sandbox/win/src/sandbox_policy.h" | 9 #include "sandbox/win/src/sandbox_policy.h" |
10 #include "sandbox/win/src/sandbox_factory.h" | 10 #include "sandbox/win/src/sandbox_factory.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 desired_access = EVENT_ALL_ACCESS; | 22 desired_access = EVENT_ALL_ACCESS; |
23 | 23 |
24 base::win::ScopedHandle event_open(::OpenEvent( | 24 base::win::ScopedHandle event_open(::OpenEvent( |
25 desired_access, FALSE, argv[1])); | 25 desired_access, FALSE, argv[1])); |
26 DWORD error_open = ::GetLastError(); | 26 DWORD error_open = ::GetLastError(); |
27 | 27 |
28 if (event_open.IsValid()) | 28 if (event_open.IsValid()) |
29 return SBOX_TEST_SUCCEEDED; | 29 return SBOX_TEST_SUCCEEDED; |
30 | 30 |
31 if (ERROR_ACCESS_DENIED == error_open || | 31 if (ERROR_ACCESS_DENIED == error_open || |
32 ERROR_BAD_PATHNAME == error_open) | 32 ERROR_BAD_PATHNAME == error_open || |
| 33 ERROR_FILE_NOT_FOUND == error_open) |
33 return SBOX_TEST_DENIED; | 34 return SBOX_TEST_DENIED; |
34 | 35 |
35 return SBOX_TEST_FAILED; | 36 return SBOX_TEST_FAILED; |
36 } | 37 } |
37 | 38 |
38 SBOX_TESTS_COMMAND int Event_CreateOpen(int argc, wchar_t **argv) { | 39 SBOX_TESTS_COMMAND int Event_CreateOpen(int argc, wchar_t **argv) { |
39 if (argc < 2 || argc > 3) | 40 if (argc < 2 || argc > 3) |
40 return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND; | 41 return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND; |
41 | 42 |
42 wchar_t *event_name = NULL; | 43 wchar_t *event_name = NULL; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"Event_Open s test2")); | 139 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"Event_Open s test2")); |
139 EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(L"Event_Open f test3")); | 140 EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(L"Event_Open f test3")); |
140 EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(L"Event_Open s test4")); | 141 EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(L"Event_Open s test4")); |
141 EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(L"Event_CreateOpen f f test5")); | 142 EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(L"Event_CreateOpen f f test5")); |
142 EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(L"Event_CreateOpen t f test6")); | 143 EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(L"Event_CreateOpen t f test6")); |
143 EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(L"Event_CreateOpen f t test5")); | 144 EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(L"Event_CreateOpen f t test5")); |
144 EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(L"Event_CreateOpen t t test6")); | 145 EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(L"Event_CreateOpen t t test6")); |
145 } | 146 } |
146 | 147 |
147 } // namespace sandbox | 148 } // namespace sandbox |
OLD | NEW |