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

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

Issue 220113003: Mojo: Implement MojoUnmapBuffer(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 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 | Annotate | Revision Log
« no previous file with comments | « mojo/mojo.gyp ('k') | mojo/system/constants.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 API. 5 // This file tests the C API.
6 6
7 #include "mojo/public/c/system/core.h" 7 #include "mojo/public/c/system/core.h"
8 8
9 #include <string.h> 9 #include <string.h>
10 10
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 EXPECT_EQ(MOJO_RESULT_OK, MojoDuplicateBufferHandle(h0, NULL, &h1)); 244 EXPECT_EQ(MOJO_RESULT_OK, MojoDuplicateBufferHandle(h0, NULL, &h1));
245 EXPECT_NE(h1, MOJO_HANDLE_INVALID); 245 EXPECT_NE(h1, MOJO_HANDLE_INVALID);
246 246
247 // Close |h0|. 247 // Close |h0|.
248 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h0)); 248 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h0));
249 249
250 // The mapping should still be good. 250 // The mapping should still be good.
251 static_cast<char*>(pointer)[51] = 'y'; 251 static_cast<char*>(pointer)[51] = 'y';
252 252
253 // Unmap it. 253 // Unmap it.
254 // TODO(vtl): Not yet implemented. 254 EXPECT_EQ(MOJO_RESULT_OK, MojoUnmapBuffer(pointer));
255 EXPECT_EQ(MOJO_RESULT_UNIMPLEMENTED, MojoUnmapBuffer(pointer));
256 255
257 // Map half of |h1|. 256 // Map half of |h1|.
258 pointer = NULL; 257 pointer = NULL;
259 EXPECT_EQ(MOJO_RESULT_OK, 258 EXPECT_EQ(MOJO_RESULT_OK,
260 MojoMapBuffer(h1, 50, 50, &pointer, MOJO_MAP_BUFFER_FLAG_NONE)); 259 MojoMapBuffer(h1, 50, 50, &pointer, MOJO_MAP_BUFFER_FLAG_NONE));
261 ASSERT_TRUE(pointer); 260 ASSERT_TRUE(pointer);
262 261
263 // It should have what we wrote. 262 // It should have what we wrote.
264 EXPECT_EQ('x', static_cast<char*>(pointer)[0]); 263 EXPECT_EQ('x', static_cast<char*>(pointer)[0]);
265 EXPECT_EQ('y', static_cast<char*>(pointer)[1]); 264 EXPECT_EQ('y', static_cast<char*>(pointer)[1]);
266 265
267 // Unmap it. 266 // Unmap it.
268 // TODO(vtl): Not yet implemented. 267 EXPECT_EQ(MOJO_RESULT_OK, MojoUnmapBuffer(pointer));
269 EXPECT_EQ(MOJO_RESULT_UNIMPLEMENTED, MojoUnmapBuffer(pointer));
270 268
271 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h1)); 269 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h1));
272 } 270 }
273 271
274 // Defined in core_unittest_pure_c.c. 272 // Defined in core_unittest_pure_c.c.
275 extern "C" const char* MinimalCTest(void); 273 extern "C" const char* MinimalCTest(void);
276 274
277 // This checks that things actually work in C (not C++). 275 // This checks that things actually work in C (not C++).
278 TEST(CoreTest, MinimalCTest) { 276 TEST(CoreTest, MinimalCTest) {
279 const char* failure = MinimalCTest(); 277 const char* failure = MinimalCTest();
280 EXPECT_TRUE(failure == NULL) << failure; 278 EXPECT_TRUE(failure == NULL) << failure;
281 } 279 }
282 280
283 // TODO(vtl): Add multi-threaded tests. 281 // TODO(vtl): Add multi-threaded tests.
284 282
285 } // namespace 283 } // namespace
286 } // namespace mojo 284 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/mojo.gyp ('k') | mojo/system/constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698