forked from web-platform-tests/wpt
-
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.
Move COOP parsing tests to the dispatcher. (web-platform-tests#33909)
Similar to what was done for other COOP tests in https://chromium-review.googlesource.com/c/chromium/src/+/3593078 Tests use a complex postMessage flow today, that can be replaced by simple and more readable code using dispatcher.js Bug: 1318373 Change-Id: I0e5f261ded77fbf07a25f2f45380d4e9522e7934 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3620319 Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org> Commit-Queue: Arthur Hemery <ahemery@chromium.org> Cr-Commit-Position: refs/heads/main@{#999403} Co-authored-by: Arthur Hemery <ahemery@chromium.org>
- Loading branch information
Showing
7 changed files
with
165 additions
and
52 deletions.
There are no files selected for viewing
85 changes: 85 additions & 0 deletions
85
html/cross-origin-opener-policy/header-parsing-failures.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,85 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<meta name=timeout content=long> | ||
<script src=/resources/testharness.js></script> | ||
<script src=/resources/testharnessreport.js></script> | ||
<script src="/common/dispatcher/dispatcher.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/popup-test.js"></script> | ||
<script> | ||
|
||
[ | ||
// None of the following should be recognized as "same-origin" (hence the | ||
// preserved opener). | ||
{ | ||
"title": "coop with semi-column", | ||
"coop": "same-origin;", | ||
}, | ||
{ | ||
"title": "coop with vertical tab", | ||
"coop": "\u000bsame-origin\u000b", | ||
}, | ||
{ | ||
"title": "coop with form feed", | ||
"coop": "\u000csame-origin\u000c", | ||
}, | ||
{ | ||
"title": "coop with carriage return", | ||
"coop": "\u000dsame-origin\u000d", | ||
}, | ||
{ | ||
"title": "coop with capital letter", | ||
"coop": "Same-origin", | ||
}, | ||
{ | ||
"title": "coop with bad structured header 1", | ||
"coop": "same-origin;\tfoo=bar", | ||
}, | ||
{ | ||
"title": "coop with bad structured header 2", | ||
"coop": "same-origin ;foo=bar", | ||
}, | ||
{ | ||
"title": "coop with bad structured header 3", | ||
"coop": "same-origin; foo=bar;", | ||
}, | ||
{ | ||
"title": "coop as a structured header 'string' item", | ||
"coop": "\"same-origin\"", | ||
}, | ||
{ | ||
"title": "coop as a structured header 'byte sequence' item", | ||
"coop": ":c2FtZS1vcmlnaW4=:", | ||
}, | ||
{ | ||
"title": "coop as a structured header 'boolean' item", | ||
"coop": "?1", | ||
}, | ||
{ | ||
"title": "coop as a structured header 'integer or decimal' item", | ||
"coop": "1", | ||
}, | ||
{ | ||
"title": "coop as an unrecognized structured header type", | ||
"coop": "$same-origin", | ||
}, | ||
{ | ||
"title": "coop with duplicate value", | ||
"coop": "same-origin same-origin", | ||
}, | ||
{ | ||
// Note: comma must be escaped here to not mess with the WPT pipe function. | ||
"title": "coop with duplicate value, separated by a comma", | ||
"coop": "same-origin\\,same-origin", | ||
}, | ||
{ | ||
"title": "coop with preceding asterisk character", | ||
"coop": "*same-origin ", | ||
} | ||
].forEach(variant => { | ||
popup_test(`Parsing ${variant.title}`, SAME_ORIGIN, variant.coop, "preserved"); | ||
}); | ||
|
||
</script> |
17 changes: 17 additions & 0 deletions
17
html/cross-origin-opener-policy/header-parsing-non-ascii.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,17 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<script src=/resources/testharness.js></script> | ||
<script src=/resources/testharnessreport.js></script> | ||
<script src="/common/dispatcher/dispatcher.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/popup-test.js"></script> | ||
<script> | ||
popup_test( | ||
`Simple document with non-ascii COOP header opening a same-origin popup`, | ||
SAME_ORIGIN, | ||
"unsafe-none", | ||
"preserved"); | ||
</script> | ||
|
1 change: 1 addition & 0 deletions
1
html/cross-origin-opener-policy/header-parsing-non-ascii.https.html.headers
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 @@ | ||
Cross-Origin-Opener-Policy: same%FForigin |
16 changes: 16 additions & 0 deletions
16
html/cross-origin-opener-policy/header-parsing-repeated.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,16 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<script src=/resources/testharness.js></script> | ||
<script src=/resources/testharnessreport.js></script> | ||
<script src="/common/dispatcher/dispatcher.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/popup-test.js"></script> | ||
<script> | ||
popup_test( | ||
`Simple document with duplicated COOP header opening a same-origin popup`, | ||
SAME_ORIGIN, | ||
"unsafe-none", | ||
"preserved"); | ||
</script> |
2 changes: 2 additions & 0 deletions
2
html/cross-origin-opener-policy/header-parsing-repeated.https.html.headers
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,2 @@ | ||
Cross-Origin-Opener-Policy: same-origin | ||
Cross-Origin-Opener-Policy: same-origin |
44 changes: 44 additions & 0 deletions
44
html/cross-origin-opener-policy/header-parsing-successes.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,44 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<meta name=timeout content=long> | ||
<script src=/resources/testharness.js></script> | ||
<script src=/resources/testharnessreport.js></script> | ||
<script src="/common/dispatcher/dispatcher.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/popup-test.js"></script> | ||
<script> | ||
|
||
[ | ||
// All of the following should be recognized as "same-origin" (hence the | ||
// severed opener link). | ||
{ | ||
"title": "coop with leading space", | ||
"coop": " same-origin", | ||
}, | ||
{ | ||
"title": "coop with trailing space", | ||
"coop": "same-origin ", | ||
}, | ||
{ | ||
"title": "coop with leading tab", | ||
"coop": "\tsame-origin", | ||
}, | ||
{ | ||
"title": "coop with trailing tab", | ||
"coop": "same-origin\t", | ||
}, | ||
{ | ||
"title": "coop with duplicate value, separated by semi-column", | ||
"coop": "same-origin;same-origin", | ||
}, | ||
{ | ||
"title": "coop with valid structured header", | ||
"coop": "same-origin; foo=bar", | ||
} | ||
].forEach(variant => { | ||
popup_test(`Parsing ${variant.title}`, SAME_ORIGIN, variant.coop, "severed"); | ||
}); | ||
|
||
</script> |
This file was deleted.
Oops, something went wrong.