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

Side by Side Diff: ipc/sync_socket_unittest.cc

Issue 843113003: MultiProcessTest: Update SpawnChild* to return a Process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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') | mojo/edk/test/multiprocess_test_helper.h » ('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 "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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 // Immediately after creation there should be no pending bytes. 177 // Immediately after creation there should be no pending bytes.
178 EXPECT_EQ(0U, pair[0].Peek()); 178 EXPECT_EQ(0U, pair[0].Peek());
179 EXPECT_EQ(0U, pair[1].Peek()); 179 EXPECT_EQ(0U, pair[1].Peek());
180 base::SyncSocket::Handle target_handle; 180 base::SyncSocket::Handle target_handle;
181 // Connect the channel and listener. 181 // Connect the channel and listener.
182 ASSERT_TRUE(ConnectChannel()); 182 ASSERT_TRUE(ConnectChannel());
183 listener.Init(&pair[0], channel()); 183 listener.Init(&pair[0], channel());
184 #if defined(OS_WIN) 184 #if defined(OS_WIN)
185 // On windows we need to duplicate the handle into the server process. 185 // On windows we need to duplicate the handle into the server process.
186 BOOL retval = DuplicateHandle(GetCurrentProcess(), pair[1].handle(), 186 BOOL retval = DuplicateHandle(GetCurrentProcess(), pair[1].handle(),
187 client_process(), &target_handle, 187 client_process().Handle(), &target_handle,
188 0, FALSE, DUPLICATE_SAME_ACCESS); 188 0, FALSE, DUPLICATE_SAME_ACCESS);
189 EXPECT_TRUE(retval); 189 EXPECT_TRUE(retval);
190 // Set up a message to pass the handle to the server. 190 // Set up a message to pass the handle to the server.
191 IPC::Message* msg = new MsgClassSetHandle(target_handle); 191 IPC::Message* msg = new MsgClassSetHandle(target_handle);
192 #else 192 #else
193 target_handle = pair[1].handle(); 193 target_handle = pair[1].handle();
194 // Set up a message to pass the handle to the server. 194 // Set up a message to pass the handle to the server.
195 base::FileDescriptor filedesc(target_handle, false); 195 base::FileDescriptor filedesc(target_handle, false);
196 IPC::Message* msg = new MsgClassSetHandle(filedesc); 196 IPC::Message* msg = new MsgClassSetHandle(filedesc);
197 #endif // defined(OS_WIN) 197 #endif // defined(OS_WIN)
(...skipping 101 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/mojo/ipc_mojo_perftest.cc ('k') | mojo/edk/test/multiprocess_test_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698