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 // This file tests the C buffer API (the functions declared in | 5 // This file tests the C buffer API (the functions declared in |
6 // mojo/public/c/include/mojo/system/buffer.h). | 6 // mojo/public/c/include/mojo/system/buffer.h). |
7 | 7 |
8 #include <mojo/system/buffer.h> | 8 #include <mojo/system/buffer.h> |
9 | 9 |
10 #include <mojo/result.h> | 10 #include <mojo/result.h> |
11 #include <mojo/system/handle.h> | 11 #include <mojo/system/handle.h> |
12 | 12 |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "gtest/gtest.h" |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 const MojoHandleRights kDefaultSharedBufferHandleRights = | 17 const MojoHandleRights kDefaultSharedBufferHandleRights = |
18 MOJO_HANDLE_RIGHT_DUPLICATE | MOJO_HANDLE_RIGHT_TRANSFER | | 18 MOJO_HANDLE_RIGHT_DUPLICATE | MOJO_HANDLE_RIGHT_TRANSFER | |
19 MOJO_HANDLE_RIGHT_GET_OPTIONS | MOJO_HANDLE_RIGHT_SET_OPTIONS | | 19 MOJO_HANDLE_RIGHT_GET_OPTIONS | MOJO_HANDLE_RIGHT_SET_OPTIONS | |
20 MOJO_HANDLE_RIGHT_MAP_READABLE | MOJO_HANDLE_RIGHT_MAP_WRITABLE | | 20 MOJO_HANDLE_RIGHT_MAP_READABLE | MOJO_HANDLE_RIGHT_MAP_WRITABLE | |
21 MOJO_HANDLE_RIGHT_MAP_EXECUTABLE; | 21 MOJO_HANDLE_RIGHT_MAP_EXECUTABLE; |
22 | 22 |
23 // The only handle that's guaranteed to be invalid is |MOJO_HANDLE_INVALID|. | 23 // The only handle that's guaranteed to be invalid is |MOJO_HANDLE_INVALID|. |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 EXPECT_EQ(MOJO_RESULT_PERMISSION_DENIED, MojoDuplicateHandle(h2, &h3)); | 123 EXPECT_EQ(MOJO_RESULT_PERMISSION_DENIED, MojoDuplicateHandle(h2, &h3)); |
124 EXPECT_EQ(MOJO_HANDLE_INVALID, h3); | 124 EXPECT_EQ(MOJO_HANDLE_INVALID, h3); |
125 | 125 |
126 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h1)); | 126 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h1)); |
127 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h2)); | 127 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h2)); |
128 } | 128 } |
129 | 129 |
130 // TODO(vtl): Add multi-threaded tests. | 130 // TODO(vtl): Add multi-threaded tests. |
131 | 131 |
132 } // namespace | 132 } // namespace |
OLD | NEW |