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

Side by Side Diff: ipc/ipc_fuzzing_tests.cc

Issue 11865015: Move IPC tests into anonymous namespaces. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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_message_unittest.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_test_base.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
26 // Generic message class that is an int followed by a wstring. 26 // Generic message class that is an int followed by a wstring.
27 IPC_MESSAGE_CONTROL2(MsgClassIS, int, std::wstring) 27 IPC_MESSAGE_CONTROL2(MsgClassIS, int, std::wstring)
28 28
29 // Generic message class that is a wstring followed by an int. 29 // Generic message class that is a wstring followed by an int.
30 IPC_MESSAGE_CONTROL2(MsgClassSI, std::wstring, int) 30 IPC_MESSAGE_CONTROL2(MsgClassSI, std::wstring, int)
31 31
32 // Message to create a mutex in the IPC server, using the received name. 32 // Message to create a mutex in the IPC server, using the received name.
33 IPC_MESSAGE_CONTROL2(MsgDoMutex, std::wstring, int) 33 IPC_MESSAGE_CONTROL2(MsgDoMutex, std::wstring, int)
34 34
35 // Used to generate an ID for a message that should not exist. 35 // Used to generate an ID for a message that should not exist.
36 IPC_MESSAGE_CONTROL0(MsgUnhandled) 36 IPC_MESSAGE_CONTROL0(MsgUnhandled)
37 37
38 // ---------------------------------------------------------------------------- 38 // -----------------------------------------------------------------------------
39
40 namespace {
39 41
40 TEST(IPCMessageIntegrity, ReadBeyondBufferStr) { 42 TEST(IPCMessageIntegrity, ReadBeyondBufferStr) {
41 //This was BUG 984408. 43 //This was BUG 984408.
42 uint32 v1 = kuint32max - 1; 44 uint32 v1 = kuint32max - 1;
43 int v2 = 666; 45 int v2 = 666;
44 IPC::Message m(0, 1, IPC::Message::PRIORITY_NORMAL); 46 IPC::Message m(0, 1, IPC::Message::PRIORITY_NORMAL);
45 EXPECT_TRUE(m.WriteInt(v1)); 47 EXPECT_TRUE(m.WriteInt(v1));
46 EXPECT_TRUE(m.WriteInt(v2)); 48 EXPECT_TRUE(m.WriteInt(v2));
47 49
48 PickleIterator iter(m); 50 PickleIterator iter(m);
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 msg = new IPC::Message(MSG_ROUTING_CONTROL, MsgClassIS::ID, 413 msg = new IPC::Message(MSG_ROUTING_CONTROL, MsgClassIS::ID,
412 IPC::Message::PRIORITY_NORMAL); 414 IPC::Message::PRIORITY_NORMAL);
413 msg->WriteInt(0x64); 415 msg->WriteInt(0x64);
414 msg->WriteInt(0x32); 416 msg->WriteInt(0x32);
415 EXPECT_FALSE(server.OnMessageReceived(*msg)); 417 EXPECT_FALSE(server.OnMessageReceived(*msg));
416 delete msg; 418 delete msg;
417 419
418 EXPECT_EQ(0, server.unhandled_msgs()); 420 EXPECT_EQ(0, server.unhandled_msgs());
419 #endif 421 #endif
420 } 422 }
423
424 } // namespace
OLDNEW
« no previous file with comments | « ipc/ipc_channel_unittest.cc ('k') | ipc/ipc_message_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698