mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-10 21:28:04 +02:00
Automatic update from web-platform-tests[KeyboardMap] Blink module now handles iFrames and multiple calls This CL adds the following: - KeyboardMap now requires the caller to be a top-level, secure browsing context - Multiple calls to getKeyboardLayout() will now be given the same promise instead of it being timing dependent (the initial promise might get overwritten with the old logic) - Sequential calls to getKeyboardLayout() still get their own promise - All promise rejections will return a DOM exception (similar to KeyboardLock) - I've cleaned up KeyboardLock a bit as well so it has similar logic/formatting to what I added to KeyboardMap - Added several tests to KeyboardMap and fixed some failing cases BUG=832811 Change-Id: I4a03f68c239cff42b8840e9513257384038f04b4 Reviewed-on: https://chromium-review.googlesource.com/1093474 Commit-Queue: Joe Downing <joedow@chromium.org> Reviewed-by: Gary Kacmarcik <garykac@chromium.org> Cr-Commit-Position: refs/heads/master@{#565833} -- wpt-commits: 4565dc5875f3841b0884bdfd8ad6b9ad6f4a5944 wpt-pr: 11440
34 lines
1.1 KiB
HTML
34 lines
1.1 KiB
HTML
<!DOCTYPE html>
|
|
<meta charset="utf-8">
|
|
<title>Keyboard Map basic tests</title>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script>
|
|
|
|
test(function() {
|
|
assert_true(navigator.keyboard instanceof Keyboard);
|
|
}, "navigator.keyboard instanceof Keyboard");
|
|
|
|
test(function() {
|
|
assert_equals(navigator.keyboard, navigator.keyboard);
|
|
}, "navigator.keyboard SameObject");
|
|
|
|
test(function() {
|
|
assert_true(navigator.keyboard.getLayoutMap instanceof Function);
|
|
}, "navigator.keyboard.getLayoutMap instanceof Function");
|
|
|
|
promise_test(() => {
|
|
const p = navigator.keyboard.getLayoutMap();
|
|
assert_true(p instanceof Promise);
|
|
return p.then(function(map) {
|
|
assert_true(map instanceof KeyboardLayoutMap);
|
|
for (var [k,v] of map) {
|
|
assert_true(typeof k === 'string');
|
|
assert_true(k.length != 0);
|
|
assert_true(typeof v === 'string');
|
|
assert_true(v.length != 0);
|
|
}
|
|
});
|
|
}, "navigator.keyboard.getLayoutMap() returns a Promise<KeyboardLayoutMap> when successful");
|
|
|
|
</script>
|