mirror of
https://github.com/servo/servo.git
synced 2025-09-04 12:08:21 +01:00
Update web-platform-tests to revision 9d009fc59a8f99e0117b841b7f49094cc690964c
This commit is contained in:
parent
42701e5588
commit
75857a918c
33 changed files with 645 additions and 127 deletions
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
promise_test((t) => {
|
||||
const p1 = navigator.keyboard.getLayoutMap();
|
||||
const p2 = navigator.keyboard.getLayoutMap();
|
||||
// p1 and p2 should be the same promise instance.
|
||||
assert_equals(p1, p2);
|
||||
return Promise.all([p1, p2]);
|
||||
}, '[Keyboard Map] getLayoutMap() twice in parallel');
|
||||
|
||||
</script>
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/cors/support.js?pipe=sub"></script>
|
||||
<body>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
promise_test(() => {
|
||||
let iframe = document.createElement('iframe');
|
||||
iframe.src = CROSSDOMAIN + 'resources/iframe-keyboard-map-helper.html';
|
||||
iframe.onload = () => {
|
||||
iframe.contentWindow.postMessage('Ready', '*');
|
||||
}
|
||||
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
return new Promise((resolve,reject) => {
|
||||
window.onmessage = message => {
|
||||
if (message.data == 'Success') {
|
||||
resolve();
|
||||
} else if (message.data == 'Failure') {
|
||||
reject();
|
||||
}
|
||||
}
|
||||
});
|
||||
}, '[Keyboard Map] getLayoutMap() blocked from within cross-origin iframe');
|
||||
|
||||
</script>
|
|
@ -0,0 +1,28 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<body>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
promise_test(() => {
|
||||
let iframe = document.createElement('iframe');
|
||||
iframe.src = 'resources/iframe-keyboard-map-helper.html';
|
||||
iframe.onload = () => {
|
||||
iframe.contentWindow.postMessage('Ready', '*');
|
||||
}
|
||||
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
return new Promise((resolve,reject) => {
|
||||
window.onmessage = message => {
|
||||
if (message.data == 'Success') {
|
||||
resolve();
|
||||
} else if (message.data == 'Failure') {
|
||||
reject();
|
||||
}
|
||||
}
|
||||
});
|
||||
}, '[Keyboard Map] getLayoutMap() blocked from within iframe');
|
||||
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
promise_test((t) => {
|
||||
const p1 = navigator.keyboard.getLayoutMap();
|
||||
const p2 = navigator.keyboard.getLayoutMap();
|
||||
// p1 and p2 should be the same promise instance.
|
||||
assert_equals(p1, p2);
|
||||
return Promise.all([p1, p2]);
|
||||
}, '[Keyboard Map] getLayoutMap() twice in parallel');
|
||||
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
promise_test(() => {
|
||||
return navigator.keyboard.getLayoutMap()
|
||||
.then(() => {
|
||||
return navigator.keyboard.getLayoutMap();
|
||||
});
|
||||
}, '[Keyboard Map] getLayoutMap() called twice sequentially');
|
||||
|
||||
</script>
|
|
@ -13,7 +13,11 @@ test(function() {
|
|||
assert_equals(navigator.keyboard, navigator.keyboard);
|
||||
}, "navigator.keyboard SameObject");
|
||||
|
||||
promise_test(function() {
|
||||
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) {
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
window.onmessage = message => {
|
||||
if (message.data === 'Ready') {
|
||||
let onSuccess = () => { parent.postMessage('Failure', '*'); };
|
||||
let onError = error => {
|
||||
if (error.name == 'InvalidStateError') {
|
||||
parent.postMessage('Success', '*');
|
||||
} else {
|
||||
parent.postMessage('Failure', '*');
|
||||
}
|
||||
};
|
||||
|
||||
navigator.keyboard.getLayoutMap().then(onSuccess, onError);
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue