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

Side by Side Diff: ipc/sync_socket_unittest.cc

Issue 1185133006: IPC: Make ChannelReader inherit from SupportsAttachmentBrokering. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from tsepez. Created 5 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
« no previous file with comments | « ipc/mojo/ipc_mojo_perftest.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 <sstream> 8 #include <sstream>
9 #include <string> 9 #include <string>
10 10
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 DISALLOW_COPY_AND_ASSIGN(SyncSocketServerListener); 104 DISALLOW_COPY_AND_ASSIGN(SyncSocketServerListener);
105 }; 105 };
106 106
107 // Runs the fuzzing server child mode. Returns when the preset number of 107 // Runs the fuzzing server child mode. Returns when the preset number of
108 // messages have been received. 108 // messages have been received.
109 MULTIPROCESS_IPC_TEST_CLIENT_MAIN(SyncSocketServerClient) { 109 MULTIPROCESS_IPC_TEST_CLIENT_MAIN(SyncSocketServerClient) {
110 base::MessageLoopForIO main_message_loop; 110 base::MessageLoopForIO main_message_loop;
111 SyncSocketServerListener listener; 111 SyncSocketServerListener listener;
112 scoped_ptr<IPC::Channel> channel(IPC::Channel::CreateClient( 112 scoped_ptr<IPC::Channel> channel(IPC::Channel::CreateClient(
113 IPCTestBase::GetChannelName("SyncSocketServerClient"), 113 IPCTestBase::GetChannelName("SyncSocketServerClient"), &listener,
114 &listener)); 114 nullptr));
115 EXPECT_TRUE(channel->Connect()); 115 EXPECT_TRUE(channel->Connect());
116 listener.Init(channel.get()); 116 listener.Init(channel.get());
117 base::MessageLoop::current()->Run(); 117 base::MessageLoop::current()->Run();
118 return 0; 118 return 0;
119 } 119 }
120 120
121 // The SyncSocket client listener only processes one sort of message, 121 // The SyncSocket client listener only processes one sort of message,
122 // a response from the server. 122 // a response from the server.
123 class SyncSocketClientListener : public IPC::Listener { 123 class SyncSocketClientListener : public IPC::Listener {
124 public: 124 public:
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 301
302 // Read from another socket to free some space for a new write. 302 // Read from another socket to free some space for a new write.
303 char hello[kHelloStringLength] = {0}; 303 char hello[kHelloStringLength] = {0};
304 pair[1].Receive(&hello[0], sizeof(hello)); 304 pair[1].Receive(&hello[0], sizeof(hello));
305 305
306 // Should be able to write more data to the buffer now. 306 // Should be able to write more data to the buffer now.
307 EXPECT_EQ(kHelloStringLength, pair[0].Send(kHelloString, kHelloStringLength)); 307 EXPECT_EQ(kHelloStringLength, pair[0].Send(kHelloString, kHelloStringLength));
308 } 308 }
309 309
310 } // namespace 310 } // namespace
OLDNEW
« no previous file with comments | « ipc/mojo/ipc_mojo_perftest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698