| 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 #include "mojo/public/system/core.h" | 5 #include "mojo/public/system/core.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "mojo/public/tests/test_support.h" | |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 10 |
| 12 namespace mojo { | 11 namespace mojo { |
| 13 namespace { | 12 namespace { |
| 14 | 13 |
| 15 class SystemTest : public test::TestBase { | 14 class SystemTest : public testing::Test { |
| 16 }; | 15 }; |
| 17 | 16 |
| 18 TEST_F(SystemTest, Basic) { | 17 TEST_F(SystemTest, Basic) { |
| 19 Handle h_0; | 18 Handle h_0; |
| 20 MojoWaitFlags wf; | 19 MojoWaitFlags wf; |
| 21 char buffer[10] = { 0 }; | 20 char buffer[10] = { 0 }; |
| 22 uint32_t buffer_size; | 21 uint32_t buffer_size; |
| 23 | 22 |
| 24 // The only handle that's guaranteed to be invalid is |kInvalidHandle|. | 23 // The only handle that's guaranteed to be invalid is |kInvalidHandle|. |
| 25 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, Close(kInvalidHandle)); | 24 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, Close(kInvalidHandle)); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, | 95 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, |
| 97 Wait(h_1, MOJO_WAIT_FLAG_READABLE | MOJO_WAIT_FLAG_WRITABLE, 1000)); | 96 Wait(h_1, MOJO_WAIT_FLAG_READABLE | MOJO_WAIT_FLAG_WRITABLE, 1000)); |
| 98 | 97 |
| 99 EXPECT_EQ(MOJO_RESULT_OK, Close(h_1)); | 98 EXPECT_EQ(MOJO_RESULT_OK, Close(h_1)); |
| 100 } | 99 } |
| 101 | 100 |
| 102 // TODO(vtl): Add multi-threaded tests. | 101 // TODO(vtl): Add multi-threaded tests. |
| 103 | 102 |
| 104 } // namespace | 103 } // namespace |
| 105 } // namespace mojo | 104 } // namespace mojo |
| OLD | NEW |