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

Side by Side Diff: ipc/ipc_fuzzing_tests.cc

Issue 307653003: Introduce IPC::Channel::Create*() to ensure it being heap-allocated. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing windows build, landing again. Created 6 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_unittest.cc ('k') | ipc/ipc_perftests.cc » ('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/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
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 IPC::Channel channel(IPCTestBase::GetChannelName("FuzzServerClient"), 250 scoped_ptr<IPC::Channel> channel(IPC::Channel::CreateClient(
251 IPC::Channel::MODE_CLIENT, 251 IPCTestBase::GetChannelName("FuzzServerClient"),
252 &listener); 252 &listener));
253 CHECK(channel.Connect()); 253 CHECK(channel->Connect());
254 listener.Init(&channel); 254 listener.Init(channel.get());
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
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
OLDNEW
« no previous file with comments | « ipc/ipc_channel_unittest.cc ('k') | ipc/ipc_perftests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698