OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef MOJO_EDK_TEST_MOJO_TEST_BASE_H_ | 5 #ifndef MOJO_EDK_TEST_MOJO_TEST_BASE_H_ |
6 #define MOJO_EDK_TEST_MOJO_TEST_BASE_H_ | 6 #define MOJO_EDK_TEST_MOJO_TEST_BASE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 // Writes |message| to |mp| and expects to read it back from the same handle. | 109 // Writes |message| to |mp| and expects to read it back from the same handle. |
110 static void VerifyEcho(MojoHandle mp, const std::string& message); | 110 static void VerifyEcho(MojoHandle mp, const std::string& message); |
111 | 111 |
112 //////// Shared buffer test utilities ///////// | 112 //////// Shared buffer test utilities ///////// |
113 | 113 |
114 // Creates a new shared buffer. | 114 // Creates a new shared buffer. |
115 static MojoHandle CreateBuffer(uint64_t size); | 115 static MojoHandle CreateBuffer(uint64_t size); |
116 | 116 |
117 // Duplicates a shared buffer to a new handle. | 117 // Duplicates a shared buffer to a new handle. |
118 static MojoHandle DuplicateBuffer(MojoHandle h); | 118 static MojoHandle DuplicateBuffer(MojoHandle h, bool read_only); |
119 | 119 |
120 // Maps a buffer, writes some data into it, and unmaps it. | 120 // Maps a buffer, writes some data into it, and unmaps it. |
121 static void WriteToBuffer(MojoHandle h, | 121 static void WriteToBuffer(MojoHandle h, |
122 size_t offset, | 122 size_t offset, |
123 const base::StringPiece& s); | 123 const base::StringPiece& s); |
124 | 124 |
125 // Maps a buffer, tests the value of some of its contents, and unmaps it. | 125 // Maps a buffer, tests the value of some of its contents, and unmaps it. |
126 static void ExpectBufferContents(MojoHandle h, | 126 static void ExpectBufferContents(MojoHandle h, |
127 size_t offset, | 127 size_t offset, |
128 const base::StringPiece& s); | 128 const base::StringPiece& s); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 #else // !defined(OS_IOS) | 216 #else // !defined(OS_IOS) |
217 #define DEFINE_TEST_CLIENT_WITH_PIPE(client_name, test_base, pipe_name) | 217 #define DEFINE_TEST_CLIENT_WITH_PIPE(client_name, test_base, pipe_name) |
218 #define DEFINE_TEST_CLIENT_TEST_WITH_PIPE(client_name, test_base, pipe_name) | 218 #define DEFINE_TEST_CLIENT_TEST_WITH_PIPE(client_name, test_base, pipe_name) |
219 #endif // !defined(OS_IOS) | 219 #endif // !defined(OS_IOS) |
220 | 220 |
221 } // namespace test | 221 } // namespace test |
222 } // namespace edk | 222 } // namespace edk |
223 } // namespace mojo | 223 } // namespace mojo |
224 | 224 |
225 #endif // MOJO_EDK_TEST_MOJO_TEST_BASE_H_ | 225 #endif // MOJO_EDK_TEST_MOJO_TEST_BASE_H_ |
OLD | NEW |