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-08-25 14:14:05 +0000
committerdmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-25 14:14:05 +0000
commit3c52425b21e996264a0302e45fc75e623a029e12 (patch)
tree64158d2d9c2c8a90fac36c2088ba0de76a14a735 /ipc/ipc_channel_posix_unittest.cc
parent130ee907aaf46c2161d956725cbd23c26bad4895 (diff)
downloadchromium_src-3c52425b21e996264a0302e45fc75e623a029e12.zip
chromium_src-3c52425b21e996264a0302e45fc75e623a029e12.tar.gz
chromium_src-3c52425b21e996264a0302e45fc75e623a029e12.tar.bz2
There are times on the Mac when pipe names of 0 length may occur. Let the caller handle
the error instead of aborting here. BUG=75518 TEST=BUILD Review URL: http://codereview.chromium.org/7743001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98225 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/ipc_channel_posix_unittest.cc')
-rw-r--r--ipc/ipc_channel_posix_unittest.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/ipc/ipc_channel_posix_unittest.cc b/ipc/ipc_channel_posix_unittest.cc
index 14ecc608..9d9c70a 100644
--- a/ipc/ipc_channel_posix_unittest.cc
+++ b/ipc/ipc_channel_posix_unittest.cc
@@ -281,6 +281,26 @@ TEST_F(IPCChannelPosixTest, ResetState) {
ASSERT_FALSE(channel.HasAcceptedConnection());
}
+TEST_F(IPCChannelPosixTest, BadChannelName) {
+ // Test empty name
+ IPC::ChannelHandle handle("");
+ IPC::Channel channel(handle, IPC::Channel::MODE_NAMED_SERVER, NULL);
+ ASSERT_FALSE(channel.Connect());
+
+ // Test name that is too long.
+ const char *kTooLongName = "This_is_a_very_long_name_to_proactively_implement"
+ "client-centered_synergy_through_top-line"
+ "platforms_Phosfluorescently_disintermediate_"
+ "clicks-and-mortar_best_practices_without_"
+ "future-proof_growth_strategies_Continually"
+ "pontificate_proactive_potentialities_before"
+ "leading-edge_processes";
+ EXPECT_GE(strlen(kTooLongName), IPC::kMaxPipeNameLength);
+ IPC::ChannelHandle handle2(kTooLongName);
+ IPC::Channel channel2(handle2, IPC::Channel::MODE_NAMED_SERVER, NULL);
+ EXPECT_FALSE(channel2.Connect());
+}
+
TEST_F(IPCChannelPosixTest, MultiConnection) {
// Test setting up a connection to an external process, and then have
// another external process attempt to connect to us.