| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "mojo/edk/system/core.h" | 5 #include "mojo/edk/system/core.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 | 10 |
| (...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 ASSERT_EQ(MOJO_RESULT_BUSY, | 714 ASSERT_EQ(MOJO_RESULT_BUSY, |
| 715 core()->WriteMessage(h_passing[0], kHello, kHelloSize, | 715 core()->WriteMessage(h_passing[0], kHello, kHelloSize, |
| 716 &h_passing[0], 1, | 716 &h_passing[0], 1, |
| 717 MOJO_WRITE_MESSAGE_FLAG_NONE)); | 717 MOJO_WRITE_MESSAGE_FLAG_NONE)); |
| 718 ASSERT_EQ(MOJO_RESULT_INVALID_ARGUMENT, | 718 ASSERT_EQ(MOJO_RESULT_INVALID_ARGUMENT, |
| 719 core()->WriteMessage(h_passing[0], kHello, kHelloSize, | 719 core()->WriteMessage(h_passing[0], kHello, kHelloSize, |
| 720 &h_passing[1], 1, | 720 &h_passing[1], 1, |
| 721 MOJO_WRITE_MESSAGE_FLAG_NONE)); | 721 MOJO_WRITE_MESSAGE_FLAG_NONE)); |
| 722 | 722 |
| 723 MojoHandle h_passed[2]; | 723 MojoHandle h_passed[2]; |
| 724 MojoCreateMessagePipeOptions options; | |
| 725 options.struct_size = sizeof(MojoCreateMessagePipeOptions); | |
| 726 options.flags = MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_TRANSFERABLE; | |
| 727 ASSERT_EQ(MOJO_RESULT_OK, | 724 ASSERT_EQ(MOJO_RESULT_OK, |
| 728 core()->CreateMessagePipe(&options, &h_passed[0], &h_passed[1])); | 725 core()->CreateMessagePipe(nullptr, &h_passed[0], &h_passed[1])); |
| 729 | 726 |
| 730 // Make sure that |h_passed[]| work properly. | 727 // Make sure that |h_passed[]| work properly. |
| 731 ASSERT_EQ(MOJO_RESULT_OK, | 728 ASSERT_EQ(MOJO_RESULT_OK, |
| 732 core()->WriteMessage(h_passed[0], kHello, kHelloSize, nullptr, 0, | 729 core()->WriteMessage(h_passed[0], kHello, kHelloSize, nullptr, 0, |
| 733 MOJO_WRITE_MESSAGE_FLAG_NONE)); | 730 MOJO_WRITE_MESSAGE_FLAG_NONE)); |
| 734 hss = kEmptyMojoHandleSignalsState; | 731 hss = kEmptyMojoHandleSignalsState; |
| 735 ASSERT_EQ(MOJO_RESULT_OK, | 732 ASSERT_EQ(MOJO_RESULT_OK, |
| 736 core()->Wait(h_passed[1], MOJO_HANDLE_SIGNAL_READABLE, 1000000000, | 733 core()->Wait(h_passed[1], MOJO_HANDLE_SIGNAL_READABLE, 1000000000, |
| 737 &hss)); | 734 &hss)); |
| 738 ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE, | 735 ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE, |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1260 ASSERT_EQ(MOJO_RESULT_BUSY, waiter.result); | 1257 ASSERT_EQ(MOJO_RESULT_BUSY, waiter.result); |
| 1261 | 1258 |
| 1262 ASSERT_EQ(MOJO_RESULT_OK, core()->Close(h)); | 1259 ASSERT_EQ(MOJO_RESULT_OK, core()->Close(h)); |
| 1263 } | 1260 } |
| 1264 | 1261 |
| 1265 // TODO(vtl): Test |DuplicateBufferHandle()| and |MapBuffer()|. | 1262 // TODO(vtl): Test |DuplicateBufferHandle()| and |MapBuffer()|. |
| 1266 | 1263 |
| 1267 } // namespace | 1264 } // namespace |
| 1268 } // namespace edk | 1265 } // namespace edk |
| 1269 } // namespace mojo | 1266 } // namespace mojo |
| OLD | NEW |