mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Update web-platform-tests to revision ac16628eb7eb601957382053011363d2bcf8ce44
This commit is contained in:
parent
ea7e753cea
commit
7e7c8873e4
4408 changed files with 664787 additions and 857286 deletions
|
@ -1,11 +1,12 @@
|
|||
// META: script=../resources/utils.js
|
||||
|
||||
function testUpload(desc, url, method, createBody, expectedBody) {
|
||||
var requestInit = {"method": method}
|
||||
const requestInit = {"method": method}
|
||||
promise_test(function(test){
|
||||
let body = createBody();
|
||||
if (body)
|
||||
const body = createBody();
|
||||
if (body) {
|
||||
requestInit["body"] = body;
|
||||
}
|
||||
return fetch(url, requestInit).then(function(resp) {
|
||||
return resp.text().then((text)=> {
|
||||
assert_equals(text, expectedBody);
|
||||
|
@ -16,15 +17,16 @@ function testUpload(desc, url, method, createBody, expectedBody) {
|
|||
|
||||
function testUploadFailure(desc, url, method, createBody) {
|
||||
const requestInit = {"method": method};
|
||||
promise_test(test => {
|
||||
let body = createBody();
|
||||
if (body)
|
||||
promise_test(t => {
|
||||
const body = createBody();
|
||||
if (body) {
|
||||
requestInit["body"] = body;
|
||||
return promise_rejects(new TypeError(), fetch(url, requestInit));
|
||||
}
|
||||
return promise_rejects_js(t, TypeError, fetch(url, requestInit));
|
||||
}, desc);
|
||||
}
|
||||
|
||||
var url = RESOURCES_DIR + "echo-content.py"
|
||||
const url = RESOURCES_DIR + "echo-content.py"
|
||||
|
||||
testUpload("Fetch with PUT with body", url,
|
||||
"PUT",
|
||||
|
@ -73,7 +75,7 @@ testUpload("Fetch with POST with Blob body with mime type", url,
|
|||
testUpload("Fetch with POST with ReadableStream", url,
|
||||
"POST",
|
||||
() => {
|
||||
new ReadableStream({start: controller => {
|
||||
return new ReadableStream({start: controller => {
|
||||
const encoder = new TextEncoder();
|
||||
controller.enqueue(encoder.encode("Test"));
|
||||
controller.close();
|
||||
|
@ -83,7 +85,7 @@ testUpload("Fetch with POST with ReadableStream", url,
|
|||
testUploadFailure("Fetch with POST with ReadableStream containing String", url,
|
||||
"POST",
|
||||
() => {
|
||||
new ReadableStream({start: controller => {
|
||||
return new ReadableStream({start: controller => {
|
||||
controller.enqueue("Test");
|
||||
controller.close();
|
||||
}})
|
||||
|
@ -91,7 +93,7 @@ testUploadFailure("Fetch with POST with ReadableStream containing String", url,
|
|||
testUploadFailure("Fetch with POST with ReadableStream containing null", url,
|
||||
"POST",
|
||||
() => {
|
||||
new ReadableStream({start: controller => {
|
||||
return new ReadableStream({start: controller => {
|
||||
controller.enqueue(null);
|
||||
controller.close();
|
||||
}})
|
||||
|
@ -99,7 +101,7 @@ testUploadFailure("Fetch with POST with ReadableStream containing null", url,
|
|||
testUploadFailure("Fetch with POST with ReadableStream containing number", url,
|
||||
"POST",
|
||||
() => {
|
||||
new ReadableStream({start: controller => {
|
||||
return new ReadableStream({start: controller => {
|
||||
controller.enqueue(99);
|
||||
controller.close();
|
||||
}})
|
||||
|
@ -107,7 +109,7 @@ testUploadFailure("Fetch with POST with ReadableStream containing number", url,
|
|||
testUploadFailure("Fetch with POST with ReadableStream containing ArrayBuffer", url,
|
||||
"POST",
|
||||
() => {
|
||||
new ReadableStream({start: controller => {
|
||||
return new ReadableStream({start: controller => {
|
||||
controller.enqueue(new ArrayBuffer());
|
||||
controller.close();
|
||||
}})
|
||||
|
@ -115,7 +117,7 @@ testUploadFailure("Fetch with POST with ReadableStream containing ArrayBuffer",
|
|||
testUploadFailure("Fetch with POST with ReadableStream containing Blob", url,
|
||||
"POST",
|
||||
() => {
|
||||
new ReadableStream({start: controller => {
|
||||
return new ReadableStream({start: controller => {
|
||||
controller.enqueue(new Blob());
|
||||
controller.close();
|
||||
}})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue