| OLD | NEW |
| 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 if (FUZZER_ROUTING_ID != last_msg_->routing_id()) | 239 if (FUZZER_ROUTING_ID != last_msg_->routing_id()) |
| 240 return false; | 240 return false; |
| 241 return (type_id == last_msg_->type()); | 241 return (type_id == last_msg_->type()); |
| 242 }; | 242 }; |
| 243 | 243 |
| 244 IPC::Message* last_msg_; | 244 IPC::Message* last_msg_; |
| 245 }; | 245 }; |
| 246 | 246 |
| 247 // Runs the fuzzing server child mode. Returns when the preset number | 247 // Runs the fuzzing server child mode. Returns when the preset number |
| 248 // of messages have been received. | 248 // of messages have been received. |
| 249 MULTIPROCESS_TEST_MAIN(RunFuzzServer) { | 249 MULTIPROCESS_IPC_TEST_MAIN(RunFuzzServer) { |
| 250 MessageLoopForIO main_message_loop; | 250 MessageLoopForIO main_message_loop; |
| 251 FuzzerServerListener listener; | 251 FuzzerServerListener listener; |
| 252 IPC::Channel chan(kFuzzerChannel, IPC::Channel::MODE_CLIENT, &listener); | 252 IPC::Channel chan(kFuzzerChannel, IPC::Channel::MODE_CLIENT, &listener); |
| 253 CHECK(chan.Connect()); | 253 CHECK(chan.Connect()); |
| 254 listener.Init(&chan); | 254 listener.Init(&chan); |
| 255 MessageLoop::current()->Run(); | 255 MessageLoop::current()->Run(); |
| 256 return 0; | 256 return 0; |
| 257 } | 257 } |
| 258 | 258 |
| 259 class IPCFuzzingTest : public IPCChannelTest { | 259 class IPCFuzzingTest : public IPCChannelTest { |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |