| OLD | NEW |
| 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 "mojo/edk/system/channel.h" | 5 #include "mojo/edk/system/channel.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "mojo/edk/system/channel_endpoint.h" | 9 #include "mojo/edk/system/channel_endpoint.h" |
| 10 #include "mojo/edk/system/channel_endpoint_id.h" | 10 #include "mojo/edk/system/channel_endpoint_id.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 waiter.Init(); | 65 waiter.Init(); |
| 66 ASSERT_EQ(MOJO_RESULT_OK, | 66 ASSERT_EQ(MOJO_RESULT_OK, |
| 67 mp->AddAwakable(0, &waiter, MOJO_HANDLE_SIGNAL_READABLE, false, 123, | 67 mp->AddAwakable(0, &waiter, MOJO_HANDLE_SIGNAL_READABLE, false, 123, |
| 68 nullptr)); | 68 nullptr)); |
| 69 | 69 |
| 70 // Don't wait for the shutdown to run ... | 70 // Don't wait for the shutdown to run ... |
| 71 io_thread()->PostTaskAndWait([this]() { ShutdownChannelOnIOThread(0); }); | 71 io_thread()->PostTaskAndWait([this]() { ShutdownChannelOnIOThread(0); }); |
| 72 | 72 |
| 73 // ... since this |Wait()| should fail once the channel is shut down. | 73 // ... since this |Wait()| should fail once the channel is shut down. |
| 74 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, | 74 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, |
| 75 waiter.Wait(MOJO_DEADLINE_INDEFINITE, nullptr)); | 75 waiter.Wait(MOJO_DEADLINE_INDEFINITE, nullptr, nullptr)); |
| 76 HandleSignalsState hss; | 76 HandleSignalsState hss; |
| 77 mp->RemoveAwakable(0, &waiter, &hss); | 77 mp->RemoveAwakable(0, &waiter, &hss); |
| 78 EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfied_signals); | 78 EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfied_signals); |
| 79 EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfiable_signals); | 79 EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfiable_signals); |
| 80 | 80 |
| 81 mp->Close(0); | 81 mp->Close(0); |
| 82 | 82 |
| 83 EXPECT_TRUE(channel(0)->HasOneRef()); | 83 EXPECT_TRUE(channel(0)->HasOneRef()); |
| 84 } | 84 } |
| 85 | 85 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 io_thread()->PostTaskAndWait([]() {}); | 132 io_thread()->PostTaskAndWait([]() {}); |
| 133 EXPECT_FALSE(channel(0)); | 133 EXPECT_FALSE(channel(0)); |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 | 136 |
| 137 // TODO(vtl): More. ------------------------------------------------------------ | 137 // TODO(vtl): More. ------------------------------------------------------------ |
| 138 | 138 |
| 139 } // namespace | 139 } // namespace |
| 140 } // namespace system | 140 } // namespace system |
| 141 } // namespace mojo | 141 } // namespace mojo |
| OLD | NEW |