Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Side by Side Diff: mojo/edk/test/mojo_test_base.h

Issue 1689053003: Support read-only duplicates of Mojo shared buffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-shm-interop
Patch Set: Rebase and fix comment. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/edk/system/shared_buffer_unittest.cc ('k') | mojo/edk/test/mojo_test_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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_
OLDNEW
« no previous file with comments | « mojo/edk/system/shared_buffer_unittest.cc ('k') | mojo/edk/test/mojo_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698