Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: ipc/ipc_send_fds_test.cc

Issue 5978003: Make IPC::Channel::Listener:OnMessageReceived have a return value indicating ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ipc/ipc_message_macros.h ('k') | ipc/ipc_sync_channel.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // was actually the same physical file as the one we were expecting. 44 // was actually the same physical file as the one we were expecting.
45 ASSERT_EQ(inode_num, st.st_ino); 45 ASSERT_EQ(inode_num, st.st_ino);
46 } 46 }
47 47
48 class MyChannelDescriptorListener : public IPC::Channel::Listener { 48 class MyChannelDescriptorListener : public IPC::Channel::Listener {
49 public: 49 public:
50 MyChannelDescriptorListener(ino_t expected_inode_num) 50 MyChannelDescriptorListener(ino_t expected_inode_num)
51 : expected_inode_num_(expected_inode_num), 51 : expected_inode_num_(expected_inode_num),
52 num_fds_received_(0) {} 52 num_fds_received_(0) {}
53 53
54 virtual void OnMessageReceived(const IPC::Message& message) { 54 virtual bool OnMessageReceived(const IPC::Message& message) {
55 void* iter = NULL; 55 void* iter = NULL;
56 56
57 ++num_fds_received_; 57 ++num_fds_received_;
58 base::FileDescriptor descriptor; 58 base::FileDescriptor descriptor;
59 59
60 ASSERT_TRUE( 60 IPC::ParamTraits<base::FileDescriptor>::Read(
61 IPC::ParamTraits<base::FileDescriptor>::Read( 61 &message, &iter, &descriptor);
62 &message, &iter, &descriptor));
63 62
64 VerifyAndCloseDescriptor(descriptor.fd, expected_inode_num_); 63 VerifyAndCloseDescriptor(descriptor.fd, expected_inode_num_);
65 if (num_fds_received_ == kNumFDsToSend) { 64 if (num_fds_received_ == kNumFDsToSend) {
66 MessageLoop::current()->Quit(); 65 MessageLoop::current()->Quit();
67 } 66 }
67 return true;
68 } 68 }
69 69
70 virtual void OnChannelError() { 70 virtual void OnChannelError() {
71 MessageLoop::current()->Quit(); 71 MessageLoop::current()->Quit();
72 } 72 }
73 73
74 bool GotExpectedNumberOfDescriptors() { 74 bool GotExpectedNumberOfDescriptors() {
75 return kNumFDsToSend == num_fds_received_; 75 return kNumFDsToSend == num_fds_received_;
76 } 76 }
77 77
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 IPC::Channel chan(kTestClientChannel, IPC::Channel::MODE_SERVER, 193 IPC::Channel chan(kTestClientChannel, IPC::Channel::MODE_SERVER,
194 &listener); 194 &listener);
195 ASSERT_TRUE(chan.Connect()); 195 ASSERT_TRUE(chan.Connect());
196 196
197 base::ProcessHandle process_handle = SpawnChild(TEST_DESCRIPTOR_CLIENT, 197 base::ProcessHandle process_handle = SpawnChild(TEST_DESCRIPTOR_CLIENT,
198 &chan); 198 &chan);
199 TestDescriptorServer(chan, process_handle); 199 TestDescriptorServer(chan, process_handle);
200 } 200 }
201 201
202 #endif // defined(OS_POSIX) 202 #endif // defined(OS_POSIX)
OLDNEW
« no previous file with comments | « ipc/ipc_message_macros.h ('k') | ipc/ipc_sync_channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698