| 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #if defined(OS_MACOSX) | 7 #if defined(OS_MACOSX) |
| 8 extern "C" { | 8 extern "C" { |
| 9 #include <sandbox.h> | 9 #include <sandbox.h> |
| 10 } | 10 } |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 // Run message loop so IPC Channel can handle message IO. | 122 // Run message loop so IPC Channel can handle message IO. |
| 123 MessageLoop::current()->Run(); | 123 MessageLoop::current()->Run(); |
| 124 | 124 |
| 125 // Verify that the message loop was exited due to getting the correct | 125 // Verify that the message loop was exited due to getting the correct |
| 126 // number of descriptors, and not because the channel closing unexpectedly. | 126 // number of descriptors, and not because the channel closing unexpectedly. |
| 127 CHECK(listener.GotExpectedNumberOfDescriptors()); | 127 CHECK(listener.GotExpectedNumberOfDescriptors()); |
| 128 | 128 |
| 129 return 0; | 129 return 0; |
| 130 } | 130 } |
| 131 | 131 |
| 132 } // namespace | |
| 133 | |
| 134 class IPCSendFdsTest : public IPCTestBase { | 132 class IPCSendFdsTest : public IPCTestBase { |
| 135 }; | 133 }; |
| 136 | 134 |
| 137 #if defined(OS_MACOSX) | 135 #if defined(OS_MACOSX) |
| 138 // TODO(port): Make this test cross-platform. | 136 // TODO(port): Make this test cross-platform. |
| 139 MULTIPROCESS_IPC_TEST_MAIN(RunTestDescriptorClientSandboxed) { | 137 MULTIPROCESS_IPC_TEST_MAIN(RunTestDescriptorClientSandboxed) { |
| 140 struct stat st; | 138 struct stat st; |
| 141 const int fd = open(kDevZeroPath, O_RDONLY); | 139 const int fd = open(kDevZeroPath, O_RDONLY); |
| 142 fstat(fd, &st); | 140 fstat(fd, &st); |
| 143 if (HANDLE_EINTR(close(fd)) < 0) { | 141 if (HANDLE_EINTR(close(fd)) < 0) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 | 194 |
| 197 IPC::Channel chan(kTestClientChannel, IPC::Channel::MODE_SERVER, | 195 IPC::Channel chan(kTestClientChannel, IPC::Channel::MODE_SERVER, |
| 198 &listener); | 196 &listener); |
| 199 ASSERT_TRUE(chan.Connect()); | 197 ASSERT_TRUE(chan.Connect()); |
| 200 | 198 |
| 201 base::ProcessHandle process_handle = SpawnChild(TEST_DESCRIPTOR_CLIENT, | 199 base::ProcessHandle process_handle = SpawnChild(TEST_DESCRIPTOR_CLIENT, |
| 202 &chan); | 200 &chan); |
| 203 TestDescriptorServer(chan, process_handle); | 201 TestDescriptorServer(chan, process_handle); |
| 204 } | 202 } |
| 205 | 203 |
| 204 } // namespace |
| 205 |
| 206 #endif // defined(OS_POSIX) | 206 #endif // defined(OS_POSIX) |
| OLD | NEW |