OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MOJO_COMMON_TEST_TEST_UTILS_H_ |
| 6 #define MOJO_COMMON_TEST_TEST_UTILS_H_ |
| 7 |
| 8 #include <stddef.h> |
| 9 |
| 10 namespace mojo { |
| 11 |
| 12 namespace embedder { |
| 13 struct PlatformHandle; |
| 14 } |
| 15 |
| 16 namespace test { |
| 17 |
| 18 // On success, |bytes_written| is updated to the number of bytes written; |
| 19 // otherwise it is untouched. |
| 20 bool BlockingWrite(const embedder::PlatformHandle& handle, |
| 21 const void* buffer, |
| 22 size_t bytes_to_write, |
| 23 size_t* bytes_written); |
| 24 |
| 25 // On success, |bytes_read| is updated to the number of bytes read; otherwise it |
| 26 // is untouched. |
| 27 bool BlockingRead(const embedder::PlatformHandle& handle, |
| 28 void* buffer, |
| 29 size_t buffer_size, |
| 30 size_t* bytes_read); |
| 31 |
| 32 // If the read is done successfully or would block, the function returns true |
| 33 // and updates |bytes_read| to the number of bytes read (0 if the read would |
| 34 // block); otherwise it returns false and leaves |bytes_read| untouched. |
| 35 // |handle| must already be in non-blocking mode. |
| 36 bool NonBlockingRead(const embedder::PlatformHandle& handle, |
| 37 void* buffer, |
| 38 size_t buffer_size, |
| 39 size_t* bytes_read); |
| 40 |
| 41 } // namespace test |
| 42 } // namespace mojo |
| 43 |
| 44 #endif // MOJO_COMMON_TEST_TEST_UTILS_H_ |
OLD | NEW |