Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/external/wpt/keyboard-lock/idl-KeyboardLock.html |
| diff --git a/third_party/WebKit/LayoutTests/external/wpt/keyboard-lock/idl-KeyboardLock.html b/third_party/WebKit/LayoutTests/external/wpt/keyboard-lock/idl-KeyboardLock.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..08fda36d82234d411c18373fe277243dfec2b96b |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/external/wpt/keyboard-lock/idl-KeyboardLock.html |
| @@ -0,0 +1,54 @@ |
| +<!DOCTYPE html> |
| +<title>Keyboard lock interface</title> |
|
whywhat
2017/04/13 02:34:36
nit: It's common to keep each test case in a singl
Hzj_jie
2017/04/13 22:24:25
Oh, I misunderstood your meaning: in content_brows
|
| +<script src="/resources/testharness.js"></script> |
| +<script src="/resources/testharnessreport.js"></script> |
| +<script> |
| +'use strict'; |
| + |
| +test(() => { |
| + // NavigatorKeyboardLock implements both requestKeyLock() and cancelKeyLock() |
| + // functions; |
| + assert_true('requestKeyLock' in navigator); |
|
whywhat
2017/04/13 02:34:36
nit: you can add checks that these are both functi
Hzj_jie
2017/04/13 22:24:25
Done.
|
| + assert_true('cancelKeyLock' in navigator); |
| +}, 'Keyboard Lock IDL test'); |
| + |
| +promise_test((t) => { |
| + const p1 = navigator.requestKeyLock(['a', 'b']); |
| + const p2 = navigator.requestKeyLock(['c', 'd']); |
| + |
| + return p1.then(() => { |
| + promise_rejects(t, null, p2, |
|
whywhat
2017/04/13 02:34:36
I tried your cl locally. If I change the Navigator
Hzj_jie
2017/04/13 22:24:25
This is out of my expectation: Promise.then() retu
whywhat
2017/04/13 22:40:24
Ack. Maybe returning promise_rejects() is all it t
|
| + 'requestKeyLock() should only be ' + |
| + 'executed if another request has finished.'); |
| + }).catch((reason) => { |
| + assert_true(false, 'The first request should be allowed.'); |
| + }); |
| +}, 'Keyboard Lock requestKeyLock twice concurrently test'); |
| + |
| +promise_test(() => { |
| + return navigator.requestKeyLock(['a', 'b']) |
| + .then(() => {}) |
| + .catch((reason) => { |
| + assert_true(false, 'requestKeyLock should succeed.'); |
| + }); |
| +}, 'Keyboard Lock requestKeyLock test'); |
| + |
| +promise_test(() => { |
| + return navigator.requestKeyLock(['a', 'b']) |
|
whywhat
2017/04/13 02:34:36
This test still passes if I comment all the rest o
Hzj_jie
2017/04/13 22:24:25
After some investigations, the behavior of promise
whywhat
2017/04/13 22:40:24
Yeah, I was wondering that chaining should work. G
|
| + .then(() => { |
| + navigator.requestKeyLock(['c', 'd']) |
| + .then(() => {}) |
| + .catch((reason) => { |
| + assert_true(false, 'requestKeyLock should succeed.'); |
| + }); |
| + }) |
| + .catch((reason) => { |
| + assert_true(false, 'requestKeyLock should succeed.'); |
| + }); |
| +}, 'Keyboard Lock requestKeyLock twice sequentially test'); |
| + |
| +test(() => { |
| + navigator.cancelKeyLock(); |
| +}, 'Keyboard Lock cancelKeyLock test'); |
| + |
| +</script> |