Chromium Code Reviews| Index: ipc/ipc_message_utils_unittest.cc |
| diff --git a/ipc/ipc_message_utils_unittest.cc b/ipc/ipc_message_utils_unittest.cc |
| index 977c9e0606f4f1cba59394f3fad522b9242612f4..57ec988fd9a003fd75db43320f94e8caffec6f0c 100644 |
| --- a/ipc/ipc_message_utils_unittest.cc |
| +++ b/ipc/ipc_message_utils_unittest.cc |
| @@ -10,6 +10,7 @@ |
| #include "base/files/file_path.h" |
| #include "base/json/json_reader.h" |
| +#include "ipc/ipc_channel_handle.h" |
| #include "ipc/ipc_message.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| @@ -134,5 +135,28 @@ TEST(IPCMessageUtilsTest, JsonValueSize) { |
| EXPECT_EQ(sizer.payload_size(), pickle.payload_size()); |
| } |
| +TEST(IPCMessageUtilsTest, MojoChannelHandle) { |
| + mojo::MessagePipe message_pipe; |
| + IPC::ChannelHandle channel_handle(message_pipe.handle0.release()); |
| + |
| + IPC::Message message; |
| + IPC::WriteParam(&message, channel_handle); |
| + |
| + base::PickleSizer sizer; |
| + IPC::GetParamSize(&sizer, channel_handle); |
| + EXPECT_EQ(sizer.payload_size(), message.payload_size()); |
| + |
| + base::PickleIterator iter(message); |
| + IPC::ChannelHandle result_handle; |
| + EXPECT_TRUE(IPC::ReadParam(&message, &iter, &result_handle)); |
| + EXPECT_TRUE(result_handle.name.empty()); |
| +#if defined(OS_POSIX) |
| + EXPECT_EQ(result_handle.socket.fd, -1); |
|
dcheng
2016/06/27 01:55:32
EXPECT_EQ(expected, actual) is the convention, I t
Anand Mistry (off Chromium)
2016/06/27 02:40:43
Done.
Funnily enough, I've had a post-it note on
|
| +#elif defined(OS_WIN) |
| + EXPECT_TRUE(result_handle.pipe.handle == NULL); |
|
dcheng
2016/06/27 01:55:32
EXPECT_EQ(nullptr, result_handle.pipe.handle)
Anand Mistry (off Chromium)
2016/06/27 02:40:43
Done. But note, the field is a HANDLE and I don't
|
| +#endif |
| + EXPECT_EQ(channel_handle.mojo_handle, result_handle.mojo_handle); |
| +} |
| + |
| } // namespace |
| } // namespace IPC |