| 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 set API (the functions declared in | 5 // This file tests the C wait set API (the functions declared in |
| 6 // mojo/public/c/include/mojo/system/wait_set.h). | 6 // mojo/public/c/include/mojo/system/wait_set.h). |
| 7 | 7 |
| 8 #include <mojo/system/wait_set.h> | 8 #include <mojo/system/wait_set.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 #include <mojo/system/message_pipe.h> | 12 #include <mojo/system/message_pipe.h> |
| 13 | 13 |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "gtest/gtest.h" |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 const MojoHandleRights kDefaultWaitSetHandleRights = | 18 const MojoHandleRights kDefaultWaitSetHandleRights = |
| 19 MOJO_HANDLE_RIGHT_READ | MOJO_HANDLE_RIGHT_WRITE | | 19 MOJO_HANDLE_RIGHT_READ | MOJO_HANDLE_RIGHT_WRITE | |
| 20 MOJO_HANDLE_RIGHT_GET_OPTIONS | MOJO_HANDLE_RIGHT_SET_OPTIONS; | 20 MOJO_HANDLE_RIGHT_GET_OPTIONS | MOJO_HANDLE_RIGHT_SET_OPTIONS; |
| 21 | 21 |
| 22 TEST(WaitSetTest, InvalidHandle) { | 22 TEST(WaitSetTest, InvalidHandle) { |
| 23 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, | 23 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, |
| 24 MojoWaitSetAdd(MOJO_HANDLE_INVALID, MOJO_HANDLE_INVALID, | 24 MojoWaitSetAdd(MOJO_HANDLE_INVALID, MOJO_HANDLE_INVALID, |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 MOJO_RESULT_CANCELLED, MojoHandleSignalsState())); | 382 MOJO_RESULT_CANCELLED, MojoHandleSignalsState())); |
| 383 } | 383 } |
| 384 | 384 |
| 385 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h)); | 385 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h)); |
| 386 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(mph1)); | 386 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(mph1)); |
| 387 } | 387 } |
| 388 | 388 |
| 389 // TODO(vtl): Add threaded tests, especially those that actually ... wait. | 389 // TODO(vtl): Add threaded tests, especially those that actually ... wait. |
| 390 | 390 |
| 391 } // namespace | 391 } // namespace |
| OLD | NEW |