summaryrefslogtreecommitdiffstats
path: root/ipc/ipc_channel_posix_unittest.cc
diff options
context:
space:
mode:
authordmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-02 22:27:14 +0000
committerdmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-02 22:27:14 +0000
commit6aad23f982580fadbe6f180aa46191102139b01e (patch)
tree9647de3e2db3c439afd1b11a6a9287fb9b5f3806 /ipc/ipc_channel_posix_unittest.cc
parentb71e5e242c16a13bbaca565616354375f825b3e9 (diff)
downloadchromium_src-6aad23f982580fadbe6f180aa46191102139b01e.zip
chromium_src-6aad23f982580fadbe6f180aa46191102139b01e.tar.gz
chromium_src-6aad23f982580fadbe6f180aa46191102139b01e.tar.bz2
Add some bullet proofing to ipc_channel_posix.
Specifically make sure you can't connect after creating a bad channel. BUG=NONE TEST=Build and run tests Review URL: http://codereview.chromium.org/6596093 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76633 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/ipc_channel_posix_unittest.cc')
-rw-r--r--ipc/ipc_channel_posix_unittest.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/ipc/ipc_channel_posix_unittest.cc b/ipc/ipc_channel_posix_unittest.cc
index 459aafb..dcd924e 100644
--- a/ipc/ipc_channel_posix_unittest.cc
+++ b/ipc/ipc_channel_posix_unittest.cc
@@ -318,6 +318,25 @@ TEST_F(IPCChannelPosixTest, MultiConnection) {
ASSERT_FALSE(channel.HasAcceptedConnection());
}
+TEST_F(IPCChannelPosixTest, DoubleServer) {
+ // Test setting up two servers with the same name.
+ IPCChannelPosixTestListener listener(false);
+ IPCChannelPosixTestListener listener2(false);
+ IPC::ChannelHandle chan_handle(kConnectionSocketTestName);
+ IPC::Channel channel(chan_handle, IPC::Channel::MODE_SERVER, &listener);
+ IPC::Channel channel2(chan_handle, IPC::Channel::MODE_SERVER, &listener2);
+ ASSERT_TRUE(channel.Connect());
+ ASSERT_FALSE(channel2.Connect());
+}
+
+TEST_F(IPCChannelPosixTest, BadMode) {
+ // Test setting up two servers with a bad mode.
+ IPCChannelPosixTestListener listener(false);
+ IPC::ChannelHandle chan_handle(kConnectionSocketTestName);
+ IPC::Channel channel(chan_handle, IPC::Channel::MODE_NONE, &listener);
+ ASSERT_FALSE(channel.Connect());
+}
+
// A long running process that connects to us
MULTIPROCESS_TEST_MAIN(IPCChannelPosixTestConnectionProc) {
MessageLoopForIO message_loop;