mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Update web-platform-tests to revision 4a5223502fa660ce03e470af6a61c8bc26c5a8ee
This commit is contained in:
parent
c5f7c9ccf3
commit
e891345f26
1328 changed files with 36632 additions and 20588 deletions
|
@ -1,34 +1,17 @@
|
|||
// META: script=../resources/utils.js
|
||||
|
||||
function checkFetchResponse(url, method, desc) {
|
||||
if (!desc) {
|
||||
var cut = (url.length >= 40) ? "[...]" : "";
|
||||
cut += " (" + method + ")"
|
||||
desc = "Fetching " + url.substring(0, 40) + cut + " is OK"
|
||||
}
|
||||
function checkNetworkError(url, method) {
|
||||
method = method || "GET";
|
||||
const desc = "Fetching " + url.substring(0, 45) + " with method " + method + " is KO"
|
||||
promise_test(function(test) {
|
||||
return fetch(url, { method: method }).then(function(resp) {
|
||||
assert_equals(resp.status, 200, "HTTP status is 200");
|
||||
assert_equals(resp.type, "basic", "response type is basic");
|
||||
assert_equals(resp.headers.get("Content-Type"), "text/html;charset=utf-8", "Content-Type is " + resp.headers.get("Content-Type"));
|
||||
return resp.text();
|
||||
})
|
||||
}, desc);
|
||||
}
|
||||
|
||||
checkFetchResponse("about:blank", "GET");
|
||||
checkFetchResponse("about:blank", "PUT");
|
||||
checkFetchResponse("about:blank", "POST");
|
||||
|
||||
function checkKoUrl(url, desc) {
|
||||
if (!desc)
|
||||
desc = "Fetching " + url.substring(0, 45) + " is KO"
|
||||
promise_test(function(test) {
|
||||
var promise = fetch(url);
|
||||
var promise = fetch(url, { method: method });
|
||||
return promise_rejects(test, new TypeError(), promise);
|
||||
}, desc);
|
||||
}
|
||||
|
||||
checkKoUrl("about:invalid.com");
|
||||
checkKoUrl("about:config");
|
||||
checkKoUrl("about:unicorn");
|
||||
checkNetworkError("about:blank", "GET");
|
||||
checkNetworkError("about:blank", "PUT");
|
||||
checkNetworkError("about:blank", "POST");
|
||||
checkNetworkError("about:invalid.com");
|
||||
checkNetworkError("about:config");
|
||||
checkNetworkError("about:unicorn");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue