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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 ASSERT_EQ(close(fd), 0); | 43 ASSERT_EQ(close(fd), 0); |
44 | 44 |
45 // We compare iNode numbers to check that the file sent over the wire | 45 // We compare iNode numbers to check that the file sent over the wire |
46 // was actually the same physical file as the one we were expecting. | 46 // was actually the same physical file as the one we were expecting. |
47 ASSERT_EQ(inode_num, st.st_ino); | 47 ASSERT_EQ(inode_num, st.st_ino); |
48 } | 48 } |
49 | 49 |
50 class MyChannelDescriptorListener : public IPC::Listener { | 50 class MyChannelDescriptorListener : public IPC::Listener { |
51 public: | 51 public: |
52 MyChannelDescriptorListener(ino_t expected_inode_num) | 52 explicit MyChannelDescriptorListener(ino_t expected_inode_num) |
53 : expected_inode_num_(expected_inode_num), | 53 : expected_inode_num_(expected_inode_num), |
54 num_fds_received_(0) {} | 54 num_fds_received_(0) {} |
55 | 55 |
56 virtual bool OnMessageReceived(const IPC::Message& message) { | 56 virtual bool OnMessageReceived(const IPC::Message& message) { |
57 PickleIterator iter(message); | 57 PickleIterator iter(message); |
58 | 58 |
59 ++num_fds_received_; | 59 ++num_fds_received_; |
60 base::FileDescriptor descriptor; | 60 base::FileDescriptor descriptor; |
61 | 61 |
62 IPC::ParamTraits<base::FileDescriptor>::Read( | 62 IPC::ParamTraits<base::FileDescriptor>::Read( |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 IPC::Channel chan(kTestClientChannel, IPC::Channel::MODE_SERVER, | 196 IPC::Channel chan(kTestClientChannel, IPC::Channel::MODE_SERVER, |
197 &listener); | 197 &listener); |
198 ASSERT_TRUE(chan.Connect()); | 198 ASSERT_TRUE(chan.Connect()); |
199 | 199 |
200 base::ProcessHandle process_handle = SpawnChild(TEST_DESCRIPTOR_CLIENT, | 200 base::ProcessHandle process_handle = SpawnChild(TEST_DESCRIPTOR_CLIENT, |
201 &chan); | 201 &chan); |
202 TestDescriptorServer(chan, process_handle); | 202 TestDescriptorServer(chan, process_handle); |
203 } | 203 } |
204 | 204 |
205 #endif // defined(OS_POSIX) | 205 #endif // defined(OS_POSIX) |
OLD | NEW |