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

Side by Side Diff: ipc/ipc_fuzzing_tests.cc

Issue 11819041: Make ipc_tests file structure a little saner and add an ipc_perftests target. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ugh Created 7 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « ipc/ipc_channel_unittest.cc ('k') | ipc/ipc_perftests.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/process_util.h" 10 #include "base/process_util.h"
11 #include "base/threading/platform_thread.h" 11 #include "base/threading/platform_thread.h"
12 #include "ipc/ipc_channel.h" 12 #include "ipc/ipc_channel.h"
13 #include "ipc/ipc_channel_proxy.h" 13 #include "ipc/ipc_channel_proxy.h"
14 #include "ipc/ipc_multiprocess_test.h" 14 #include "ipc/ipc_multiprocess_test.h"
15 #include "ipc/ipc_tests.h" 15 #include "ipc/ipc_test_base.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 #include "testing/multiprocess_func_list.h" 17 #include "testing/multiprocess_func_list.h"
18 18
19 // IPC messages for testing --------------------------------------------------- 19 // IPC messages for testing ---------------------------------------------------
20 20
21 #define IPC_MESSAGE_IMPL 21 #define IPC_MESSAGE_IMPL
22 #include "ipc/ipc_message_macros.h" 22 #include "ipc/ipc_message_macros.h"
23 23
24 #define IPC_MESSAGE_START TestMsgStart 24 #define IPC_MESSAGE_START TestMsgStart
25 25
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 MULTIPROCESS_IPC_TEST_MAIN(RunFuzzServer) { 250 MULTIPROCESS_IPC_TEST_MAIN(RunFuzzServer) {
251 MessageLoopForIO main_message_loop; 251 MessageLoopForIO main_message_loop;
252 FuzzerServerListener listener; 252 FuzzerServerListener listener;
253 IPC::Channel chan(kFuzzerChannel, IPC::Channel::MODE_CLIENT, &listener); 253 IPC::Channel chan(kFuzzerChannel, IPC::Channel::MODE_CLIENT, &listener);
254 CHECK(chan.Connect()); 254 CHECK(chan.Connect());
255 listener.Init(&chan); 255 listener.Init(&chan);
256 MessageLoop::current()->Run(); 256 MessageLoop::current()->Run();
257 return 0; 257 return 0;
258 } 258 }
259 259
260 class IPCFuzzingTest : public IPCChannelTest { 260 class IPCFuzzingTest : public IPCTestBase {
261 }; 261 };
262 262
263 // This test makes sure that the FuzzerClientListener and FuzzerServerListener 263 // This test makes sure that the FuzzerClientListener and FuzzerServerListener
264 // are working properly by generating two well formed IPC calls. 264 // are working properly by generating two well formed IPC calls.
265 TEST_F(IPCFuzzingTest, SanityTest) { 265 TEST_F(IPCFuzzingTest, SanityTest) {
266 FuzzerClientListener listener; 266 FuzzerClientListener listener;
267 IPC::Channel chan(kFuzzerChannel, IPC::Channel::MODE_SERVER, 267 IPC::Channel chan(kFuzzerChannel, IPC::Channel::MODE_SERVER,
268 &listener); 268 &listener);
269 base::ProcessHandle server_process = SpawnChild(FUZZER_SERVER, &chan); 269 base::ProcessHandle server_process = SpawnChild(FUZZER_SERVER, &chan);
270 ASSERT_TRUE(server_process); 270 ASSERT_TRUE(server_process);
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 msg = new IPC::Message(MSG_ROUTING_CONTROL, MsgClassIS::ID, 411 msg = new IPC::Message(MSG_ROUTING_CONTROL, MsgClassIS::ID,
412 IPC::Message::PRIORITY_NORMAL); 412 IPC::Message::PRIORITY_NORMAL);
413 msg->WriteInt(0x64); 413 msg->WriteInt(0x64);
414 msg->WriteInt(0x32); 414 msg->WriteInt(0x32);
415 EXPECT_FALSE(server.OnMessageReceived(*msg)); 415 EXPECT_FALSE(server.OnMessageReceived(*msg));
416 delete msg; 416 delete msg;
417 417
418 EXPECT_EQ(0, server.unhandled_msgs()); 418 EXPECT_EQ(0, server.unhandled_msgs());
419 #endif 419 #endif
420 } 420 }
OLDNEW
« no previous file with comments | « ipc/ipc_channel_unittest.cc ('k') | ipc/ipc_perftests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698