| 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/system/core.h" | 7 #include "mojo/public/system/core.h" |
| 8 | 8 |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 | 10 |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 12 |
| 13 namespace mojo { | 13 namespace mojo { |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 TEST(SystemTest, GetTimeTicksNow) { | 16 TEST(CoreTest, GetTimeTicksNow) { |
| 17 const MojoTimeTicks start = MojoGetTimeTicksNow(); | 17 const MojoTimeTicks start = MojoGetTimeTicksNow(); |
| 18 EXPECT_NE(static_cast<MojoTimeTicks>(0), start) | 18 EXPECT_NE(static_cast<MojoTimeTicks>(0), start) |
| 19 << "MojoGetTimeTicksNow should return nonzero value"; | 19 << "MojoGetTimeTicksNow should return nonzero value"; |
| 20 } | 20 } |
| 21 | 21 |
| 22 TEST(SystemTest, Basic) { | 22 TEST(CoreTest, Basic) { |
| 23 MojoHandle h_0; | 23 MojoHandle h_0; |
| 24 MojoWaitFlags wf; | 24 MojoWaitFlags wf; |
| 25 char buffer[10] = { 0 }; | 25 char buffer[10] = { 0 }; |
| 26 uint32_t buffer_size; | 26 uint32_t buffer_size; |
| 27 | 27 |
| 28 // The only handle that's guaranteed to be invalid is |MOJO_HANDLE_INVALID|. | 28 // The only handle that's guaranteed to be invalid is |MOJO_HANDLE_INVALID|. |
| 29 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, MojoClose(MOJO_HANDLE_INVALID)); | 29 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, MojoClose(MOJO_HANDLE_INVALID)); |
| 30 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, | 30 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, |
| 31 MojoWait(MOJO_HANDLE_INVALID, MOJO_WAIT_FLAG_EVERYTHING, 1000000)); | 31 MojoWait(MOJO_HANDLE_INVALID, MOJO_WAIT_FLAG_EVERYTHING, 1000000)); |
| 32 h_0 = MOJO_HANDLE_INVALID; | 32 h_0 = MOJO_HANDLE_INVALID; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 MOJO_WAIT_FLAG_READABLE | MOJO_WAIT_FLAG_WRITABLE, | 102 MOJO_WAIT_FLAG_READABLE | MOJO_WAIT_FLAG_WRITABLE, |
| 103 1000)); | 103 1000)); |
| 104 | 104 |
| 105 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h_1)); | 105 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h_1)); |
| 106 } | 106 } |
| 107 | 107 |
| 108 // TODO(vtl): Add multi-threaded tests. | 108 // TODO(vtl): Add multi-threaded tests. |
| 109 | 109 |
| 110 } // namespace | 110 } // namespace |
| 111 } // namespace mojo | 111 } // namespace mojo |
| OLD | NEW |