| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |