| 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/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 244 |
| 245 IPC::Message* last_msg_; | 245 IPC::Message* last_msg_; |
| 246 }; | 246 }; |
| 247 | 247 |
| 248 // Runs the fuzzing server child mode. Returns when the preset number of | 248 // Runs the fuzzing server child mode. Returns when the preset number of |
| 249 // messages have been received. | 249 // messages have been received. |
| 250 MULTIPROCESS_IPC_TEST_CLIENT_MAIN(FuzzServerClient) { | 250 MULTIPROCESS_IPC_TEST_CLIENT_MAIN(FuzzServerClient) { |
| 251 base::MessageLoopForIO main_message_loop; | 251 base::MessageLoopForIO main_message_loop; |
| 252 FuzzerServerListener listener; | 252 FuzzerServerListener listener; |
| 253 scoped_ptr<IPC::Channel> channel(IPC::Channel::CreateClient( | 253 scoped_ptr<IPC::Channel> channel(IPC::Channel::CreateClient( |
| 254 IPCTestBase::GetChannelName("FuzzServerClient"), | 254 IPCTestBase::GetChannelName("FuzzServerClient"), &listener, nullptr)); |
| 255 &listener)); | |
| 256 CHECK(channel->Connect()); | 255 CHECK(channel->Connect()); |
| 257 listener.Init(channel.get()); | 256 listener.Init(channel.get()); |
| 258 base::MessageLoop::current()->Run(); | 257 base::MessageLoop::current()->Run(); |
| 259 return 0; | 258 return 0; |
| 260 } | 259 } |
| 261 | 260 |
| 262 class IPCFuzzingTest : public IPCTestBase { | 261 class IPCFuzzingTest : public IPCTestBase { |
| 263 }; | 262 }; |
| 264 | 263 |
| 265 // This test makes sure that the FuzzerClientListener and FuzzerServerListener | 264 // This test makes sure that the FuzzerClientListener and FuzzerServerListener |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 // thrown out of sync by the extra argument. | 341 // thrown out of sync by the extra argument. |
| 343 msg = new MsgClassIS(3, base::ASCIIToUTF16("expect three")); | 342 msg = new MsgClassIS(3, base::ASCIIToUTF16("expect three")); |
| 344 sender()->Send(msg); | 343 sender()->Send(msg); |
| 345 EXPECT_TRUE(listener.ExpectMessage(3, MsgClassIS::ID)); | 344 EXPECT_TRUE(listener.ExpectMessage(3, MsgClassIS::ID)); |
| 346 | 345 |
| 347 EXPECT_TRUE(WaitForClientShutdown()); | 346 EXPECT_TRUE(WaitForClientShutdown()); |
| 348 DestroyChannel(); | 347 DestroyChannel(); |
| 349 } | 348 } |
| 350 | 349 |
| 351 } // namespace | 350 } // namespace |
| OLD | NEW |