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

Side by Side Diff: third_party/WebKit/LayoutTests/mojo/watch.html

Issue 2400563002: Adds Mojo IDL. (Closed)
Patch Set: uses WebTaskRunner Created 3 years, 10 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 <!DOCTYPE html>
2 <title>mojo watch tests</title>
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5 <script>
6
7 async_test((test) => {
8 let {handle0, handle1} = Mojo.createMessagePipe();
9
10 handle0.watch({readable: true}, test.step_func_done((result) => {
11 assert_equals(result, Mojo.RESULT_OK);
12 }));
13 handle1.writeMessage(new ArrayBuffer(4), []);
14 }, "Watch handle readable");
15
16 async_test((test) => {
17 let {handle0, handle1} = Mojo.createMessagePipe();
18
19 handle0.watch({writable: true}, test.step_func_done((result) => {
20 assert_equals(result, Mojo.RESULT_OK);
21 }));
22 }, "Watch handle writable");
23
24 async_test((test) => {
25 let {handle0, handle1} = Mojo.createMessagePipe();
26
27 handle0.watch({peerClosed: true}, test.step_func_done((result) => {
28 assert_equals(result, Mojo.RESULT_OK);
29 }));
30 handle1.close();
31 }, "Watch handle peer closed");
32
33 async_test((test) => {
34 let {handle0, handle1} = Mojo.createMessagePipe();
35
36 handle0.close();
37 handle0.watch({writable: true}, test.step_func_done((result) => {
38 assert_equals(result, Mojo.RESULT_INVALID_ARGUMENT);
39 }));
40 }, "Watch invalid handle");
41
42 async_test((test) => {
43 let {handle0, handle1} = Mojo.createMessagePipe();
44
45 handle0.watch({}, test.step_func_done((result) => {
46 assert_equals(result, Mojo.RESULT_FAILED_PRECONDITION);
47 }));
48 }, "Watch with default MojoHandleSignals");
49
50 async_test((test) => {
51 let {handle0, handle1} = Mojo.createMessagePipe();
52
53 let watcher = handle0.watch(
54 {writable: true},
55 test.unreached_func("callback triggered after canceling watch"));
56 watcher.cancel();
57 setTimeout(() => { test.done(); });
58 }, "Cancel watch");
59
60 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698