| OLD | NEW |
| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 } | 76 } |
| 77 | 77 |
| 78 TEST(CoreTest, BasicMessagePipe) { | 78 TEST(CoreTest, BasicMessagePipe) { |
| 79 MojoHandle h0, h1; | 79 MojoHandle h0, h1; |
| 80 MojoWaitFlags wf; | 80 MojoWaitFlags wf; |
| 81 char buffer[10] = { 0 }; | 81 char buffer[10] = { 0 }; |
| 82 uint32_t buffer_size; | 82 uint32_t buffer_size; |
| 83 | 83 |
| 84 h0 = MOJO_HANDLE_INVALID; | 84 h0 = MOJO_HANDLE_INVALID; |
| 85 h1 = MOJO_HANDLE_INVALID; | 85 h1 = MOJO_HANDLE_INVALID; |
| 86 EXPECT_EQ(MOJO_RESULT_OK, MojoCreateMessagePipe(&h0, &h1)); | 86 EXPECT_EQ(MOJO_RESULT_OK, MojoCreateMessagePipe(NULL, &h0, &h1)); |
| 87 EXPECT_NE(h0, MOJO_HANDLE_INVALID); | 87 EXPECT_NE(h0, MOJO_HANDLE_INVALID); |
| 88 EXPECT_NE(h1, MOJO_HANDLE_INVALID); | 88 EXPECT_NE(h1, MOJO_HANDLE_INVALID); |
| 89 | 89 |
| 90 // Shouldn't be readable. | 90 // Shouldn't be readable. |
| 91 EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, | 91 EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, |
| 92 MojoWait(h0, MOJO_WAIT_FLAG_READABLE, 0)); | 92 MojoWait(h0, MOJO_WAIT_FLAG_READABLE, 0)); |
| 93 | 93 |
| 94 // Should be writable. | 94 // Should be writable. |
| 95 EXPECT_EQ(MOJO_RESULT_OK, MojoWait(h0, MOJO_WAIT_FLAG_WRITABLE, 0)); | 95 EXPECT_EQ(MOJO_RESULT_OK, MojoWait(h0, MOJO_WAIT_FLAG_WRITABLE, 0)); |
| 96 | 96 |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 // This checks that things actually work in C (not C++). | 275 // This checks that things actually work in C (not C++). |
| 276 TEST(CoreTest, MinimalCTest) { | 276 TEST(CoreTest, MinimalCTest) { |
| 277 const char* failure = MinimalCTest(); | 277 const char* failure = MinimalCTest(); |
| 278 EXPECT_TRUE(failure == NULL) << failure; | 278 EXPECT_TRUE(failure == NULL) << failure; |
| 279 } | 279 } |
| 280 | 280 |
| 281 // TODO(vtl): Add multi-threaded tests. | 281 // TODO(vtl): Add multi-threaded tests. |
| 282 | 282 |
| 283 } // namespace | 283 } // namespace |
| 284 } // namespace mojo | 284 } // namespace mojo |
| OLD | NEW |