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

Side by Side Diff: ipc/ipc_fuzzing_tests.cc

Issue 10541065: Separate out IPC::Message::Sender and channel::Listener into a separate class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: de-inline Created 8 years, 6 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_reader.cc ('k') | ipc/ipc_listener.h » ('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"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 IPC::Message m(0, 1, IPC::Message::PRIORITY_NORMAL); 108 IPC::Message m(0, 1, IPC::Message::PRIORITY_NORMAL);
109 EXPECT_TRUE(m.WriteInt(0x71000000)); // This is the count of elements. 109 EXPECT_TRUE(m.WriteInt(0x71000000)); // This is the count of elements.
110 EXPECT_TRUE(m.WriteInt64(1)); 110 EXPECT_TRUE(m.WriteInt64(1));
111 EXPECT_TRUE(m.WriteInt64(2)); 111 EXPECT_TRUE(m.WriteInt64(2));
112 112
113 std::vector<int64> vec; 113 std::vector<int64> vec;
114 PickleIterator iter(m); 114 PickleIterator iter(m);
115 EXPECT_FALSE(ReadParam(&m, &iter, &vec)); 115 EXPECT_FALSE(ReadParam(&m, &iter, &vec));
116 } 116 }
117 117
118 class SimpleListener : public IPC::Channel::Listener { 118 class SimpleListener : public IPC::Listener {
119 public: 119 public:
120 SimpleListener() : other_(NULL) { 120 SimpleListener() : other_(NULL) {
121 } 121 }
122 void Init(IPC::Message::Sender* s) { 122 void Init(IPC::Sender* s) {
123 other_ = s; 123 other_ = s;
124 } 124 }
125 protected: 125 protected:
126 IPC::Message::Sender* other_; 126 IPC::Sender* other_;
127 }; 127 };
128 128
129 enum { 129 enum {
130 FUZZER_ROUTING_ID = 5 130 FUZZER_ROUTING_ID = 5
131 }; 131 };
132 132
133 // The fuzzer server class. It runs in a child process and expects 133 // The fuzzer server class. It runs in a child process and expects
134 // only two IPC calls; after that it exits the message loop which 134 // only two IPC calls; after that it exits the message loop which
135 // terminates the child process. 135 // terminates the child process.
136 class FuzzerServerListener : public SimpleListener { 136 class FuzzerServerListener : public SimpleListener {
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 msg = new IPC::Message(MSG_ROUTING_CONTROL, MsgClassIS::ID, 407 msg = new IPC::Message(MSG_ROUTING_CONTROL, MsgClassIS::ID,
408 IPC::Message::PRIORITY_NORMAL); 408 IPC::Message::PRIORITY_NORMAL);
409 msg->WriteInt(0x64); 409 msg->WriteInt(0x64);
410 msg->WriteInt(0x32); 410 msg->WriteInt(0x32);
411 EXPECT_FALSE(server.OnMessageReceived(*msg)); 411 EXPECT_FALSE(server.OnMessageReceived(*msg));
412 delete msg; 412 delete msg;
413 413
414 EXPECT_EQ(0, server.unhandled_msgs()); 414 EXPECT_EQ(0, server.unhandled_msgs());
415 #endif 415 #endif
416 } 416 }
OLDNEW
« no previous file with comments | « ipc/ipc_channel_reader.cc ('k') | ipc/ipc_listener.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698