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

Unified Diff: mojo/public/c/system/tests/wait_unittest.cc

Issue 2110103002: Make MojoWaitMany() accept zero handles. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « mojo/edk/system/core_unittest.cc ('k') | mojo/public/c/system/wait.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/c/system/tests/wait_unittest.cc
diff --git a/mojo/public/c/system/tests/wait_unittest.cc b/mojo/public/c/system/tests/wait_unittest.cc
index 541043e08106ad5db78121be3f038b9e16180fd0..9eba943bd9185592a06560970f983b0d014b70c3 100644
--- a/mojo/public/c/system/tests/wait_unittest.cc
+++ b/mojo/public/c/system/tests/wait_unittest.cc
@@ -25,6 +25,21 @@ TEST(WaitTest, InvalidHandle) {
MojoWaitMany(&h, &sig, 1u, MOJO_DEADLINE_INDEFINITE, nullptr, nullptr));
}
+TEST(WaitTest, WaitManyNoHandles) {
+ EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED,
+ MojoWaitMany(nullptr, nullptr, 0u, static_cast<MojoDeadline>(0),
+ nullptr, nullptr));
+
+ // The |result_index| argument is optional, so make sure it doesn't touch it
+ // even if it's non-null.
+ // TODO(vtl): The same is true for the |signals_states| argument.
+ uint32_t result_index = static_cast<uint32_t>(-1);
+ EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED,
+ MojoWaitMany(nullptr, nullptr, 0u, static_cast<MojoDeadline>(1000),
+ &result_index, nullptr));
+ EXPECT_EQ(static_cast<uint32_t>(-1), result_index);
+}
+
// TODO(vtl): Write tests that actually test waiting.
} // namespace
« no previous file with comments | « mojo/edk/system/core_unittest.cc ('k') | mojo/public/c/system/wait.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698