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

Side by Side Diff: mojo/edk/system/remote_message_pipe_unittest.cc

Issue 795593004: Update mojo sdk to rev cc531b32182099a5a034a99daff35ed5d38a61c8 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More workarounds for MSVC 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 | « mojo/edk/system/raw_channel.cc ('k') | mojo/edk/test/BUILD.gn » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stdint.h> 5 #include <stdint.h>
6 #include <stdio.h> 6 #include <stdio.h>
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 scoped_refptr<MessagePipe> mp1(MessagePipe::CreateProxyLocal(&ep1)); 324 scoped_refptr<MessagePipe> mp1(MessagePipe::CreateProxyLocal(&ep1));
325 BootstrapChannelEndpoints(ep0, ep1); 325 BootstrapChannelEndpoints(ep0, ep1);
326 326
327 // Now put another message pipe on the channel. 327 // Now put another message pipe on the channel.
328 328
329 // Do this by creating a message pipe (for the |channels(0)| side) and 329 // Do this by creating a message pipe (for the |channels(0)| side) and
330 // attaching and running it, yielding the remote ID. A message is then sent 330 // attaching and running it, yielding the remote ID. A message is then sent
331 // via |ep0| (i.e., sent using |mp0|, port 0) with this remote ID. Upon 331 // via |ep0| (i.e., sent using |mp0|, port 0) with this remote ID. Upon
332 // receiving this message, |PassIncomingMessagePipe()| is used to obtain the 332 // receiving this message, |PassIncomingMessagePipe()| is used to obtain the
333 // message pipe on the other side. 333 // message pipe on the other side.
334 scoped_refptr<ChannelEndpoint> ep2; 334 scoped_refptr<MessagePipe> mp2(MessagePipe::CreateLocalLocal());
335 scoped_refptr<MessagePipe> mp2(MessagePipe::CreateLocalProxy(&ep2));
336 ASSERT_TRUE(channels(0)); 335 ASSERT_TRUE(channels(0));
337 size_t endpoint_info_size = channels(0)->GetSerializedEndpointSize(); 336 size_t max_endpoint_info_size;
338 scoped_ptr<char[]> endpoint_info(new char[endpoint_info_size]); 337 size_t max_platform_handle_count;
339 channels(0)->SerializeEndpoint(ep2, endpoint_info.get()); 338 mp2->StartSerialize(1, channels(0), &max_endpoint_info_size,
339 &max_platform_handle_count);
340 EXPECT_GT(max_endpoint_info_size, 0u);
341 ASSERT_EQ(0u, max_platform_handle_count);
342 scoped_ptr<char[]> endpoint_info(new char[max_endpoint_info_size]);
343 size_t endpoint_info_size;
344 mp2->EndSerialize(1, channels(0), endpoint_info.get(), &endpoint_info_size,
345 nullptr);
346 EXPECT_EQ(max_endpoint_info_size, endpoint_info_size);
340 347
341 waiter.Init(); 348 waiter.Init();
342 ASSERT_EQ( 349 ASSERT_EQ(
343 MOJO_RESULT_OK, 350 MOJO_RESULT_OK,
344 mp1->AddAwakable(1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123, nullptr)); 351 mp1->AddAwakable(1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123, nullptr));
345 352
346 EXPECT_EQ(MOJO_RESULT_OK, 353 EXPECT_EQ(MOJO_RESULT_OK,
347 mp0->WriteMessage(0, UserPointer<const void>(endpoint_info.get()), 354 mp0->WriteMessage(0, UserPointer<const void>(endpoint_info.get()),
348 static_cast<uint32_t>(endpoint_info_size), 355 static_cast<uint32_t>(endpoint_info_size),
349 nullptr, MOJO_WRITE_MESSAGE_FLAG_NONE)); 356 nullptr, MOJO_WRITE_MESSAGE_FLAG_NONE));
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
1360 mp0->Close(0); 1367 mp0->Close(0);
1361 mp1->Close(1); 1368 mp1->Close(1);
1362 EXPECT_EQ(MOJO_RESULT_OK, dispatcher->Close()); 1369 EXPECT_EQ(MOJO_RESULT_OK, dispatcher->Close());
1363 // Note that |local_mp|'s port 0 belong to |dispatcher|, which was closed. 1370 // Note that |local_mp|'s port 0 belong to |dispatcher|, which was closed.
1364 local_mp->Close(1); 1371 local_mp->Close(1);
1365 } 1372 }
1366 1373
1367 } // namespace 1374 } // namespace
1368 } // namespace system 1375 } // namespace system
1369 } // namespace mojo 1376 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/raw_channel.cc ('k') | mojo/edk/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698