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

Unified Diff: mojo/edk/system/remote_message_pipe_unittest.cc

Issue 799113004: Update mojo sdk to rev 59145288bae55b0fce4276b017df6a1117bcf00f (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add mojo's ply to checklicenses whitelist Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/edk/system/message_pipe_test_utils.cc ('k') | mojo/edk/system/waiter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/remote_message_pipe_unittest.cc
diff --git a/mojo/edk/system/remote_message_pipe_unittest.cc b/mojo/edk/system/remote_message_pipe_unittest.cc
index d34602c9a382ea6dc91bf41e9a86392d24606162..8a02f2e4de9970d23fd566b8b9a1c320fde9f1e3 100644
--- a/mojo/edk/system/remote_message_pipe_unittest.cc
+++ b/mojo/edk/system/remote_message_pipe_unittest.cc
@@ -27,6 +27,7 @@
#include "mojo/edk/system/channel.h"
#include "mojo/edk/system/channel_endpoint.h"
#include "mojo/edk/system/channel_endpoint_id.h"
+#include "mojo/edk/system/incoming_endpoint.h"
#include "mojo/edk/system/message_pipe.h"
#include "mojo/edk/system/message_pipe_dispatcher.h"
#include "mojo/edk/system/platform_handle_dispatcher.h"
@@ -139,8 +140,8 @@ class RemoteMessagePipeTest : public testing::Test {
if (!channels_[1])
CreateAndInitChannel(1);
- channels_[0]->AttachAndRunEndpoint(ep0, true);
- channels_[1]->AttachAndRunEndpoint(ep1, true);
+ channels_[0]->SetBootstrapEndpoint(ep0);
+ channels_[1]->SetBootstrapEndpoint(ep1);
}
void BootstrapChannelEndpointOnIOThread(unsigned channel_index,
@@ -149,7 +150,7 @@ class RemoteMessagePipeTest : public testing::Test {
CHECK(channel_index == 0 || channel_index == 1);
CreateAndInitChannel(channel_index);
- channels_[channel_index]->AttachAndRunEndpoint(ep, true);
+ channels_[channel_index]->SetBootstrapEndpoint(ep);
}
void RestoreInitialStateOnIOThread() {
@@ -333,8 +334,9 @@ TEST_F(RemoteMessagePipeTest, Multiplex) {
scoped_refptr<ChannelEndpoint> ep2;
scoped_refptr<MessagePipe> mp2(MessagePipe::CreateLocalProxy(&ep2));
ASSERT_TRUE(channels(0));
- ChannelEndpointId remote_id = channels(0)->AttachAndRunEndpoint(ep2, false);
- EXPECT_TRUE(remote_id.is_remote());
+ size_t endpoint_info_size = channels(0)->GetSerializedEndpointSize();
+ scoped_ptr<char[]> endpoint_info(new char[endpoint_info_size]);
+ channels(0)->SerializeEndpoint(ep2, endpoint_info.get());
waiter.Init();
ASSERT_EQ(
@@ -342,9 +344,9 @@ TEST_F(RemoteMessagePipeTest, Multiplex) {
mp1->AddAwakable(1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123, nullptr));
EXPECT_EQ(MOJO_RESULT_OK,
- mp0->WriteMessage(0, UserPointer<const void>(&remote_id),
- sizeof(remote_id), nullptr,
- MOJO_WRITE_MESSAGE_FLAG_NONE));
+ mp0->WriteMessage(0, UserPointer<const void>(endpoint_info.get()),
+ static_cast<uint32_t>(endpoint_info_size),
+ nullptr, MOJO_WRITE_MESSAGE_FLAG_NONE));
EXPECT_EQ(MOJO_RESULT_OK, waiter.Wait(MOJO_DEADLINE_INDEFINITE, &context));
EXPECT_EQ(123u, context);
@@ -354,18 +356,22 @@ TEST_F(RemoteMessagePipeTest, Multiplex) {
hss.satisfied_signals);
EXPECT_EQ(kAllSignals, hss.satisfiable_signals);
- ChannelEndpointId received_id;
- buffer_size = static_cast<uint32_t>(sizeof(received_id));
+ EXPECT_EQ(endpoint_info_size, channels(1)->GetSerializedEndpointSize());
+ scoped_ptr<char[]> received_endpoint_info(new char[endpoint_info_size]);
+ buffer_size = static_cast<uint32_t>(endpoint_info_size);
EXPECT_EQ(MOJO_RESULT_OK,
- mp1->ReadMessage(1, UserPointer<void>(&received_id),
+ mp1->ReadMessage(1, UserPointer<void>(received_endpoint_info.get()),
MakeUserPointer(&buffer_size), nullptr, nullptr,
MOJO_READ_MESSAGE_FLAG_NONE));
- EXPECT_EQ(sizeof(received_id), static_cast<size_t>(buffer_size));
- EXPECT_EQ(remote_id, received_id);
+ EXPECT_EQ(endpoint_info_size, static_cast<size_t>(buffer_size));
+ EXPECT_EQ(0, memcmp(received_endpoint_info.get(), endpoint_info.get(),
+ endpoint_info_size));
// Warning: The local side of mp3 is port 0, not port 1.
- scoped_refptr<MessagePipe> mp3 =
- channels(1)->PassIncomingMessagePipe(received_id);
+ scoped_refptr<IncomingEndpoint> incoming_endpoint =
+ channels(1)->DeserializeEndpoint(received_endpoint_info.get());
+ ASSERT_TRUE(incoming_endpoint);
+ scoped_refptr<MessagePipe> mp3 = incoming_endpoint->ConvertToMessagePipe();
ASSERT_TRUE(mp3);
// Write: MP 2, port 0 -> MP 3, port 1.
« no previous file with comments | « mojo/edk/system/message_pipe_test_utils.cc ('k') | mojo/edk/system/waiter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698