Update web-platform-tests to revision 2d42384cf21efd71843295d319c1bab85b3acf4a

This commit is contained in:
WPT Sync Bot 2019-01-11 20:32:19 -05:00
parent f2b224d610
commit e851ef0cd2
1014 changed files with 5653 additions and 1590 deletions

View file

@ -11,6 +11,8 @@ const Protocol = {
const ResourceType = {
IMAGE: "image",
FRAME: "frame",
WORKER: "worker",
WORKLET: "worklet",
WEBSOCKET: "websocket",
};
@ -31,6 +33,10 @@ function generateURL(host, protocol, resourceType) {
url.port = {{ports[wss][0]}};
url.protocol = protocol == Protocol.INSECURE ? "ws" : "wss";
url.pathname = "echo";
} else if (resourceType == ResourceType.WORKER) {
url.pathname += "worker.js";
} else if (resourceType == ResourceType.WORKLET) {
url.pathname = "/worklets/resources/empty-worklet-script-with-cors-header.js";
}
return {
name: protocol + "/" + host + " " + resourceType,
@ -38,16 +44,66 @@ function generateURL(host, protocol, resourceType) {
};
}
function generateRedirect(host, protocol, target) {
var url = new URL("http://{{host}}:{{ports[https][0]}}/common/redirect.py?location=" + encodeURIComponent(target.url));
function generateRedirect(host, protocol, finalTest) {
var url = new URL("http://{{host}}:{{ports[https][0]}}/upgrade-insecure-requests/support/redirect-cors.py?location=" + encodeURIComponent(finalTest.url));
url.protocol = protocol == Protocol.INSECURE ? "http" : "https";
url.hostname = host == Host.SAME_ORIGIN ? "{{host}}" : "{{domains[天気の良い日]}}";
return {
name: protocol + "/" + host + " => " + target.name,
name: protocol + "/" + host + " => " + finalTest.name,
url: url.toString()
};
}
function generateDataImport(finalTest) {
return {
name: "data: =(import)=> " + finalTest.name,
url: workerUrlThatImports(finalTest.url)
};
}
function generateTests(target, sameOriginOnly) {
var tests = [];
tests.push(generateURL(Host.SAME_ORIGIN, Protocol.SECURE, target));
tests.push(generateURL(Host.SAME_ORIGIN, Protocol.INSECURE, target));
if (!sameOriginOnly) {
tests.push(generateURL(Host.CROSS_ORIGIN, Protocol.SECURE, target));
tests.push(generateURL(Host.CROSS_ORIGIN, Protocol.INSECURE, target));
}
return tests;
}
function generateRedirectTests(target, sameOriginOnly) {
const finalTests = generateTests(target, sameOriginOnly);
var tests = [];
for (const finalTest of finalTests) {
tests.push(generateRedirect(Host.SAME_ORIGIN, Protocol.SECURE, finalTest));
tests.push(generateRedirect(Host.SAME_ORIGIN, Protocol.INSECURE, finalTest));
if (!sameOriginOnly) {
tests.push(generateRedirect(Host.CROSS_ORIGIN, Protocol.SECURE, finalTest));
tests.push(generateRedirect(Host.CROSS_ORIGIN, Protocol.INSECURE, finalTest));
}
}
return tests;
}
function generateModuleImportTests(target, sameOriginOnly) {
// |sameOriginOnly| is ignored as the top-level URL (generateDataImport())
// is always same-origin (as it is data: URL) and import()ed URLs (URLs in
// finalTests) can be cross-origin.
var finalTests = generateTests(target, false);
finalTests = finalTests.concat(generateRedirectTests(target, false));
var tests = [];
for (const finalTest of finalTests) {
tests.push(generateDataImport(finalTest));
}
return tests;
}
function assert_image_loads(test, url, height, width) {
var i = document.createElement('img');
i.onload = test.step_func_done(_ => {
@ -113,3 +169,42 @@ function assert_websocket_loads(test, url) {
});
w.onclose = test.unreached_func("WebSocket should not close before open is called.");
}
const testMap = {
"image": test => {
async_test(t => assert_image_loads(t, test.url, 64, 168), test.name);
async_test(t => assert_image_loads_in_srcdoc(t, test.url, 64, 168), test.name + " in <iframe srcdoc>");
async_test(t => assert_image_loads_in_blank(t, test.url, 64, 168), test.name + " in <iframe>");
},
"iframe":
test => async_test(t => assert_frame_loads(t, test.url), test.name),
"worker":
test => promise_test(
() => requestViaDedicatedWorker(test.url, {}),
test.name),
"module-worker":
test => promise_test(
() => requestViaDedicatedWorker(test.url, {type: "module"}),
test.name),
"worker-subresource-fetch":
test => promise_test(
() => requestViaDedicatedWorker(dedicatedWorkerUrlThatFetches(test.url),
{}),
test.name),
"audio-worklet":
test => promise_test(
() => requestViaWorklet('audio', test.url), test.name),
"animation-worklet":
test => promise_test(
() => requestViaWorklet('animation', test.url), test.name),
"layout-worklet":
test => promise_test(
() => requestViaWorklet('layout', test.url), test.name),
"paint-worklet":
test => promise_test(
() => requestViaWorklet('paint', test.url), test.name),
};