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

Side by Side Diff: ipc/ipc_fuzzing_tests.cc

Issue 3759004: ipc_channel: warn if someone forgets to check the result of Connect() (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: fixes Created 10 years, 2 months 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
« no previous file with comments | « ipc/ipc_channel.h ('k') | ipc/ipc_send_fds_test.cc » ('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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <stdio.h> 5 #include <stdio.h>
6 #include <string> 6 #include <string>
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/platform_thread.h" 10 #include "base/platform_thread.h"
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 263
264 IPC::Message* last_msg_; 264 IPC::Message* last_msg_;
265 }; 265 };
266 266
267 // Runs the fuzzing server child mode. Returns when the preset number 267 // Runs the fuzzing server child mode. Returns when the preset number
268 // of messages have been received. 268 // of messages have been received.
269 MULTIPROCESS_TEST_MAIN(RunFuzzServer) { 269 MULTIPROCESS_TEST_MAIN(RunFuzzServer) {
270 MessageLoopForIO main_message_loop; 270 MessageLoopForIO main_message_loop;
271 FuzzerServerListener listener; 271 FuzzerServerListener listener;
272 IPC::Channel chan(kFuzzerChannel, IPC::Channel::MODE_CLIENT, &listener); 272 IPC::Channel chan(kFuzzerChannel, IPC::Channel::MODE_CLIENT, &listener);
273 chan.Connect(); 273 ASSERT_TRUE(chan.Connect());
274 listener.Init(&chan); 274 listener.Init(&chan);
275 MessageLoop::current()->Run(); 275 MessageLoop::current()->Run();
276 return 0; 276 return 0;
277 } 277 }
278 278
279 class IPCFuzzingTest : public IPCChannelTest { 279 class IPCFuzzingTest : public IPCChannelTest {
280 }; 280 };
281 281
282 // This test makes sure that the FuzzerClientListener and FuzzerServerListener 282 // This test makes sure that the FuzzerClientListener and FuzzerServerListener
283 // are working properly by generating two well formed IPC calls. 283 // are working properly by generating two well formed IPC calls.
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 msg = new IPC::Message(MSG_ROUTING_CONTROL, MsgClassIS::ID, 423 msg = new IPC::Message(MSG_ROUTING_CONTROL, MsgClassIS::ID,
424 IPC::Message::PRIORITY_NORMAL); 424 IPC::Message::PRIORITY_NORMAL);
425 msg->WriteInt(0x64); 425 msg->WriteInt(0x64);
426 msg->WriteInt(0x32); 426 msg->WriteInt(0x32);
427 EXPECT_FALSE(server.OnMessageReceived(*msg)); 427 EXPECT_FALSE(server.OnMessageReceived(*msg));
428 delete msg; 428 delete msg;
429 429
430 EXPECT_EQ(0, server.unhandled_msgs()); 430 EXPECT_EQ(0, server.unhandled_msgs());
431 #endif 431 #endif
432 } 432 }
OLDNEW
« no previous file with comments | « ipc/ipc_channel.h ('k') | ipc/ipc_send_fds_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698