mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Update web-platform-tests to revision b'0802d8bd01e17178d9cd2355e6fbaf3c098e7953'
This commit is contained in:
parent
aa427dd412
commit
9ed042224a
254 changed files with 10823 additions and 1484 deletions
|
@ -9,83 +9,55 @@ function processQueryParams() {
|
|||
};
|
||||
}
|
||||
|
||||
function RunTestsInIFrame(sourceURL) {
|
||||
let frame = document.createElement('iframe');
|
||||
frame.src = sourceURL;
|
||||
let result = new Promise((resolve, reject) => {
|
||||
function CreateFrameAndRunTests(setUpFrame) {
|
||||
const frame = document.createElement('iframe');
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
frame.onload = resolve;
|
||||
frame.onerror = reject;
|
||||
});
|
||||
document.body.appendChild(frame);
|
||||
|
||||
setUpFrame(frame);
|
||||
|
||||
fetch_tests_from_window(frame.contentWindow);
|
||||
return result;
|
||||
return promise;
|
||||
}
|
||||
|
||||
function RunTestsInIFrame(sourceURL) {
|
||||
return CreateFrameAndRunTests((frame) => {
|
||||
frame.src = sourceURL;
|
||||
document.body.appendChild(frame);
|
||||
});
|
||||
}
|
||||
|
||||
function RunTestsInNestedIFrame(sourceURL) {
|
||||
let nestedFrame = document.createElement('iframe');
|
||||
document.body.appendChild(nestedFrame);
|
||||
let result = new Promise((resolve, reject) => {
|
||||
nestedFrame.onload = resolve;
|
||||
nestedFrame.onerror = reject;
|
||||
return CreateFrameAndRunTests((frame) => {
|
||||
document.body.appendChild(frame);
|
||||
frame.contentDocument.write(`
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="helpers.js"></script>
|
||||
<body>
|
||||
<script>
|
||||
RunTestsInIFrame("${sourceURL}");
|
||||
</script>
|
||||
`);
|
||||
frame.contentDocument.close();
|
||||
});
|
||||
let content = `
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="helpers.js"></script>
|
||||
<body>
|
||||
<script>
|
||||
RunTestsInIFrame("${sourceURL}");
|
||||
</sc` + `ript>
|
||||
`;
|
||||
|
||||
nestedFrame.contentDocument.write(content);
|
||||
nestedFrame.contentDocument.close();
|
||||
fetch_tests_from_window(nestedFrame.contentWindow);
|
||||
return result;
|
||||
}
|
||||
|
||||
function RunRequestStorageAccessInDetachedFrame() {
|
||||
let nestedFrame = document.createElement('iframe');
|
||||
document.body.append(nestedFrame);
|
||||
const inner_doc = nestedFrame.contentDocument;
|
||||
nestedFrame.remove();
|
||||
const frame = document.createElement('iframe');
|
||||
document.body.append(frame);
|
||||
const inner_doc = frame.contentDocument;
|
||||
frame.remove();
|
||||
return inner_doc.requestStorageAccess();
|
||||
}
|
||||
|
||||
function RunRequestStorageAccessViaDomParser() {
|
||||
let parser = new DOMParser();
|
||||
let doc = parser.parseFromString('<html></html>', 'text/html');
|
||||
const parser = new DOMParser();
|
||||
const doc = parser.parseFromString('<html></html>', 'text/html');
|
||||
return doc.requestStorageAccess();
|
||||
}
|
||||
|
||||
async function RunCallbackWithGesture(buttonId, callback) {
|
||||
// Append some formatting and information so non WebDriver instances can complete this test too.
|
||||
const info = document.createElement('p');
|
||||
info.innerText = "This test case requires user-interaction and TestDriver. If you're running it manually please click the 'Request Access' button below exactly once.";
|
||||
document.body.appendChild(info);
|
||||
|
||||
const button = document.createElement('button');
|
||||
button.innerText = "Request Access";
|
||||
button.id = buttonId;
|
||||
button.style = "background-color:#FF0000;"
|
||||
|
||||
// Insert the button and use test driver to click the button with a gesture.
|
||||
document.body.appendChild(button);
|
||||
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
const wrappedCallback = () => {
|
||||
callback().then(resolve, reject);
|
||||
};
|
||||
|
||||
// In automated tests, we call the callback via test_driver.
|
||||
test_driver.bless('run callback with user interaction', wrappedCallback);
|
||||
|
||||
// But we still allow the button to trigger the callback, for use on
|
||||
// https://wpt.live.
|
||||
button.addEventListener('click', e => {
|
||||
wrappedCallback();
|
||||
button.style = "background-color:#00FF00;"
|
||||
}, {once: true});
|
||||
});
|
||||
|
||||
return {promise};
|
||||
function RunCallbackWithGesture(callback) {
|
||||
return test_driver.bless('run callback with user gesture', callback);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue