Update web-platform-tests to revision 10168e9a5d44efbc6e7d416d1d454eb9c9f1396c

This commit is contained in:
Josh Matthews 2018-01-31 09:13:41 -05:00
parent c88dc51d03
commit 0e1caebaf4
791 changed files with 23381 additions and 5501 deletions

View file

@ -0,0 +1,20 @@
promise_test(() => fetch("resources/data-urls.json").then(res => res.json()).then(runDataURLTests), "Setup.");
function runDataURLTests(tests) {
for(let i = 0; i < tests.length; i++) {
const input = tests[i][0],
expectedMimeType = tests[i][1],
expectedBody = expectedMimeType !== null ? tests[i][2] : null;
promise_test(t => {
if(expectedMimeType === null) {
return promise_rejects(t, new TypeError(), fetch(input));
} else {
return fetch(input).then(res => {
return res.arrayBuffer().then(body => {
assert_array_equals(new Uint8Array(body), expectedBody);
assert_equals(res.headers.get("content-type"), expectedMimeType); // We could assert this earlier, but this fails often
});
});
}
}, format_value(input));
}
}