forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Credentialless]: WPT vs CacheStorage.
Add tentative WPT tests about COEP and CacheStorage. Issues: - COEP:require-corp: w3c/ServiceWorker#1490 - COEP:credentialless: w3c/ServiceWorker#1592 Bug: 1175099 Change-Id: I857adbd134443b17b9689c314307bb1e3888235b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2876191 Commit-Queue: Arthur Sonzogni <[email protected]> Reviewed-by: Antonio Sartori <[email protected]> Reviewed-by: Camille Lamy <[email protected]> Cr-Commit-Position: refs/heads/master@{#880447}
- Loading branch information
1 parent
cc8eead
commit a07d25f
Showing
4 changed files
with
225 additions
and
1 deletion.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
...ml/cross-origin-embedder-policy/credentialless/cache-storage.tentative.https-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
This is a testharness.js-based test. | ||
PASS [document] unsafe-none => unsafe-none | ||
FAIL [document] unsafe-none => credentialless assert_equals: expected "error" but got "retrieved" | ||
PASS [document] unsafe-none => credentialless + CORP | ||
PASS [document] unsafe-none => require-corp | ||
PASS [document] unsafe-none => require-corp + CORP | ||
PASS [document] credentialless => unsafe-none | ||
PASS [document] credentialless => credentialless | ||
PASS [document] credentialless => require-corp | ||
PASS [document] credentialless => require-corp + CORP | ||
PASS [document] require_corp => unsafe-none | ||
PASS [document] require_corp => credentialless | ||
PASS [document] require_corp => require-corp | ||
PASS [dedicated_worker] unsafe-none => unsafe-none | ||
FAIL [dedicated_worker] unsafe-none => credentialless assert_equals: expected "error" but got "retrieved" | ||
PASS [dedicated_worker] unsafe-none => credentialless + CORP | ||
FAIL [dedicated_worker] unsafe-none => require-corp assert_equals: expected "error" but got "retrieved" | ||
PASS [dedicated_worker] unsafe-none => require-corp + CORP | ||
PASS [dedicated_worker] credentialless => unsafe-none | ||
PASS [dedicated_worker] credentialless => credentialless | ||
FAIL [dedicated_worker] credentialless => require-corp assert_equals: expected "error" but got "retrieved" | ||
PASS [dedicated_worker] credentialless => require-corp + CORP | ||
PASS [dedicated_worker] require_corp => unsafe-none | ||
PASS [dedicated_worker] require_corp => credentialless | ||
PASS [dedicated_worker] require_corp => require-corp | ||
PASS [shared_worker] unsafe-none => unsafe-none | ||
FAIL [shared_worker] unsafe-none => credentialless assert_equals: expected "error" but got "retrieved" | ||
PASS [shared_worker] unsafe-none => credentialless + CORP | ||
FAIL [shared_worker] unsafe-none => require-corp assert_equals: expected "error" but got "retrieved" | ||
PASS [shared_worker] unsafe-none => require-corp + CORP | ||
PASS [shared_worker] credentialless => unsafe-none | ||
PASS [shared_worker] credentialless => credentialless | ||
FAIL [shared_worker] credentialless => require-corp assert_equals: expected "error" but got "retrieved" | ||
PASS [shared_worker] credentialless => require-corp + CORP | ||
PASS [shared_worker] require_corp => unsafe-none | ||
PASS [shared_worker] require_corp => credentialless | ||
PASS [shared_worker] require_corp => require-corp | ||
PASS [service_worker] unsafe-none => unsafe-none | ||
FAIL [service_worker] unsafe-none => credentialless assert_equals: expected "error" but got "retrieved" | ||
PASS [service_worker] unsafe-none => credentialless + CORP | ||
PASS [service_worker] unsafe-none => require-corp | ||
PASS [service_worker] unsafe-none => require-corp + CORP | ||
PASS [service_worker] credentialless => unsafe-none | ||
PASS [service_worker] credentialless => credentialless | ||
PASS [service_worker] credentialless => require-corp | ||
PASS [service_worker] credentialless => require-corp + CORP | ||
PASS [service_worker] require_corp => unsafe-none | ||
PASS [service_worker] require_corp => credentialless | ||
PASS [service_worker] require_corp => require-corp | ||
Harness: the test ran to completion. | ||
|
86 changes: 86 additions & 0 deletions
86
...l/wpt/html/cross-origin-embedder-policy/credentialless/cache-storage.tentative.https.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<meta name="timeout" content="long"> | ||
<script src=/resources/testharness.js></script> | ||
<script src=/resources/testharnessreport.js></script> | ||
<script src="/common/get-host-info.sub.js"></script> | ||
<script src="/common/utils.js"></script> | ||
<script src="./resources/common.js"></script> | ||
<script src="./resources/dispatcher.js"></script> | ||
<script> | ||
|
||
// Fetch a resource and store it into CacheStorage from |storer| context. Then | ||
// check if it can be retrieved via CacheStorage.match from |retriever| context. | ||
const cacheStorageTest = ( | ||
description, | ||
storer, | ||
retriever, | ||
resource_headers, | ||
expectation | ||
) => { | ||
promise_test_parallel(async test => { | ||
const cross_origin = get_host_info().HTTPS_REMOTE_ORIGIN; | ||
const url = cross_origin + "/common/square.png?pipe=" + resource_headers + | ||
`&${token()}`; | ||
const this_token = token(); | ||
|
||
// Fetch a request from |stored|. Store the opaque response into | ||
// CacheStorage. | ||
send(storer, ` | ||
const cache = await caches.open("v1"); | ||
const fetch_request = new Request("${url}", {mode: 'no-cors'}); | ||
const fetch_response = await fetch(fetch_request); | ||
await cache.put(fetch_request, fetch_response); | ||
send("${this_token}", "stored"); | ||
`); | ||
assert_equals(await receive(this_token), "stored"); | ||
|
||
// Retrieved it from |retriever|. | ||
send(retriever, ` | ||
const cache = await caches.open("v1"); | ||
try { | ||
const response = await cache.match("${url}"); | ||
send("${this_token}", "retrieved"); | ||
} catch (error) { | ||
send("${this_token}", "error"); | ||
} | ||
`); | ||
assert_equals(await receive(this_token), expectation); | ||
}, description); | ||
}; | ||
|
||
// Execute the same set of tests for every type of execution contexts: | ||
// Documents, DedicatedWorkers, SharedWorkers, and ServiceWorkers. The results | ||
// should be independent of the context. | ||
Object.entries(environments).forEach(([name, constructor]) => { | ||
const context_none = constructor(coep_none); | ||
const context_credentialless = constructor(coep_credentialless); | ||
const context_require_corp = constructor(coep_require_corp); | ||
|
||
cacheStorageTest(`[${name}] unsafe-none => unsafe-none`, | ||
context_none, context_none, "", "retrieved"); | ||
cacheStorageTest(`[${name}] unsafe-none => credentialless`, | ||
context_none, context_credentialless, "", "error"); | ||
cacheStorageTest(`[${name}] unsafe-none => credentialless + CORP`, | ||
context_none, context_credentialless, corp_cross_origin, "retrieved"); | ||
cacheStorageTest(`[${name}] unsafe-none => require-corp`, | ||
context_none, context_require_corp, "", "error"); | ||
cacheStorageTest(`[${name}] unsafe-none => require-corp + CORP`, | ||
context_none, context_require_corp, corp_cross_origin, "retrieved"); | ||
|
||
cacheStorageTest(`[${name}] credentialless => unsafe-none`, | ||
context_credentialless, context_none, "", "retrieved"); | ||
cacheStorageTest(`[${name}] credentialless => credentialless`, | ||
context_credentialless, context_credentialless, "", "retrieved"); | ||
cacheStorageTest(`[${name}] credentialless => require-corp`, | ||
context_credentialless, context_require_corp, "", "error"); | ||
cacheStorageTest(`[${name}] credentialless => require-corp + CORP`, | ||
context_credentialless, context_require_corp, corp_cross_origin, "retrieved"); | ||
|
||
cacheStorageTest(`[${name}] require_corp => unsafe-none`, | ||
context_require_corp, context_none, corp_cross_origin, "retrieved"); | ||
cacheStorageTest(`[${name}] require_corp => credentialless`, | ||
context_require_corp, context_credentialless, corp_cross_origin, "retrieved"); | ||
cacheStorageTest(`[${name}] require_corp => require-corp`, | ||
context_require_corp, context_require_corp, corp_cross_origin, "retrieved"); | ||
}) | ||
|
||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...ml/cross-origin-embedder-policy/credentialless/cache-storage.tentative.https-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
This is a testharness.js-based test. | ||
PASS [document] unsafe-none => unsafe-none | ||
FAIL [document] unsafe-none => credentialless assert_equals: expected "error" but got "retrieved" | ||
PASS [document] unsafe-none => credentialless + CORP | ||
PASS [document] unsafe-none => require-corp | ||
PASS [document] unsafe-none => require-corp + CORP | ||
PASS [document] credentialless => unsafe-none | ||
PASS [document] credentialless => credentialless | ||
PASS [document] credentialless => require-corp | ||
PASS [document] credentialless => require-corp + CORP | ||
PASS [document] require_corp => unsafe-none | ||
PASS [document] require_corp => credentialless | ||
PASS [document] require_corp => require-corp | ||
PASS [dedicated_worker] unsafe-none => unsafe-none | ||
FAIL [dedicated_worker] unsafe-none => credentialless assert_equals: expected "error" but got "retrieved" | ||
PASS [dedicated_worker] unsafe-none => credentialless + CORP | ||
PASS [dedicated_worker] unsafe-none => require-corp | ||
PASS [dedicated_worker] unsafe-none => require-corp + CORP | ||
PASS [dedicated_worker] credentialless => unsafe-none | ||
PASS [dedicated_worker] credentialless => credentialless | ||
PASS [dedicated_worker] credentialless => require-corp | ||
PASS [dedicated_worker] credentialless => require-corp + CORP | ||
PASS [dedicated_worker] require_corp => unsafe-none | ||
PASS [dedicated_worker] require_corp => credentialless | ||
PASS [dedicated_worker] require_corp => require-corp | ||
PASS [shared_worker] unsafe-none => unsafe-none | ||
FAIL [shared_worker] unsafe-none => credentialless assert_equals: expected "error" but got "retrieved" | ||
PASS [shared_worker] unsafe-none => credentialless + CORP | ||
FAIL [shared_worker] unsafe-none => require-corp assert_equals: expected "error" but got "retrieved" | ||
PASS [shared_worker] unsafe-none => require-corp + CORP | ||
PASS [shared_worker] credentialless => unsafe-none | ||
PASS [shared_worker] credentialless => credentialless | ||
FAIL [shared_worker] credentialless => require-corp assert_equals: expected "error" but got "retrieved" | ||
PASS [shared_worker] credentialless => require-corp + CORP | ||
PASS [shared_worker] require_corp => unsafe-none | ||
PASS [shared_worker] require_corp => credentialless | ||
PASS [shared_worker] require_corp => require-corp | ||
PASS [service_worker] unsafe-none => unsafe-none | ||
FAIL [service_worker] unsafe-none => credentialless assert_equals: expected "error" but got "retrieved" | ||
PASS [service_worker] unsafe-none => credentialless + CORP | ||
PASS [service_worker] unsafe-none => require-corp | ||
PASS [service_worker] unsafe-none => require-corp + CORP | ||
PASS [service_worker] credentialless => unsafe-none | ||
PASS [service_worker] credentialless => credentialless | ||
PASS [service_worker] credentialless => require-corp | ||
PASS [service_worker] credentialless => require-corp + CORP | ||
PASS [service_worker] require_corp => unsafe-none | ||
PASS [service_worker] require_corp => credentialless | ||
PASS [service_worker] require_corp => require-corp | ||
Harness: the test ran to completion. | ||
|