| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
| 6 #include "sandbox/src/sandbox.h" | 6 #include "sandbox/src/sandbox.h" |
| 7 #include "sandbox/src/sandbox_policy.h" | 7 #include "sandbox/src/sandbox_policy.h" |
| 8 #include "sandbox/src/sandbox_factory.h" | 8 #include "sandbox/src/sandbox_factory.h" |
| 9 #include "sandbox/tests/common/controller.h" | 9 #include "sandbox/tests/common/controller.h" |
| 10 | 10 |
| 11 namespace sandbox { | 11 namespace sandbox { |
| 12 | 12 |
| 13 | 13 |
| 14 SBOX_TESTS_COMMAND int NamedPipe_Create(int argc, wchar_t **argv) { | 14 SBOX_TESTS_COMMAND int NamedPipe_Create(int argc, wchar_t **argv) { |
| 15 if (argc != 1) { | 15 if (argc != 1) { |
| 16 return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND; | 16 return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND; |
| 17 } | 17 } |
| 18 if ((NULL != argv) && (NULL == argv[0])) { | 18 if ((NULL == argv) || (NULL == argv[0])) { |
| 19 return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND; | 19 return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND; |
| 20 } | 20 } |
| 21 | 21 |
| 22 HANDLE pipe = ::CreateNamedPipeW(argv[0], | 22 HANDLE pipe = ::CreateNamedPipeW(argv[0], |
| 23 PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, | 23 PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, |
| 24 PIPE_TYPE_BYTE | PIPE_READMODE_BYTE, 1, 4096, | 24 PIPE_TYPE_BYTE | PIPE_READMODE_BYTE, 1, 4096, |
| 25 4096, 2000, NULL); | 25 4096, 2000, NULL); |
| 26 if (INVALID_HANDLE_VALUE == pipe) | 26 if (INVALID_HANDLE_VALUE == pipe) |
| 27 return SBOX_TEST_DENIED; | 27 return SBOX_TEST_DENIED; |
| 28 | 28 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // namedpipe name. Here we apply it like a wildcard. http://b/893603 | 67 // namedpipe name. Here we apply it like a wildcard. http://b/893603 |
| 68 EXPECT_TRUE(runner.AddRule(TargetPolicy::SUBSYS_NAMED_PIPES, | 68 EXPECT_TRUE(runner.AddRule(TargetPolicy::SUBSYS_NAMED_PIPES, |
| 69 TargetPolicy::NAMEDPIPES_ALLOW_ANY, | 69 TargetPolicy::NAMEDPIPES_ALLOW_ANY, |
| 70 L"\\\\.\\pipe\\test*")); | 70 L"\\\\.\\pipe\\test*")); |
| 71 | 71 |
| 72 EXPECT_EQ(SBOX_TEST_SUCCEEDED, | 72 EXPECT_EQ(SBOX_TEST_SUCCEEDED, |
| 73 runner.RunTest(L"NamedPipe_Create \\\\.\\pipe\\testbleh")); | 73 runner.RunTest(L"NamedPipe_Create \\\\.\\pipe\\testbleh")); |
| 74 } | 74 } |
| 75 | 75 |
| 76 } // namespace sandbox | 76 } // namespace sandbox |
| OLD | NEW |