| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifdef __cplusplus | 5 #ifdef __cplusplus |
| 6 #error "This file should be compiled as C, not C++." | 6 #error "This file should be compiled as C, not C++." |
| 7 #endif | 7 #endif |
| 8 | 8 |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| 11 | 11 |
| 12 // Include all the header files that are meant to be compilable as C. Start with | 12 // Include all the header files that are meant to be compilable as C. Start with |
| 13 // core.h, since it's the most important one. | 13 // core.h, since it's the most important one. |
| 14 #include "mojo/public/system/core.h" | 14 #include "mojo/public/c/system/core.h" |
| 15 #include "mojo/public/system/async_waiter.h" | 15 #include "mojo/public/c/system/async_waiter.h" |
| 16 #include "mojo/public/system/macros.h" | 16 #include "mojo/public/c/system/macros.h" |
| 17 | 17 |
| 18 // The joys of the C preprocessor.... | 18 // The joys of the C preprocessor.... |
| 19 #define STRINGIFY(x) #x | 19 #define STRINGIFY(x) #x |
| 20 #define STRINGIFY2(x) STRINGIFY(x) | 20 #define STRINGIFY2(x) STRINGIFY(x) |
| 21 #define FAILURE(message) \ | 21 #define FAILURE(message) \ |
| 22 __FILE__ "(" STRINGIFY2(__LINE__) "): Failure: " message | 22 __FILE__ "(" STRINGIFY2(__LINE__) "): Failure: " message |
| 23 | 23 |
| 24 // Poor man's gtest. | 24 // Poor man's gtest. |
| 25 #define EXPECT_EQ(a, b) \ | 25 #define EXPECT_EQ(a, b) \ |
| 26 do { \ | 26 do { \ |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 EXPECT_EQ((uint32_t) sizeof(kHello), num_bytes); | 79 EXPECT_EQ((uint32_t) sizeof(kHello), num_bytes); |
| 80 EXPECT_EQ(0, memcmp(buffer, kHello, sizeof(kHello))); | 80 EXPECT_EQ(0, memcmp(buffer, kHello, sizeof(kHello))); |
| 81 | 81 |
| 82 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(handle0)); | 82 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(handle0)); |
| 83 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(handle1)); | 83 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(handle1)); |
| 84 | 84 |
| 85 // TODO(vtl): data pipe | 85 // TODO(vtl): data pipe |
| 86 | 86 |
| 87 return NULL; | 87 return NULL; |
| 88 } | 88 } |
| OLD | NEW |