| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 wait API (the functions declared in | 5 // This file tests the C wait API (the functions declared in |
| 6 // mojo/public/c/include/mojo/system/wait.h). | 6 // mojo/public/c/include/mojo/system/wait.h). |
| 7 | 7 |
| 8 #include <mojo/system/wait.h> | 8 #include <mojo/system/wait.h> |
| 9 | 9 |
| 10 #include <mojo/result.h> | 10 #include <mojo/result.h> |
| 11 #include <mojo/system/handle.h> | 11 #include <mojo/system/handle.h> |
| 12 | 12 |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "gtest/gtest.h" |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 TEST(WaitTest, InvalidHandle) { | 17 TEST(WaitTest, InvalidHandle) { |
| 18 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, | 18 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, |
| 19 MojoWait(MOJO_HANDLE_INVALID, ~MOJO_HANDLE_SIGNAL_NONE, 1000000u, | 19 MojoWait(MOJO_HANDLE_INVALID, ~MOJO_HANDLE_SIGNAL_NONE, 1000000u, |
| 20 nullptr)); | 20 nullptr)); |
| 21 | 21 |
| 22 const MojoHandle h = MOJO_HANDLE_INVALID; | 22 const MojoHandle h = MOJO_HANDLE_INVALID; |
| 23 MojoHandleSignals sig = ~MOJO_HANDLE_SIGNAL_NONE; | 23 MojoHandleSignals sig = ~MOJO_HANDLE_SIGNAL_NONE; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 37 uint32_t result_index = static_cast<uint32_t>(-1); | 37 uint32_t result_index = static_cast<uint32_t>(-1); |
| 38 EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, | 38 EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, |
| 39 MojoWaitMany(nullptr, nullptr, 0u, static_cast<MojoDeadline>(1000), | 39 MojoWaitMany(nullptr, nullptr, 0u, static_cast<MojoDeadline>(1000), |
| 40 &result_index, nullptr)); | 40 &result_index, nullptr)); |
| 41 EXPECT_EQ(static_cast<uint32_t>(-1), result_index); | 41 EXPECT_EQ(static_cast<uint32_t>(-1), result_index); |
| 42 } | 42 } |
| 43 | 43 |
| 44 // TODO(vtl): Write tests that actually test waiting. | 44 // TODO(vtl): Write tests that actually test waiting. |
| 45 | 45 |
| 46 } // namespace | 46 } // namespace |
| OLD | NEW |