Commit 949b045d authored by Chromium WPT Sync's avatar Chromium WPT Sync Committed by Chromium LUCI CQ

Import wpt@680c091ae63ef3963c0cb8d19f8ec8070bc17bc0

Using wpt-import in Chromium 8d7ce656.

Note to sheriffs: This CL imports external tests and adds
expectations for those tests; if this CL is large and causes
a few new failures, please fix the failures by adding new
lines to TestExpectations rather than reverting. See:
https://chromium.googlesource.com/chromium/src/+/master/docs/testing/web_platform_tests.md

Directory owners for changes in this CL:
binji@chromium.org:
  external/wpt/wasm
jsbell@chromium.org:
  external/wpt/service-workers/cache-storage
yhirano@chromium.org, mkwst@chromium.org, japhet@chromium.org:
  external/wpt/fetch

NOAUTOREVERT=true
TBR=robertma@google.com

No-Export: true
Cq-Include-Trybots: luci.chromium.try:linux-wpt-identity-fyi-rel,linux-wpt-input-fyi-rel
Change-Id: Ib6cf2e6dcfdceab26112360fbf4a7fb91170b103
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2624867Reviewed-by: default avatarWPT Autoroller <wpt-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Commit-Queue: WPT Autoroller <wpt-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Cr-Commit-Position: refs/heads/master@{#842645}
parent f0167398
This is a testharness.js-based test.
FAIL Request: overriding explicit Content-Type assert_equals: expected "test/test" but got "text/plain"
FAIL Response: overriding explicit Content-Type assert_equals: expected "test/test" but got "text/plain"
FAIL Request: removing implicit Content-Type assert_equals: expected "" but got "application/x-www-form-urlencoded;charset=utf-8"
FAIL Response: removing implicit Content-Type assert_equals: expected "" but got "application/x-www-form-urlencoded;charset=utf-8"
FAIL Request: setting missing Content-Type assert_equals: expected "test/test" but got ""
FAIL Response: setting missing Content-Type assert_equals: expected "test/test" but got ""
Harness: the test ran to completion.
[
() => new Request("about:blank", { headers: { "Content-Type": "text/plain" } }),
() => new Response("", { headers: { "Content-Type": "text/plain" } })
].forEach(bodyContainerCreator => {
const bodyContainer = bodyContainerCreator();
promise_test(async t => {
assert_equals(bodyContainer.headers.get("Content-Type"), "text/plain");
const newMIMEType = "test/test";
bodyContainer.headers.set("Content-Type", newMIMEType);
const blob = await bodyContainer.blob();
assert_equals(blob.type, newMIMEType);
}, `${bodyContainer.constructor.name}: overriding explicit Content-Type`);
});
[
() => new Request("about:blank", { body: new URLSearchParams(), method: "POST" }),
() => new Response(new URLSearchParams()),
].forEach(bodyContainerCreator => {
const bodyContainer = bodyContainerCreator();
promise_test(async t => {
assert_equals(bodyContainer.headers.get("Content-Type"), "application/x-www-form-urlencoded;charset=UTF-8");
bodyContainer.headers.delete("Content-Type");
const blob = await bodyContainer.blob();
assert_equals(blob.type, "");
}, `${bodyContainer.constructor.name}: removing implicit Content-Type`);
});
[
() => new Request("about:blank", { body: new ArrayBuffer(), method: "POST" }),
() => new Response(new ArrayBuffer()),
].forEach(bodyContainerCreator => {
const bodyContainer = bodyContainerCreator();
promise_test(async t => {
assert_equals(bodyContainer.headers.get("Content-Type"), null);
const newMIMEType = "test/test";
bodyContainer.headers.set("Content-Type", newMIMEType);
const blob = await bodyContainer.blob();
assert_equals(blob.type, newMIMEType);
}, `${bodyContainer.constructor.name}: setting missing Content-Type`);
});
This is a testharness.js-based test.
FAIL Request: overriding explicit Content-Type assert_equals: expected "test/test" but got "text/plain"
FAIL Response: overriding explicit Content-Type assert_equals: expected "test/test" but got "text/plain"
FAIL Request: removing implicit Content-Type assert_equals: expected "" but got "application/x-www-form-urlencoded;charset=utf-8"
FAIL Response: removing implicit Content-Type assert_equals: expected "" but got "application/x-www-form-urlencoded;charset=utf-8"
FAIL Request: setting missing Content-Type assert_equals: expected "test/test" but got ""
FAIL Response: setting missing Content-Type assert_equals: expected "test/test" but got ""
Harness: the test ran to completion.
...@@ -381,6 +381,7 @@ cache_test(async (cache) => { ...@@ -381,6 +381,7 @@ cache_test(async (cache) => {
cache_test(async (cache) => { cache_test(async (cache) => {
const url = '/dummy'; const url = '/dummy';
const original_type = 'text/html'; const original_type = 'text/html';
const override_type = 'text/plain';
const init_with_headers = { const init_with_headers = {
headers: { headers: {
'content-type': original_type 'content-type': original_type
...@@ -394,24 +395,22 @@ cache_test(async (cache) => { ...@@ -394,24 +395,22 @@ cache_test(async (cache) => {
assert_true(original_response_type.includes(original_type), assert_true(original_response_type.includes(original_type),
'original response should include the expected mime type'); 'original response should include the expected mime type');
// Verify overwriting the content-type header does not change the mime // Verify overwriting the content-type header changes the mime type.
// type. It should be fixed at Response construction time.
const overwritten_response = new Response('hello world', init_with_headers); const overwritten_response = new Response('hello world', init_with_headers);
overwritten_response.headers.set('content-type', 'text/plain'); overwritten_response.headers.set('content-type', override_type);
const overwritten_response_type = (await overwritten_response.blob()).type; const overwritten_response_type = (await overwritten_response.blob()).type;
assert_equals(overwritten_response_type, original_response_type, assert_equals(overwritten_response_type, override_type,
'original and overwritten response mime types should match'); 'mime type can be overridden');
// Verify the Response read from Cache uses the original mime type // Verify the Response read from Cache uses the original mime type
// computed when it was first constructed. // computed when it was first constructed.
const tmp = new Response('hello world', init_with_headers); const tmp = new Response('hello world', init_with_headers);
tmp.headers.set('content-type', 'text/plain'); tmp.headers.set('content-type', override_type);
await cache.put(url, tmp); await cache.put(url, tmp);
const cache_response = await cache.match(url); const cache_response = await cache.match(url);
const cache_mime_type = (await cache_response.blob()).type; const cache_mime_type = (await cache_response.blob()).type;
assert_equals(cache_mime_type, original_response_type, assert_equals(cache_mime_type, override_type,
'original and cached overwritten response mime types ' + 'overwritten and cached response mime types should match');
'should match'); }, 'MIME type should reflect Content-Type headers of response.');
}, 'MIME type should be frozen at response construction.');
done(); done();
This is a testharness.js-based test.
PASS Cache.match
PASS Cache.match with no matching entries
PASS Cache.match with URL
PASS Cache.match with Request
PASS Cache.match with multiple cache hits
PASS Cache.match with new Request
PASS Cache.match with HEAD
PASS Cache.match with ignoreSearch option (request with no search parameters)
PASS Cache.match with ignoreSearch option (request with search parameter)
PASS Cache.match supports ignoreMethod
PASS Cache.match supports ignoreVary
PASS Cache.match does not support cacheName option
PASS Cache.match with URL containing fragment
PASS Cache.match with string fragment "http" as query
PASS Cache.match with responses containing "Vary" header
PASS Cache.match with Request and Response objects with different URLs
PASS Cache.match invoked multiple times for the same Request/Response
PASS Cache.match blob should be sliceable
PASS Cache.match with POST Request
PASS Cache.match with a non-2xx Response
PASS Cache.match with a network error Response
PASS Cache produces large Responses that can be cloned and read correctly.
PASS cors-exposed header should be stored correctly.
PASS MIME type should be set from content-header correctly.
FAIL MIME type should reflect Content-Type headers of response. assert_equals: mime type can be overridden expected "text/plain" but got "text/html"
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS Cache.match with no matching entries
PASS Cache.match with URL
PASS Cache.match with Request
PASS Cache.match with multiple cache hits
PASS Cache.match with new Request
PASS Cache.match with HEAD
PASS Cache.match with ignoreSearch option (request with no search parameters)
PASS Cache.match with ignoreSearch option (request with search parameter)
PASS Cache.match supports ignoreMethod
PASS Cache.match supports ignoreVary
PASS Cache.match does not support cacheName option
PASS Cache.match with URL containing fragment
PASS Cache.match with string fragment "http" as query
PASS Cache.match with responses containing "Vary" header
PASS Cache.match with Request and Response objects with different URLs
PASS Cache.match invoked multiple times for the same Request/Response
PASS Cache.match blob should be sliceable
PASS Cache.match with POST Request
PASS Cache.match with a non-2xx Response
PASS Cache.match with a network error Response
PASS Cache produces large Responses that can be cloned and read correctly.
PASS cors-exposed header should be stored correctly.
PASS MIME type should be set from content-header correctly.
FAIL MIME type should reflect Content-Type headers of response. assert_equals: mime type can be overridden expected "text/plain" but got "text/html"
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS Cache.match with no matching entries
PASS Cache.match with URL
PASS Cache.match with Request
PASS Cache.match with multiple cache hits
PASS Cache.match with new Request
PASS Cache.match with HEAD
PASS Cache.match with ignoreSearch option (request with no search parameters)
PASS Cache.match with ignoreSearch option (request with search parameter)
PASS Cache.match supports ignoreMethod
PASS Cache.match supports ignoreVary
PASS Cache.match does not support cacheName option
PASS Cache.match with URL containing fragment
PASS Cache.match with string fragment "http" as query
PASS Cache.match with responses containing "Vary" header
PASS Cache.match with Request and Response objects with different URLs
PASS Cache.match invoked multiple times for the same Request/Response
PASS Cache.match blob should be sliceable
PASS Cache.match with POST Request
PASS Cache.match with a non-2xx Response
PASS Cache.match with a network error Response
PASS Cache produces large Responses that can be cloned and read correctly.
PASS cors-exposed header should be stored correctly.
PASS MIME type should be set from content-header correctly.
FAIL MIME type should reflect Content-Type headers of response. assert_equals: mime type can be overridden expected "text/plain" but got "text/html"
Harness: the test ran to completion.
// META: global=window,worker
// META: script=/wasm/jsapi/wasm-module-builder.js
["compileStreaming", "instantiateStreaming"].forEach(method => {
promise_test(async t => {
const buffer = new WasmModuleBuilder().toBuffer();
const argument = new Response(buffer, { headers: { "Content-Type": "test/test" } });
argument.headers.set("Content-Type", "application/wasm");
// This should resolve successfully
await WebAssembly[method](argument);
// Ensure body can only be read once
return promise_rejects_js(t, TypeError, argument.blob());
}, `${method} with Content-Type set late`);
promise_test(async t => {
const buffer = new WasmModuleBuilder().toBuffer();
const argument = new Response(buffer, { headers: { "Content-Type": "application/wasm" } });
argument.headers.delete("Content-Type");
// Ensure Wasm cannot be created
await promise_rejects_js(t, TypeError, WebAssembly[method](argument));
// This should resolve successfully
await argument.arrayBuffer();
}, `${method} with Content-Type removed late`);
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment