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/public/cpp/test_support/test_utils.h" | 5 #include "mojo/public/cpp/test_support/test_utils.h" |
6 | 6 |
7 #include "mojo/public/cpp/system/handle.h" | 7 #include "mojo/public/cpp/system/handle.h" |
8 #include "mojo/public/cpp/system/message_pipe.h" | 8 #include "mojo/public/cpp/system/message_pipe.h" |
| 9 #include "mojo/public/cpp/system/wait.h" |
9 | 10 |
10 namespace mojo { | 11 namespace mojo { |
11 namespace test { | 12 namespace test { |
12 | 13 |
13 bool WriteTextMessage(const MessagePipeHandle& handle, | 14 bool WriteTextMessage(const MessagePipeHandle& handle, |
14 const std::string& text) { | 15 const std::string& text) { |
15 MojoResult rv = | 16 MojoResult rv = |
16 WriteMessageRaw(handle, text.data(), static_cast<uint32_t>(text.size()), | 17 WriteMessageRaw(handle, text.data(), static_cast<uint32_t>(text.size()), |
17 nullptr, 0u, MOJO_WRITE_MESSAGE_FLAG_NONE); | 18 nullptr, 0u, MOJO_WRITE_MESSAGE_FLAG_NONE); |
18 return rv == MOJO_RESULT_OK; | 19 return rv == MOJO_RESULT_OK; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 } | 51 } |
51 | 52 |
52 bool DiscardMessage(const MessagePipeHandle& handle) { | 53 bool DiscardMessage(const MessagePipeHandle& handle) { |
53 MojoResult rv = ReadMessageRaw(handle, nullptr, nullptr, nullptr, nullptr, | 54 MojoResult rv = ReadMessageRaw(handle, nullptr, nullptr, nullptr, nullptr, |
54 MOJO_READ_MESSAGE_FLAG_MAY_DISCARD); | 55 MOJO_READ_MESSAGE_FLAG_MAY_DISCARD); |
55 return rv == MOJO_RESULT_OK; | 56 return rv == MOJO_RESULT_OK; |
56 } | 57 } |
57 | 58 |
58 } // namespace test | 59 } // namespace test |
59 } // namespace mojo | 60 } // namespace mojo |
OLD | NEW |