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

Side by Side Diff: mojo/public/cpp/system/tests/handle_signals_state_unittest.cc

Issue 2741033003: Mojo EDK: Introduce MojoQueryHandleSignalsState API (Closed)
Patch Set: fix stupid bad DCHECK Created 3 years, 9 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
OLDNEW
(Empty)
1 // Copyright 2017 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 #include "mojo/public/cpp/system/handle_signals_state.h"
6
7 #include "mojo/public/c/system/types.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9
10 namespace mojo {
11 namespace {
12
13 using HandleSignalsStateTest = testing::Test;
14
15 TEST_F(HandleSignalsStateTest, SanityCheck) {
16 // There's not much to test here. Just a quick sanity check to make sure the
17 // code compiles and the helper methods do what they're supposed to do.
18
19 HandleSignalsState empty_signals(MOJO_HANDLE_SIGNAL_NONE,
20 MOJO_HANDLE_SIGNAL_NONE);
21 EXPECT_FALSE(empty_signals.readable());
22 EXPECT_FALSE(empty_signals.writable());
23 EXPECT_FALSE(empty_signals.peer_closed());
24 EXPECT_TRUE(empty_signals.never_readable());
25 EXPECT_TRUE(empty_signals.never_writable());
26 EXPECT_TRUE(empty_signals.never_peer_closed());
27
28 HandleSignalsState all_signals(
29 MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE |
30 MOJO_HANDLE_SIGNAL_PEER_CLOSED,
31 MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE |
32 MOJO_HANDLE_SIGNAL_PEER_CLOSED);
33 EXPECT_TRUE(all_signals.readable());
34 EXPECT_TRUE(all_signals.writable());
35 EXPECT_TRUE(all_signals.peer_closed());
36 EXPECT_FALSE(all_signals.never_readable());
37 EXPECT_FALSE(all_signals.never_writable());
38 EXPECT_FALSE(all_signals.never_peer_closed());
39 }
40
41 } // namespace
42 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/system/tests/BUILD.gn ('k') | mojo/public/java/system/src/org/chromium/mojo/system/Core.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698