OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <title>Keyboard lock interface</title> | |
3 <script src="/resources/testharness.js"></script> | |
4 <script src="/resources/testharnessreport.js"></script> | |
5 <script> | |
6 'use strict'; | |
7 | |
8 test(() => { | |
9 // NavigatorKeyboardLock implements both requestKeyLock() and cancelKeyLock() | |
10 // functions; | |
11 assert_true('requestKeyLock' in navigator); | |
12 assert_true('cancelKeyLock' in navigator); | |
13 }, 'Keyboard Lock IDL test'); | |
14 | |
15 promise_test(() => { | |
16 const p1 = navigator.requestKeyLock(['a', 'b']); | |
17 const p2 = navigator.requestKeyLock(['c', 'd']); | |
18 | |
19 return Promise.all([p1, p2]) | |
20 .then(() => { | |
21 assert_true(false, 'requestKeyLock should only be executed if ' + | |
whywhat
2017/04/12 16:02:13
I think you should just use promise_rejects() here
Hzj_jie
2017/04/13 00:38:54
Done.
| |
22 'another request has finished.'); | |
23 }) | |
24 .catch((reason) => {}); | |
25 }, 'Keyboard Lock requestKeyLock twice concurrently test'); | |
26 | |
27 promise_test(() => { | |
28 return navigator.requestKeyLock(['a', 'b']) | |
29 .then(() => {}) | |
30 .catch((reason) => { | |
31 // TODO(zijiehe): The Promise should be resolved once the function has | |
32 // been implemented. | |
33 assert_true(true, 'requestKeyLock should succeed.'); | |
34 }); | |
35 }, 'Keyboard Lock requestKeyLock test'); | |
36 | |
37 promise_test(() => { | |
38 return navigator.requestKeyLock(['a', 'b']) | |
39 .then(() => { | |
40 navigator.requestKeyLock(['c', 'd']) | |
whywhat
2017/04/12 16:02:13
I'm not sure this is a correct usage of promise_te
Hzj_jie
2017/04/13 00:38:54
Yes, I was a little bit confusing about the async_
| |
41 .then(() => {}) | |
42 .catch((reason) => { | |
43 // TODO(zijiehe): The Promise should be resolved once the function | |
44 // has been implemented. | |
45 assert_true(true, 'requestKeyLock should succeed.'); | |
46 }); | |
47 }) | |
48 .catch((reason) => { | |
49 // TODO(zijiehe): The Promise should be resolved once the function has | |
50 // been implemented. | |
51 assert_true(true, 'requestKeyLock should succeed.'); | |
52 }); | |
53 }, 'Keyboard Lock requestKeyLock twice sequentially test'); | |
54 | |
55 test(() => { | |
56 navigator.cancelKeyLock(); | |
57 }, 'Keyboard Lock cancelKeyLock test'); | |
58 | |
59 </script> | |
OLD | NEW |