Skip to content

Commit

Permalink
wpt: update scheme-blob.sub.any.js (#1731)
Browse files Browse the repository at this point in the history
  • Loading branch information
KhafraDev committed Oct 26, 2022
1 parent f13ecaf commit 3d7de94
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
6 changes: 0 additions & 6 deletions test/wpt/status/fetch.status.json
Expand Up @@ -46,12 +46,6 @@
"Object.prototype.highWaterMark accessor returning invalid value should not affect stream creation by 'fetch'"
]
},
"scheme-blob.sub.any.js": {
"fail": [
"Set content type to the empty string for slice with invalid content type",
"Set content type to the empty string for slice with no content type "
]
},
"header-value-combining.any.js": {
"fail": [
"response.headers.get('content-length') expects 0, 0",
Expand Down
17 changes: 9 additions & 8 deletions test/wpt/tests/fetch/api/basic/scheme-blob.sub.any.js
Expand Up @@ -75,31 +75,32 @@ let xml_blob_no_type = new Blob([simple_xml_string]);
checkFetchResponse(URL.createObjectURL(xml_blob_no_type), simple_xml_string, "", 45,
"Blob content is not sniffed for a content type [text/xml]");

let simple_text_string = 'Hello, World!';
promise_test(function(test) {
let blob = new Blob([], {"type": "text/plain"});
let slice = blob.slice(8, 25, "\0");
let blob = new Blob([simple_text_string], {"type": "text/plain"});
let slice = blob.slice(7, simple_text_string.length, "\0");
return fetch(URL.createObjectURL(slice)).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"), "");
assert_equals(resp.headers.get("Content-Length"), "17");
assert_equals(resp.headers.get("Content-Length"), "6");
return resp.text();
}).then(function(bodyAsText) {
assert_equals(bodyAsText, "type with invalid");
assert_equals(bodyAsText, "World!");
});
}, "Set content type to the empty string for slice with invalid content type");

promise_test(function(test) {
let blob = new Blob([], {"type": "text/plain"});
let slice = blob.slice(8, 20);
let blob = new Blob([simple_text_string], {"type": "text/plain"});
let slice = blob.slice(7, simple_text_string.length, "\0");
return fetch(URL.createObjectURL(slice)).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"), "");
assert_equals(resp.headers.get("Content-Length"), "12");
assert_equals(resp.headers.get("Content-Length"), "6");
return resp.text();
}).then(function(bodyAsText) {
assert_equals(bodyAsText, "type that is");
assert_equals(bodyAsText, "World!");
});
}, "Set content type to the empty string for slice with no content type ");

Expand Down

0 comments on commit 3d7de94

Please sign in to comment.