OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/ipc_support.h" | 5 #include "mojo/edk/system/ipc_support.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 MOJO_HANDLE_RIGHT_WRITE); | 92 MOJO_HANDLE_RIGHT_WRITE); |
93 | 93 |
94 // Set up waiting on the read end first (to avoid racing). | 94 // Set up waiting on the read end first (to avoid racing). |
95 Waiter waiter; | 95 Waiter waiter; |
96 waiter.Init(); | 96 waiter.Init(); |
97 CHECK_EQ( | 97 CHECK_EQ( |
98 read_mp->AddAwakable(&waiter, MOJO_HANDLE_SIGNAL_READABLE, 0, nullptr), | 98 read_mp->AddAwakable(&waiter, MOJO_HANDLE_SIGNAL_READABLE, 0, nullptr), |
99 MOJO_RESULT_OK); | 99 MOJO_RESULT_OK); |
100 | 100 |
101 // Write a message with just |mp_handle_to_send| through the write end. | 101 // Write a message with just |mp_handle_to_send| through the write end. |
102 DispatcherTransport transport( | 102 HandleTransport transport(test::HandleTryStartTransport(mp_handle_to_send)); |
103 test::HandleTryStartTransport(mp_handle_to_send)); | |
104 CHECK(transport.is_valid()); | 103 CHECK(transport.is_valid()); |
105 std::vector<DispatcherTransport> transports; | 104 std::vector<HandleTransport> transports; |
106 transports.push_back(transport); | 105 transports.push_back(transport); |
107 CHECK_EQ(write_mp->WriteMessage(NullUserPointer(), 0, &transports, | 106 CHECK_EQ(write_mp->WriteMessage(NullUserPointer(), 0, &transports, |
108 MOJO_WRITE_MESSAGE_FLAG_NONE), | 107 MOJO_WRITE_MESSAGE_FLAG_NONE), |
109 MOJO_RESULT_OK); | 108 MOJO_RESULT_OK); |
110 transport.End(); | 109 transport.End(); |
111 mp_handle_to_send.reset(); | 110 mp_handle_to_send.reset(); |
112 | 111 |
113 // Wait for it to arrive. | 112 // Wait for it to arrive. |
114 CHECK_EQ(waiter.Wait(test::ActionTimeout(), nullptr), MOJO_RESULT_OK); | 113 CHECK_EQ(waiter.Wait(test::ActionTimeout(), nullptr), MOJO_RESULT_OK); |
115 read_mp->RemoveAwakable(&waiter, nullptr); | 114 read_mp->RemoveAwakable(&waiter, nullptr); |
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 | 717 |
719 test_io_thread.PostTaskAndWait( | 718 test_io_thread.PostTaskAndWait( |
720 [&ipc_support]() { ipc_support.ShutdownOnIOThread(); }); | 719 [&ipc_support]() { ipc_support.ShutdownOnIOThread(); }); |
721 } | 720 } |
722 | 721 |
723 // TODO(vtl): Also test the case of the master "dying" before the slave. (The | 722 // TODO(vtl): Also test the case of the master "dying" before the slave. (The |
724 // slave should get OnMasterDisconnect(), which we currently don't test.) | 723 // slave should get OnMasterDisconnect(), which we currently don't test.) |
725 | 724 |
726 } // namespace system | 725 } // namespace system |
727 } // namespace mojo | 726 } // namespace mojo |
OLD | NEW |