| 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 #include "ipc/ipc_tests.h" | 7 #include "ipc/ipc_tests.h" |
| 8 | 8 |
| 9 #if defined(OS_MACOSX) | 9 #if defined(OS_MACOSX) |
| 10 extern "C" { | 10 extern "C" { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 struct stat st; | 39 struct stat st; |
| 40 ASSERT_EQ(fstat(fd, &st), 0); | 40 ASSERT_EQ(fstat(fd, &st), 0); |
| 41 | 41 |
| 42 ASSERT_EQ(close(fd), 0); | 42 ASSERT_EQ(close(fd), 0); |
| 43 | 43 |
| 44 // We compare iNode numbers to check that the file sent over the wire | 44 // We compare iNode numbers to check that the file sent over the wire |
| 45 // was actually the same physical file as the one we were expecting. | 45 // was actually the same physical file as the one we were expecting. |
| 46 ASSERT_EQ(inode_num, st.st_ino); | 46 ASSERT_EQ(inode_num, st.st_ino); |
| 47 } | 47 } |
| 48 | 48 |
| 49 class MyChannelDescriptorListener : public IPC::Channel::Listener { | 49 class MyChannelDescriptorListener : public IPC::Listener { |
| 50 public: | 50 public: |
| 51 MyChannelDescriptorListener(ino_t expected_inode_num) | 51 MyChannelDescriptorListener(ino_t expected_inode_num) |
| 52 : expected_inode_num_(expected_inode_num), | 52 : expected_inode_num_(expected_inode_num), |
| 53 num_fds_received_(0) {} | 53 num_fds_received_(0) {} |
| 54 | 54 |
| 55 virtual bool OnMessageReceived(const IPC::Message& message) { | 55 virtual bool OnMessageReceived(const IPC::Message& message) { |
| 56 PickleIterator iter(message); | 56 PickleIterator iter(message); |
| 57 | 57 |
| 58 ++num_fds_received_; | 58 ++num_fds_received_; |
| 59 base::FileDescriptor descriptor; | 59 base::FileDescriptor descriptor; |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 IPC::Channel chan(kTestClientChannel, IPC::Channel::MODE_SERVER, | 194 IPC::Channel chan(kTestClientChannel, IPC::Channel::MODE_SERVER, |
| 195 &listener); | 195 &listener); |
| 196 ASSERT_TRUE(chan.Connect()); | 196 ASSERT_TRUE(chan.Connect()); |
| 197 | 197 |
| 198 base::ProcessHandle process_handle = SpawnChild(TEST_DESCRIPTOR_CLIENT, | 198 base::ProcessHandle process_handle = SpawnChild(TEST_DESCRIPTOR_CLIENT, |
| 199 &chan); | 199 &chan); |
| 200 TestDescriptorServer(chan, process_handle); | 200 TestDescriptorServer(chan, process_handle); |
| 201 } | 201 } |
| 202 | 202 |
| 203 #endif // defined(OS_POSIX) | 203 #endif // defined(OS_POSIX) |
| OLD | NEW |