summaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-19 19:11:15 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-19 19:11:15 +0000
commit39703fb7cbda4ac831258c70e7fac6517125febc (patch)
tree8460f0622922154910721c7d2a698a0ea52106e5 /ipc
parent63dc378eac88be2da11255b61d7af140bb89ba55 (diff)
downloadchromium_src-39703fb7cbda4ac831258c70e7fac6517125febc.zip
chromium_src-39703fb7cbda4ac831258c70e7fac6517125febc.tar.gz
chromium_src-39703fb7cbda4ac831258c70e7fac6517125febc.tar.bz2
ipc_channel: warn if someone forgets to check the result of Connect()
I found a test that was doing this. Review URL: http://codereview.chromium.org/3759004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63083 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc')
-rw-r--r--ipc/ipc_channel.h3
-rw-r--r--ipc/ipc_fuzzing_tests.cc2
-rw-r--r--ipc/ipc_send_fds_test.cc6
-rw-r--r--ipc/ipc_tests.cc10
4 files changed, 11 insertions, 10 deletions
diff --git a/ipc/ipc_channel.h b/ipc/ipc_channel.h
index dc5031e..65ed9f0 100644
--- a/ipc/ipc_channel.h
+++ b/ipc/ipc_channel.h
@@ -6,6 +6,7 @@
#define IPC_IPC_CHANNEL_H_
#pragma once
+#include "base/compiler_specific.h"
#include "ipc/ipc_message.h"
namespace IPC {
@@ -68,7 +69,7 @@ class Channel : public Message::Sender {
// connect to a pre-existing pipe. Note, calling Connect()
// will not block the calling thread and may complete
// asynchronously.
- bool Connect();
+ bool Connect() WARN_UNUSED_RESULT;
// Close this Channel explicitly. May be called multiple times.
void Close();
diff --git a/ipc/ipc_fuzzing_tests.cc b/ipc/ipc_fuzzing_tests.cc
index 9817ade..8c4dbe3 100644
--- a/ipc/ipc_fuzzing_tests.cc
+++ b/ipc/ipc_fuzzing_tests.cc
@@ -270,7 +270,7 @@ MULTIPROCESS_TEST_MAIN(RunFuzzServer) {
MessageLoopForIO main_message_loop;
FuzzerServerListener listener;
IPC::Channel chan(kFuzzerChannel, IPC::Channel::MODE_CLIENT, &listener);
- chan.Connect();
+ CHECK(chan.Connect());
listener.Init(&chan);
MessageLoop::current()->Run();
return 0;
diff --git a/ipc/ipc_send_fds_test.cc b/ipc/ipc_send_fds_test.cc
index e1f19dc..183a06c 100644
--- a/ipc/ipc_send_fds_test.cc
+++ b/ipc/ipc_send_fds_test.cc
@@ -110,7 +110,7 @@ int TestDescriptorClient(ino_t expected_inode_num) {
// Setup IPC channel.
IPC::Channel chan(kTestClientChannel, IPC::Channel::MODE_CLIENT,
&listener);
- chan.Connect();
+ CHECK(chan.Connect());
MessageLoop::current()->Run();
return 0;
@@ -157,7 +157,7 @@ TEST_F(IPCChannelTest, DescriptorTestSandboxed) {
IPC::Channel chan(kTestClientChannel, IPC::Channel::MODE_SERVER,
&listener);
- chan.Connect();
+ ASSERT_TRUE(chan.Connect());
base::ProcessHandle process_handle = SpawnChild(
TEST_DESCRIPTOR_CLIENT_SANDBOXED,
@@ -181,7 +181,7 @@ TEST_F(IPCChannelTest, DescriptorTest) {
IPC::Channel chan(kTestClientChannel, IPC::Channel::MODE_SERVER,
&listener);
- chan.Connect();
+ ASSERT_TRUE(chan.Connect());
base::ProcessHandle process_handle = SpawnChild(TEST_DESCRIPTOR_CLIENT,
&chan);
diff --git a/ipc/ipc_tests.cc b/ipc/ipc_tests.cc
index a407c70..aa30182 100644
--- a/ipc/ipc_tests.cc
+++ b/ipc/ipc_tests.cc
@@ -219,7 +219,7 @@ TEST_F(IPCChannelTest, ChannelTest) {
// Setup IPC channel.
IPC::Channel chan(kTestClientChannel, IPC::Channel::MODE_SERVER,
&channel_listener);
- chan.Connect();
+ ASSERT_TRUE(chan.Connect());
channel_listener.Init(&chan);
@@ -334,7 +334,7 @@ TEST_F(IPCChannelTest, SendMessageInChannelConnected) {
IPC::Channel channel(kTestClientChannel, IPC::Channel::MODE_SERVER,
&channel_listener);
channel_listener.Init(&channel);
- channel.Connect();
+ ASSERT_TRUE(channel.Connect());
base::ProcessHandle process_handle = SpawnChild(TEST_CLIENT, &channel);
ASSERT_TRUE(process_handle);
@@ -359,7 +359,7 @@ MULTIPROCESS_TEST_MAIN(RunTestClient) {
// setup IPC channel
IPC::Channel chan(kTestClientChannel, IPC::Channel::MODE_CLIENT,
&channel_listener);
- chan.Connect();
+ CHECK(chan.Connect());
channel_listener.Init(&chan);
Send(&chan, "hello from child");
// run message loop
@@ -492,7 +492,7 @@ TEST_F(IPCChannelTest, Performance) {
IPC::Channel chan(kReflectorChannel, IPC::Channel::MODE_SERVER, NULL);
ChannelPerfListener perf_listener(&chan, 10000, 100000);
chan.set_listener(&perf_listener);
- chan.Connect();
+ ASSERT_TRUE(chan.Connect());
HANDLE process = SpawnChild(TEST_REFLECTOR, &chan);
ASSERT_TRUE(process);
@@ -524,7 +524,7 @@ MULTIPROCESS_TEST_MAIN(RunReflector) {
IPC::Channel chan(kReflectorChannel, IPC::Channel::MODE_CLIENT, NULL);
ChannelReflectorListener channel_reflector_listener(&chan);
chan.set_listener(&channel_reflector_listener);
- chan.Connect();
+ ASSERT_TRUE(chan.Connect());
MessageLoop::current()->Run();
return true;