diff options
author | dmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-09 01:12:20 +0000 |
---|---|---|
committer | dmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-09 01:12:20 +0000 |
commit | d484ab55e6e6186c2cf2d37dc2a81bdcf06a89d9 (patch) | |
tree | 2a00a8117842a75778cb2a039488d0db9ea2dc3e /ipc | |
parent | 81af494a18d1c509b52b368943859cc4c5704b82 (diff) | |
download | chromium_src-d484ab55e6e6186c2cf2d37dc2a81bdcf06a89d9.zip chromium_src-d484ab55e6e6186c2cf2d37dc2a81bdcf06a89d9.tar.gz chromium_src-d484ab55e6e6186c2cf2d37dc2a81bdcf06a89d9.tar.bz2 |
Verify file descriptor count.
Tighten up test by verifying that the number of descriptors received was what we expected and that we didn't exit the message loop due to channel closing unexpectedly.
BUG=none
TEST=build
Review URL: http://codereview.chromium.org/5518007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68683 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/ipc_send_fds_test.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/ipc/ipc_send_fds_test.cc b/ipc/ipc_send_fds_test.cc index 183a06c..809f4f5 100644 --- a/ipc/ipc_send_fds_test.cc +++ b/ipc/ipc_send_fds_test.cc @@ -70,6 +70,11 @@ class MyChannelDescriptorListener : public IPC::Channel::Listener { virtual void OnChannelError() { MessageLoop::current()->Quit(); } + + bool GotExpectedNumberOfDescriptors() { + return kNumFDsToSend == num_fds_received_; + } + private: ino_t expected_inode_num_; unsigned num_fds_received_; @@ -90,7 +95,7 @@ void TestDescriptorServer(IPC::Channel &chan, 3, // message type IPC::Message::PRIORITY_NORMAL); IPC::ParamTraits<base::FileDescriptor>::Write(message, descriptor); - chan.Send(message); + ASSERT_TRUE(chan.Send(message)); } // Run message loop. @@ -111,8 +116,14 @@ int TestDescriptorClient(ino_t expected_inode_num) { IPC::Channel chan(kTestClientChannel, IPC::Channel::MODE_CLIENT, &listener); CHECK(chan.Connect()); + + // Run message loop so IPC Channel can handle message IO. MessageLoop::current()->Run(); + // Verify that the message loop was exited due to getting the correct + // number of descriptors, and not because the channel closing unexpectedly. + CHECK(listener.GotExpectedNumberOfDescriptors()); + return 0; } |