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..c0c195d439f13d7499ea0f9fd867da9604676100 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/external/wpt/keyboard-lock/idl-KeyboardLock.html |
@@ -0,0 +1,59 @@ |
+<!DOCTYPE html> |
+<title>Keyboard lock interface</title> |
+<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); |
+ assert_true('cancelKeyLock' in navigator); |
+}, 'Keyboard Lock IDL test'); |
+ |
+promise_test(() => { |
+ const p1 = navigator.requestKeyLock(['a', 'b']); |
+ const p2 = navigator.requestKeyLock(['c', 'd']); |
+ |
+ return Promise.all([p1, p2]) |
+ .then(() => { |
+ 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.
|
+ 'another request has finished.'); |
+ }) |
+ .catch((reason) => {}); |
+}, 'Keyboard Lock requestKeyLock twice concurrently test'); |
+ |
+promise_test(() => { |
+ return navigator.requestKeyLock(['a', 'b']) |
+ .then(() => {}) |
+ .catch((reason) => { |
+ // TODO(zijiehe): The Promise should be resolved once the function has |
+ // been implemented. |
+ assert_true(true, 'requestKeyLock should succeed.'); |
+ }); |
+}, 'Keyboard Lock requestKeyLock test'); |
+ |
+promise_test(() => { |
+ return navigator.requestKeyLock(['a', 'b']) |
+ .then(() => { |
+ 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_
|
+ .then(() => {}) |
+ .catch((reason) => { |
+ // TODO(zijiehe): The Promise should be resolved once the function |
+ // has been implemented. |
+ assert_true(true, 'requestKeyLock should succeed.'); |
+ }); |
+ }) |
+ .catch((reason) => { |
+ // TODO(zijiehe): The Promise should be resolved once the function has |
+ // been implemented. |
+ assert_true(true, 'requestKeyLock should succeed.'); |
+ }); |
+}, 'Keyboard Lock requestKeyLock twice sequentially test'); |
+ |
+test(() => { |
+ navigator.cancelKeyLock(); |
+}, 'Keyboard Lock cancelKeyLock test'); |
+ |
+</script> |