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

Unified Diff: mojo/public/c/system/tests/core_unittest_pure_c.c

Issue 774673003: Added MojoNewWait and MojoNewWaitMany, along with unit tests. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Handled review comments, collapsed duplicate test code Created 6 years 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/c/system/tests/core_unittest_pure_c.c
diff --git a/mojo/public/c/system/tests/core_unittest_pure_c.c b/mojo/public/c/system/tests/core_unittest_pure_c.c
index 33de6883f9654b3e5fb59863a826d7acb83d8fea..2dbf4dfe1d610b8e39a0ee5605266fac8fb68613 100644
--- a/mojo/public/c/system/tests/core_unittest_pure_c.c
+++ b/mojo/public/c/system/tests/core_unittest_pure_c.c
@@ -61,8 +61,15 @@ const char* MinimalCTest(void) {
EXPECT_EQ(MOJO_RESULT_OK, MojoCreateMessagePipe(NULL, &handle0, &handle1));
signals = MOJO_HANDLE_SIGNAL_READABLE;
+ uint32_t result_index;
viettrungluu 2014/12/02 23:57:34 "
+ struct MojoHandleSignalsState states[1];
EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED,
- MojoWaitMany(&handle0, &signals, 1, 1));
+ MojoNewWaitMany(&handle0, &signals, 1, 1, &result_index, states));
+
+ EXPECT_EQ(0u, result_index);
+ EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, states[0].satisfied_signals);
+ EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
+ states[0].satisfiable_signals);
EXPECT_EQ(MOJO_RESULT_OK,
MojoWriteMessage(handle0,
@@ -72,9 +79,16 @@ const char* MinimalCTest(void) {
0u,
MOJO_WRITE_DATA_FLAG_NONE));
+ struct MojoHandleSignalsState state;
EXPECT_EQ(
MOJO_RESULT_OK,
- MojoWait(handle1, MOJO_HANDLE_SIGNAL_READABLE, MOJO_DEADLINE_INDEFINITE));
+ MojoNewWait(handle1, MOJO_HANDLE_SIGNAL_READABLE,
+ MOJO_DEADLINE_INDEFINITE, &state));
+
+ EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
+ state.satisfied_signals);
+ EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
+ state.satisfiable_signals);
num_bytes = (uint32_t)sizeof(buffer);
EXPECT_EQ(MOJO_RESULT_OK,

Powered by Google App Engine
This is Rietveld 408576698