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/threading/platform_thread.h" | 10 #include "base/threading/platform_thread.h" |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 }; | 240 }; |
241 | 241 |
242 IPC::Message* last_msg_; | 242 IPC::Message* last_msg_; |
243 }; | 243 }; |
244 | 244 |
245 // Runs the fuzzing server child mode. Returns when the preset number of | 245 // Runs the fuzzing server child mode. Returns when the preset number of |
246 // messages have been received. | 246 // messages have been received. |
247 MULTIPROCESS_IPC_TEST_CLIENT_MAIN(FuzzServerClient) { | 247 MULTIPROCESS_IPC_TEST_CLIENT_MAIN(FuzzServerClient) { |
248 base::MessageLoopForIO main_message_loop; | 248 base::MessageLoopForIO main_message_loop; |
249 FuzzerServerListener listener; | 249 FuzzerServerListener listener; |
250 scoped_ptr<IPC::Channel> channel(IPC::Channel::CreateClient( | 250 IPC::Channel channel(IPCTestBase::GetChannelName("FuzzServerClient"), |
251 IPCTestBase::GetChannelName("FuzzServerClient"), | 251 IPC::Channel::MODE_CLIENT, |
252 &listener)); | 252 &listener); |
253 CHECK(channel->Connect()); | 253 CHECK(channel.Connect()); |
254 listener.Init(channel.get()); | 254 listener.Init(&channel); |
255 base::MessageLoop::current()->Run(); | 255 base::MessageLoop::current()->Run(); |
256 return 0; | 256 return 0; |
257 } | 257 } |
258 | 258 |
259 class IPCFuzzingTest : public IPCTestBase { | 259 class IPCFuzzingTest : public IPCTestBase { |
260 }; | 260 }; |
261 | 261 |
262 // This test makes sure that the FuzzerClientListener and FuzzerServerListener | 262 // This test makes sure that the FuzzerClientListener and FuzzerServerListener |
263 // are working properly by generating two well formed IPC calls. | 263 // are working properly by generating two well formed IPC calls. |
264 TEST_F(IPCFuzzingTest, SanityTest) { | 264 TEST_F(IPCFuzzingTest, SanityTest) { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 // thrown out of sync by the extra argument. | 339 // thrown out of sync by the extra argument. |
340 msg = new MsgClassIS(3, L"expect three"); | 340 msg = new MsgClassIS(3, L"expect three"); |
341 sender()->Send(msg); | 341 sender()->Send(msg); |
342 EXPECT_TRUE(listener.ExpectMessage(3, MsgClassIS::ID)); | 342 EXPECT_TRUE(listener.ExpectMessage(3, MsgClassIS::ID)); |
343 | 343 |
344 EXPECT_TRUE(WaitForClientShutdown()); | 344 EXPECT_TRUE(WaitForClientShutdown()); |
345 DestroyChannel(); | 345 DestroyChannel(); |
346 } | 346 } |
347 | 347 |
348 } // namespace | 348 } // namespace |
OLD | NEW |