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

Side by Side Diff: ipc/sync_socket_unittest.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_test_base.cc ('k') | no next file » | 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 "base/sync_socket.h" 5 #include "base/sync_socket.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 #include <string> 8 #include <string>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 IPC::Channel* chan_; 101 IPC::Channel* chan_;
102 102
103 DISALLOW_COPY_AND_ASSIGN(SyncSocketServerListener); 103 DISALLOW_COPY_AND_ASSIGN(SyncSocketServerListener);
104 }; 104 };
105 105
106 // Runs the fuzzing server child mode. Returns when the preset number of 106 // Runs the fuzzing server child mode. Returns when the preset number of
107 // messages have been received. 107 // messages have been received.
108 MULTIPROCESS_IPC_TEST_CLIENT_MAIN(SyncSocketServerClient) { 108 MULTIPROCESS_IPC_TEST_CLIENT_MAIN(SyncSocketServerClient) {
109 base::MessageLoopForIO main_message_loop; 109 base::MessageLoopForIO main_message_loop;
110 SyncSocketServerListener listener; 110 SyncSocketServerListener listener;
111 IPC::Channel channel(IPCTestBase::GetChannelName("SyncSocketServerClient"), 111 scoped_ptr<IPC::Channel> channel(IPC::Channel::CreateClient(
112 IPC::Channel::MODE_CLIENT, 112 IPCTestBase::GetChannelName("SyncSocketServerClient"),
113 &listener); 113 &listener));
114 EXPECT_TRUE(channel.Connect()); 114 EXPECT_TRUE(channel->Connect());
115 listener.Init(&channel); 115 listener.Init(channel.get());
116 base::MessageLoop::current()->Run(); 116 base::MessageLoop::current()->Run();
117 return 0; 117 return 0;
118 } 118 }
119 119
120 // The SyncSocket client listener only processes one sort of message, 120 // The SyncSocket client listener only processes one sort of message,
121 // a response from the server. 121 // a response from the server.
122 class SyncSocketClientListener : public IPC::Listener { 122 class SyncSocketClientListener : public IPC::Listener {
123 public: 123 public:
124 SyncSocketClientListener() { 124 SyncSocketClientListener() {
125 } 125 }
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 299
300 // Read from another socket to free some space for a new write. 300 // Read from another socket to free some space for a new write.
301 char hello[kHelloStringLength] = {0}; 301 char hello[kHelloStringLength] = {0};
302 pair[1].Receive(&hello[0], sizeof(hello)); 302 pair[1].Receive(&hello[0], sizeof(hello));
303 303
304 // Should be able to write more data to the buffer now. 304 // Should be able to write more data to the buffer now.
305 EXPECT_EQ(kHelloStringLength, pair[0].Send(kHelloString, kHelloStringLength)); 305 EXPECT_EQ(kHelloStringLength, pair[0].Send(kHelloString, kHelloStringLength));
306 } 306 }
307 307
308 } // namespace 308 } // namespace
OLDNEW
« no previous file with comments | « ipc/ipc_test_base.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698