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