Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(370)

Side by Side Diff: mojo/public/c/tests/system/wait_unittest.cc

Issue 2250183003: Make the fuchsia mojo/public repo the source of truth. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/public/c/tests/system/wait_set_unittest.cc ('k') | mojo/public/cpp/PRESUBMIT.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 // This file tests the C wait API (the functions declared in
6 // mojo/public/c/include/mojo/system/wait.h).
7
8 #include <mojo/system/wait.h>
9
10 #include <mojo/result.h>
11 #include <mojo/system/handle.h>
12
13 #include "gtest/gtest.h"
14
15 namespace {
16
17 TEST(WaitTest, InvalidHandle) {
18 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
19 MojoWait(MOJO_HANDLE_INVALID, ~MOJO_HANDLE_SIGNAL_NONE, 1000000u,
20 nullptr));
21
22 const MojoHandle h = MOJO_HANDLE_INVALID;
23 MojoHandleSignals sig = ~MOJO_HANDLE_SIGNAL_NONE;
24 EXPECT_EQ(
25 MOJO_RESULT_INVALID_ARGUMENT,
26 MojoWaitMany(&h, &sig, 1u, MOJO_DEADLINE_INDEFINITE, nullptr, nullptr));
27 }
28
29 TEST(WaitTest, WaitManyNoHandles) {
30 EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED,
31 MojoWaitMany(nullptr, nullptr, 0u, static_cast<MojoDeadline>(0),
32 nullptr, nullptr));
33
34 // The |result_index| argument is optional, so make sure it doesn't touch it
35 // even if it's non-null.
36 // TODO(vtl): The same is true for the |signals_states| argument.
37 uint32_t result_index = static_cast<uint32_t>(-1);
38 EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED,
39 MojoWaitMany(nullptr, nullptr, 0u, static_cast<MojoDeadline>(1000),
40 &result_index, nullptr));
41 EXPECT_EQ(static_cast<uint32_t>(-1), result_index);
42 }
43
44 // TODO(vtl): Write tests that actually test waiting.
45
46 } // namespace
OLDNEW
« no previous file with comments | « mojo/public/c/tests/system/wait_set_unittest.cc ('k') | mojo/public/cpp/PRESUBMIT.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698