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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/cpp/system/tests/handle_signals_state_unittest.cc
diff --git a/mojo/public/cpp/system/tests/handle_signals_state_unittest.cc b/mojo/public/cpp/system/tests/handle_signals_state_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..82f538e17a3aea426d23e3ad89043c19af00a952
--- /dev/null
+++ b/mojo/public/cpp/system/tests/handle_signals_state_unittest.cc
@@ -0,0 +1,42 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/public/cpp/system/handle_signals_state.h"
+
+#include "mojo/public/c/system/types.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace mojo {
+namespace {
+
+using HandleSignalsStateTest = testing::Test;
+
+TEST_F(HandleSignalsStateTest, SanityCheck) {
+ // There's not much to test here. Just a quick sanity check to make sure the
+ // code compiles and the helper methods do what they're supposed to do.
+
+ HandleSignalsState empty_signals(MOJO_HANDLE_SIGNAL_NONE,
+ MOJO_HANDLE_SIGNAL_NONE);
+ EXPECT_FALSE(empty_signals.readable());
+ EXPECT_FALSE(empty_signals.writable());
+ EXPECT_FALSE(empty_signals.peer_closed());
+ EXPECT_TRUE(empty_signals.never_readable());
+ EXPECT_TRUE(empty_signals.never_writable());
+ EXPECT_TRUE(empty_signals.never_peer_closed());
+
+ HandleSignalsState all_signals(
+ MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE |
+ MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+ MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE |
+ MOJO_HANDLE_SIGNAL_PEER_CLOSED);
+ EXPECT_TRUE(all_signals.readable());
+ EXPECT_TRUE(all_signals.writable());
+ EXPECT_TRUE(all_signals.peer_closed());
+ EXPECT_FALSE(all_signals.never_readable());
+ EXPECT_FALSE(all_signals.never_writable());
+ EXPECT_FALSE(all_signals.never_peer_closed());
+}
+
+} // namespace
+} // namespace mojo
« 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