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

Unified Diff: mojo/edk/system/core_unittest.cc

Issue 795593004: Update mojo sdk to rev cc531b32182099a5a034a99daff35ed5d38a61c8 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More workarounds for MSVC 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
« no previous file with comments | « mojo/edk/system/core_test_base.cc ('k') | mojo/edk/system/endpoint_relayer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/core_unittest.cc
diff --git a/mojo/edk/system/core_unittest.cc b/mojo/edk/system/core_unittest.cc
index d7976a313dbfa970a44bec0e66cda8272538fd6b..b78930110bcbaafcbd1ff8c27d7fd0e1cc6f8b10 100644
--- a/mojo/edk/system/core_unittest.cc
+++ b/mojo/edk/system/core_unittest.cc
@@ -8,8 +8,10 @@
#include <limits>
+#include "base/bind.h"
#include "base/threading/platform_thread.h"
#include "base/time/time.h"
+#include "mojo/edk/system/awakable.h"
#include "mojo/edk/system/core_test_base.h"
namespace mojo {
@@ -1276,6 +1278,38 @@ TEST_F(CoreTest, MessagePipeBasicLocalHandlePassing2) {
EXPECT_EQ(MOJO_RESULT_OK, core()->Close(ch));
}
+struct TestAsyncWaiter {
+ TestAsyncWaiter() : result(MOJO_RESULT_UNKNOWN) {}
+
+ void Awake(MojoResult r) { result = r; }
+
+ MojoResult result;
+};
+
+TEST_F(CoreTest, AsyncWait) {
+ TestAsyncWaiter waiter;
+ MockHandleInfo info;
+ MojoHandle h = CreateMockHandle(&info);
+
+ EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
+ core()->AsyncWait(h, MOJO_HANDLE_SIGNAL_READABLE,
+ base::Bind(&TestAsyncWaiter::Awake,
+ base::Unretained(&waiter))));
+ EXPECT_EQ(0u, info.GetAddedAwakableSize());
+
+ info.AllowAddAwakable(true);
+ EXPECT_EQ(MOJO_RESULT_OK,
+ core()->AsyncWait(h, MOJO_HANDLE_SIGNAL_READABLE,
+ base::Bind(&TestAsyncWaiter::Awake,
+ base::Unretained(&waiter))));
+ EXPECT_EQ(1u, info.GetAddedAwakableSize());
+
+ EXPECT_FALSE(info.GetAddedAwakableAt(0)->Awake(MOJO_RESULT_BUSY, 0));
+ EXPECT_EQ(MOJO_RESULT_BUSY, waiter.result);
+
+ EXPECT_EQ(MOJO_RESULT_OK, core()->Close(h));
+}
+
// TODO(vtl): Test |DuplicateBufferHandle()| and |MapBuffer()|.
} // namespace
« no previous file with comments | « mojo/edk/system/core_test_base.cc ('k') | mojo/edk/system/endpoint_relayer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698