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

Side by Side Diff: mojo/public/c/system/tests/buffer_unittest.cc

Issue 2107893003: Remove some #ifdef __native_client__ on tests. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 5 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 | « no previous file | mojo/public/c/system/tests/data_pipe_unittest.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 // 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/system/buffer.h). 6 // mojo/public/c/system/buffer.h).
7 7
8 #include "mojo/public/c/system/buffer.h" 8 #include "mojo/public/c/system/buffer.h"
9 9
10 #include "mojo/public/c/system/handle.h" 10 #include "mojo/public/c/system/handle.h"
(...skipping 22 matching lines...) Expand all
33 static_cast<uint32_t>(sizeof(buffer_info)))); 33 static_cast<uint32_t>(sizeof(buffer_info))));
34 void* write_pointer = nullptr; 34 void* write_pointer = nullptr;
35 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, 35 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
36 MojoMapBuffer(MOJO_HANDLE_INVALID, 0u, 1u, &write_pointer, 36 MojoMapBuffer(MOJO_HANDLE_INVALID, 0u, 1u, &write_pointer,
37 MOJO_MAP_BUFFER_FLAG_NONE)); 37 MOJO_MAP_BUFFER_FLAG_NONE));
38 // This isn't an "invalid handle" test, but we'll throw it in here anyway 38 // This isn't an "invalid handle" test, but we'll throw it in here anyway
39 // (since it involves a look-up). 39 // (since it involves a look-up).
40 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, MojoUnmapBuffer(nullptr)); 40 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, MojoUnmapBuffer(nullptr));
41 } 41 }
42 42
43 // TODO(ncbray): enable this test once NaCl supports the corresponding APIs. 43 TEST(BufferTest, Basic) {
44 #ifdef __native_client__
45 #define MAYBE_Basic DISABLED_Basic
46 #else
47 #define MAYBE_Basic Basic
48 #endif
49 TEST(BufferTest, MAYBE_Basic) {
50 // Create a shared buffer (|h0|). 44 // Create a shared buffer (|h0|).
51 MojoHandle h0 = MOJO_HANDLE_INVALID; 45 MojoHandle h0 = MOJO_HANDLE_INVALID;
52 EXPECT_EQ(MOJO_RESULT_OK, MojoCreateSharedBuffer(nullptr, 100, &h0)); 46 EXPECT_EQ(MOJO_RESULT_OK, MojoCreateSharedBuffer(nullptr, 100, &h0));
53 EXPECT_NE(h0, MOJO_HANDLE_INVALID); 47 EXPECT_NE(h0, MOJO_HANDLE_INVALID);
54 48
55 // The handle should have the correct rights. 49 // The handle should have the correct rights.
56 MojoHandleRights rights = MOJO_HANDLE_RIGHT_NONE; 50 MojoHandleRights rights = MOJO_HANDLE_RIGHT_NONE;
57 EXPECT_EQ(MOJO_RESULT_OK, MojoGetRights(h0, &rights)); 51 EXPECT_EQ(MOJO_RESULT_OK, MojoGetRights(h0, &rights));
58 EXPECT_EQ(kDefaultSharedBufferHandleRights, rights); 52 EXPECT_EQ(kDefaultSharedBufferHandleRights, rights);
59 53
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 EXPECT_EQ(MOJO_RESULT_PERMISSION_DENIED, MojoDuplicateHandle(h2, &h3)); 122 EXPECT_EQ(MOJO_RESULT_PERMISSION_DENIED, MojoDuplicateHandle(h2, &h3));
129 EXPECT_EQ(MOJO_HANDLE_INVALID, h3); 123 EXPECT_EQ(MOJO_HANDLE_INVALID, h3);
130 124
131 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h1)); 125 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h1));
132 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h2)); 126 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h2));
133 } 127 }
134 128
135 // TODO(vtl): Add multi-threaded tests. 129 // TODO(vtl): Add multi-threaded tests.
136 130
137 } // namespace 131 } // namespace
OLDNEW
« no previous file with comments | « no previous file | mojo/public/c/system/tests/data_pipe_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698