From 43a97878ce14b72f0981164f87f2e35e14151312 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:22:09 +0200 Subject: Adding upstream version 110.0.1. Signed-off-by: Daniel Baumann --- .../web-platform/tests/document-policy/META.yml | 1 + .../tests/document-policy/echo-policy-nested.html | 32 +++++++ .../echo-policy-nested.html.headers | 1 + .../tests/document-policy/echo-policy.py | 30 +++++++ .../document-write.tentative.html | 91 ++++++++++++++++++++ .../layout-animations-disabled-tentative.html | 40 +++++++++ ...yout-animations-disabled-tentative.html.headers | 1 + ...ons-disabled-violation-report-js-tentative.html | 36 ++++++++ ...bled-violation-report-js-tentative.html.headers | 1 + ...abled-violation-report-keyframes-tentative.html | 23 +++++ ...olation-report-keyframes-tentative.html.headers | 1 + .../layout-animations-enabled-tentative.html | 30 +++++++ .../resources/animation-property-height.js | 3 + .../resources/async-script.js | 1 + .../experimental-features/resources/common.js | 90 +++++++++++++++++++ .../resources/defer-script.js | 1 + .../resources/document-policy-image.html | 13 +++ .../resources/document-write-allowed.html | 37 ++++++++ .../resources/document-write-disallowed.html | 37 ++++++++ .../document-write-disallowed.html.headers | 1 + .../experimental-features/resources/image.jpg | Bin 0 -> 570855 bytes .../experimental-features/resources/image.png | Bin 0 -> 217 bytes .../experimental-features/resources/image.svg | 4 + .../resources/parser-blocking-script.js | 1 + .../resources/sync-script-test.js | 9 ++ .../experimental-features/resources/video.ogv | Bin 0 -> 103746 bytes .../sync-script.tentative.https.sub.html | 22 +++++ .../sync-script.tentative.https.sub.html.headers | 1 + .../unsized-media.tentative.https.sub.html | 95 +++++++++++++++++++++ .../unsized-media.tentative.https.sub.html.headers | 1 + .../override-to-optional.tentative-ref.html | 30 +++++++ .../override-to-optional.tentative.html | 46 ++++++++++ .../override-to-optional.tentative.html.headers | 1 + .../font-display/report-only-auto.tentative.html | 9 ++ .../report-only-auto.tentative.html.headers | 1 + .../font-display/report-only-blank.tentative.html | 9 ++ .../report-only-blank.tentative.html.headers | 1 + .../font-display/report-only-block.tentative.html | 9 ++ .../report-only-block.tentative.html.headers | 1 + .../report-only-fallback.tentative.html | 9 ++ .../report-only-fallback.tentative.html.headers | 1 + .../report-only-optional.tentative.html | 9 ++ .../report-only-optional.tentative.html.headers | 1 + .../font-display/report-only-swap.tentative.html | 9 ++ .../report-only-swap.tentative.html.headers | 1 + .../font-display/reporting-auto.tentative.html | 9 ++ .../reporting-auto.tentative.html.headers | 1 + .../font-display/reporting-blank.tentative.html | 9 ++ .../reporting-blank.tentative.html.headers | 1 + .../font-display/reporting-block.tentative.html | 9 ++ .../reporting-block.tentative.html.headers | 1 + .../font-display/reporting-fallback.tentative.html | 9 ++ .../reporting-fallback.tentative.html.headers | 1 + .../font-display/reporting-optional.tentative.html | 9 ++ .../reporting-optional.tentative.html.headers | 1 + .../font-display/reporting-swap.tentative.html | 9 ++ .../reporting-swap.tentative.html.headers | 1 + .../resources/font-display-reporting-helper.js | 81 ++++++++++++++++++ .../document-write-report-only-tentative.html | 26 ++++++ ...cument-write-report-only-tentative.html.headers | 1 + .../document-write-reporting-tentative.html | 32 +++++++ ...document-write-reporting-tentative.html.headers | 1 + .../tests/document-policy/reporting/image.jpg | Bin 0 -> 2033 bytes ...-images-max-bpp-reporting-onload-tentative.html | 26 ++++++ ...max-bpp-reporting-onload-tentative.html.headers | 1 + .../lossy-images-max-bpp-reporting-tentative.html | 27 ++++++ ...images-max-bpp-reporting-tentative.html.headers | 1 + .../oversized-images-reporting-tentative.html | 32 +++++++ ...ersized-images-reporting-tentative.html.headers | 1 + .../tests/document-policy/reporting/oversized.jpg | Bin 0 -> 1655 bytes .../reporting/resources/sync-script.js | 20 +++++ .../reporting/sync-script-reporting.html | 14 +++ .../reporting/sync-script-reporting.html.headers | 1 + .../reporting/sync-xhr-report-only.html | 28 ++++++ .../reporting/sync-xhr-report-only.html.headers | 1 + .../reporting/sync-xhr-reporting.html | 36 ++++++++ .../reporting/sync-xhr-reporting.html.headers | 1 + .../reporting/unoptimized-image.jpg | Bin 0 -> 43999 bytes .../unsized-media-reporting-tentative.html | 24 ++++++ .../unsized-media-reporting-tentative.html.headers | 1 + .../required-policy/document-policy.html | 54 ++++++++++++ .../required-policy/document-policy.html.headers | 1 + .../required-policy/no-document-policy.html | 44 ++++++++++ .../required-document-policy-nested.html | 65 ++++++++++++++ .../required-policy/required-document-policy.html | 65 ++++++++++++++ .../required-document-policy.html.headers | 1 + .../separate-document-policies.html | 64 ++++++++++++++ .../separate-document-policies.html.headers | 2 + .../resources/document-policy-report-json.js | 20 +++++ 89 files changed, 1471 insertions(+) create mode 100644 testing/web-platform/tests/document-policy/META.yml create mode 100644 testing/web-platform/tests/document-policy/echo-policy-nested.html create mode 100644 testing/web-platform/tests/document-policy/echo-policy-nested.html.headers create mode 100644 testing/web-platform/tests/document-policy/echo-policy.py create mode 100644 testing/web-platform/tests/document-policy/experimental-features/document-write.tentative.html create mode 100644 testing/web-platform/tests/document-policy/experimental-features/layout-animations-disabled-tentative.html create mode 100644 testing/web-platform/tests/document-policy/experimental-features/layout-animations-disabled-tentative.html.headers create mode 100644 testing/web-platform/tests/document-policy/experimental-features/layout-animations-disabled-violation-report-js-tentative.html create mode 100644 testing/web-platform/tests/document-policy/experimental-features/layout-animations-disabled-violation-report-js-tentative.html.headers create mode 100644 testing/web-platform/tests/document-policy/experimental-features/layout-animations-disabled-violation-report-keyframes-tentative.html create mode 100644 testing/web-platform/tests/document-policy/experimental-features/layout-animations-disabled-violation-report-keyframes-tentative.html.headers create mode 100644 testing/web-platform/tests/document-policy/experimental-features/layout-animations-enabled-tentative.html create mode 100644 testing/web-platform/tests/document-policy/experimental-features/resources/animation-property-height.js create mode 100644 testing/web-platform/tests/document-policy/experimental-features/resources/async-script.js create mode 100644 testing/web-platform/tests/document-policy/experimental-features/resources/common.js create mode 100644 testing/web-platform/tests/document-policy/experimental-features/resources/defer-script.js create mode 100644 testing/web-platform/tests/document-policy/experimental-features/resources/document-policy-image.html create mode 100644 testing/web-platform/tests/document-policy/experimental-features/resources/document-write-allowed.html create mode 100644 testing/web-platform/tests/document-policy/experimental-features/resources/document-write-disallowed.html create mode 100644 testing/web-platform/tests/document-policy/experimental-features/resources/document-write-disallowed.html.headers create mode 100644 testing/web-platform/tests/document-policy/experimental-features/resources/image.jpg create mode 100644 testing/web-platform/tests/document-policy/experimental-features/resources/image.png create mode 100644 testing/web-platform/tests/document-policy/experimental-features/resources/image.svg create mode 100644 testing/web-platform/tests/document-policy/experimental-features/resources/parser-blocking-script.js create mode 100644 testing/web-platform/tests/document-policy/experimental-features/resources/sync-script-test.js create mode 100644 testing/web-platform/tests/document-policy/experimental-features/resources/video.ogv create mode 100644 testing/web-platform/tests/document-policy/experimental-features/sync-script.tentative.https.sub.html create mode 100644 testing/web-platform/tests/document-policy/experimental-features/sync-script.tentative.https.sub.html.headers create mode 100644 testing/web-platform/tests/document-policy/experimental-features/unsized-media.tentative.https.sub.html create mode 100644 testing/web-platform/tests/document-policy/experimental-features/unsized-media.tentative.https.sub.html.headers create mode 100644 testing/web-platform/tests/document-policy/font-display/override-to-optional.tentative-ref.html create mode 100644 testing/web-platform/tests/document-policy/font-display/override-to-optional.tentative.html create mode 100644 testing/web-platform/tests/document-policy/font-display/override-to-optional.tentative.html.headers create mode 100644 testing/web-platform/tests/document-policy/font-display/report-only-auto.tentative.html create mode 100644 testing/web-platform/tests/document-policy/font-display/report-only-auto.tentative.html.headers create mode 100644 testing/web-platform/tests/document-policy/font-display/report-only-blank.tentative.html create mode 100644 testing/web-platform/tests/document-policy/font-display/report-only-blank.tentative.html.headers create mode 100644 testing/web-platform/tests/document-policy/font-display/report-only-block.tentative.html create mode 100644 testing/web-platform/tests/document-policy/font-display/report-only-block.tentative.html.headers create mode 100644 testing/web-platform/tests/document-policy/font-display/report-only-fallback.tentative.html create mode 100644 testing/web-platform/tests/document-policy/font-display/report-only-fallback.tentative.html.headers create mode 100644 testing/web-platform/tests/document-policy/font-display/report-only-optional.tentative.html create mode 100644 testing/web-platform/tests/document-policy/font-display/report-only-optional.tentative.html.headers create mode 100644 testing/web-platform/tests/document-policy/font-display/report-only-swap.tentative.html create mode 100644 testing/web-platform/tests/document-policy/font-display/report-only-swap.tentative.html.headers create mode 100644 testing/web-platform/tests/document-policy/font-display/reporting-auto.tentative.html create mode 100644 testing/web-platform/tests/document-policy/font-display/reporting-auto.tentative.html.headers create mode 100644 testing/web-platform/tests/document-policy/font-display/reporting-blank.tentative.html create mode 100644 testing/web-platform/tests/document-policy/font-display/reporting-blank.tentative.html.headers create mode 100644 testing/web-platform/tests/document-policy/font-display/reporting-block.tentative.html create mode 100644 testing/web-platform/tests/document-policy/font-display/reporting-block.tentative.html.headers create mode 100644 testing/web-platform/tests/document-policy/font-display/reporting-fallback.tentative.html create mode 100644 testing/web-platform/tests/document-policy/font-display/reporting-fallback.tentative.html.headers create mode 100644 testing/web-platform/tests/document-policy/font-display/reporting-optional.tentative.html create mode 100644 testing/web-platform/tests/document-policy/font-display/reporting-optional.tentative.html.headers create mode 100644 testing/web-platform/tests/document-policy/font-display/reporting-swap.tentative.html create mode 100644 testing/web-platform/tests/document-policy/font-display/reporting-swap.tentative.html.headers create mode 100644 testing/web-platform/tests/document-policy/font-display/resources/font-display-reporting-helper.js create mode 100644 testing/web-platform/tests/document-policy/reporting/document-write-report-only-tentative.html create mode 100644 testing/web-platform/tests/document-policy/reporting/document-write-report-only-tentative.html.headers create mode 100644 testing/web-platform/tests/document-policy/reporting/document-write-reporting-tentative.html create mode 100644 testing/web-platform/tests/document-policy/reporting/document-write-reporting-tentative.html.headers create mode 100644 testing/web-platform/tests/document-policy/reporting/image.jpg create mode 100644 testing/web-platform/tests/document-policy/reporting/lossy-images-max-bpp-reporting-onload-tentative.html create mode 100644 testing/web-platform/tests/document-policy/reporting/lossy-images-max-bpp-reporting-onload-tentative.html.headers create mode 100644 testing/web-platform/tests/document-policy/reporting/lossy-images-max-bpp-reporting-tentative.html create mode 100644 testing/web-platform/tests/document-policy/reporting/lossy-images-max-bpp-reporting-tentative.html.headers create mode 100644 testing/web-platform/tests/document-policy/reporting/oversized-images-reporting-tentative.html create mode 100644 testing/web-platform/tests/document-policy/reporting/oversized-images-reporting-tentative.html.headers create mode 100644 testing/web-platform/tests/document-policy/reporting/oversized.jpg create mode 100644 testing/web-platform/tests/document-policy/reporting/resources/sync-script.js create mode 100644 testing/web-platform/tests/document-policy/reporting/sync-script-reporting.html create mode 100644 testing/web-platform/tests/document-policy/reporting/sync-script-reporting.html.headers create mode 100644 testing/web-platform/tests/document-policy/reporting/sync-xhr-report-only.html create mode 100644 testing/web-platform/tests/document-policy/reporting/sync-xhr-report-only.html.headers create mode 100644 testing/web-platform/tests/document-policy/reporting/sync-xhr-reporting.html create mode 100644 testing/web-platform/tests/document-policy/reporting/sync-xhr-reporting.html.headers create mode 100644 testing/web-platform/tests/document-policy/reporting/unoptimized-image.jpg create mode 100644 testing/web-platform/tests/document-policy/reporting/unsized-media-reporting-tentative.html create mode 100644 testing/web-platform/tests/document-policy/reporting/unsized-media-reporting-tentative.html.headers create mode 100644 testing/web-platform/tests/document-policy/required-policy/document-policy.html create mode 100644 testing/web-platform/tests/document-policy/required-policy/document-policy.html.headers create mode 100644 testing/web-platform/tests/document-policy/required-policy/no-document-policy.html create mode 100644 testing/web-platform/tests/document-policy/required-policy/required-document-policy-nested.html create mode 100644 testing/web-platform/tests/document-policy/required-policy/required-document-policy.html create mode 100644 testing/web-platform/tests/document-policy/required-policy/required-document-policy.html.headers create mode 100644 testing/web-platform/tests/document-policy/required-policy/separate-document-policies.html create mode 100644 testing/web-platform/tests/document-policy/required-policy/separate-document-policies.html.headers create mode 100644 testing/web-platform/tests/document-policy/resources/document-policy-report-json.js (limited to 'testing/web-platform/tests/document-policy') diff --git a/testing/web-platform/tests/document-policy/META.yml b/testing/web-platform/tests/document-policy/META.yml new file mode 100644 index 0000000000..673defaa02 --- /dev/null +++ b/testing/web-platform/tests/document-policy/META.yml @@ -0,0 +1 @@ +spec: https://wicg.github.io/document-policy/ diff --git a/testing/web-platform/tests/document-policy/echo-policy-nested.html b/testing/web-platform/tests/document-policy/echo-policy-nested.html new file mode 100644 index 0000000000..5a01f4e1ec --- /dev/null +++ b/testing/web-platform/tests/document-policy/echo-policy-nested.html @@ -0,0 +1,32 @@ + + + diff --git a/testing/web-platform/tests/document-policy/echo-policy-nested.html.headers b/testing/web-platform/tests/document-policy/echo-policy-nested.html.headers new file mode 100644 index 0000000000..419a3c3dd1 --- /dev/null +++ b/testing/web-platform/tests/document-policy/echo-policy-nested.html.headers @@ -0,0 +1 @@ +Document-Policy: lossless-images-max-bpp=0.0 diff --git a/testing/web-platform/tests/document-policy/echo-policy.py b/testing/web-platform/tests/document-policy/echo-policy.py new file mode 100644 index 0000000000..2ad326dac7 --- /dev/null +++ b/testing/web-platform/tests/document-policy/echo-policy.py @@ -0,0 +1,30 @@ +# This will echo the 'Sec-Required-Document-Policy' request header in the body +# of the response, as well as in the 'Document-Policy' response header (to +# ensure the response is loaded by a user agent which is implementing document +# policy.) +import json + +from wptserve.utils import isomorphic_decode + +def main(request, response): + msg = {} + headers = [(b'Content-Type', b'text/html')] + + srdp = request.headers.get(b'Sec-Required-Document-Policy') + if srdp: + msg[u'requiredPolicy'] = isomorphic_decode(srdp) + headers.append((b'Document-Policy', srdp)) + + frameId = request.GET.first(b'id',None) + if frameId: + msg[u'id'] = isomorphic_decode(frameId) + + content = u""" + +%s +""" % (json.dumps(msg), isomorphic_decode(srdp) if srdp != None else srdp) + + return (200, u'OK'), headers, content + diff --git a/testing/web-platform/tests/document-policy/experimental-features/document-write.tentative.html b/testing/web-platform/tests/document-policy/experimental-features/document-write.tentative.html new file mode 100644 index 0000000000..551703c6f5 --- /dev/null +++ b/testing/web-platform/tests/document-policy/experimental-features/document-write.tentative.html @@ -0,0 +1,91 @@ + +'document-write' tests + + + + + + + diff --git a/testing/web-platform/tests/document-policy/experimental-features/layout-animations-disabled-tentative.html b/testing/web-platform/tests/document-policy/experimental-features/layout-animations-disabled-tentative.html new file mode 100644 index 0000000000..fd32ace78e --- /dev/null +++ b/testing/web-platform/tests/document-policy/experimental-features/layout-animations-disabled-tentative.html @@ -0,0 +1,40 @@ + + + + + + 'layout-animations' Policy : Correct behavior for affected and unaffected properties when + feature is disabled. + + + + diff --git a/testing/web-platform/tests/document-policy/experimental-features/layout-animations-disabled-tentative.html.headers b/testing/web-platform/tests/document-policy/experimental-features/layout-animations-disabled-tentative.html.headers new file mode 100644 index 0000000000..745da550ee --- /dev/null +++ b/testing/web-platform/tests/document-policy/experimental-features/layout-animations-disabled-tentative.html.headers @@ -0,0 +1 @@ +Document-Policy: layout-animations=?0 diff --git a/testing/web-platform/tests/document-policy/experimental-features/layout-animations-disabled-violation-report-js-tentative.html b/testing/web-platform/tests/document-policy/experimental-features/layout-animations-disabled-violation-report-js-tentative.html new file mode 100644 index 0000000000..ee7c295156 --- /dev/null +++ b/testing/web-platform/tests/document-policy/experimental-features/layout-animations-disabled-violation-report-js-tentative.html @@ -0,0 +1,36 @@ + + + + + 'layout-animations' Policy : violation reports from javascript + + + + diff --git a/testing/web-platform/tests/document-policy/experimental-features/layout-animations-disabled-violation-report-js-tentative.html.headers b/testing/web-platform/tests/document-policy/experimental-features/layout-animations-disabled-violation-report-js-tentative.html.headers new file mode 100644 index 0000000000..745da550ee --- /dev/null +++ b/testing/web-platform/tests/document-policy/experimental-features/layout-animations-disabled-violation-report-js-tentative.html.headers @@ -0,0 +1 @@ +Document-Policy: layout-animations=?0 diff --git a/testing/web-platform/tests/document-policy/experimental-features/layout-animations-disabled-violation-report-keyframes-tentative.html b/testing/web-platform/tests/document-policy/experimental-features/layout-animations-disabled-violation-report-keyframes-tentative.html new file mode 100644 index 0000000000..cd9210cc13 --- /dev/null +++ b/testing/web-platform/tests/document-policy/experimental-features/layout-animations-disabled-violation-report-keyframes-tentative.html @@ -0,0 +1,23 @@ + + + + + 'layout-animations' Policy : violation reports from CSS keyframes + + + + diff --git a/testing/web-platform/tests/document-policy/experimental-features/layout-animations-disabled-violation-report-keyframes-tentative.html.headers b/testing/web-platform/tests/document-policy/experimental-features/layout-animations-disabled-violation-report-keyframes-tentative.html.headers new file mode 100644 index 0000000000..745da550ee --- /dev/null +++ b/testing/web-platform/tests/document-policy/experimental-features/layout-animations-disabled-violation-report-keyframes-tentative.html.headers @@ -0,0 +1 @@ +Document-Policy: layout-animations=?0 diff --git a/testing/web-platform/tests/document-policy/experimental-features/layout-animations-enabled-tentative.html b/testing/web-platform/tests/document-policy/experimental-features/layout-animations-enabled-tentative.html new file mode 100644 index 0000000000..19e405496e --- /dev/null +++ b/testing/web-platform/tests/document-policy/experimental-features/layout-animations-enabled-tentative.html @@ -0,0 +1,30 @@ + + + + + 'layout-animations' Policy : Correct behavior for affected and unaffected properties when + feature is enabled. + + + + diff --git a/testing/web-platform/tests/document-policy/experimental-features/resources/animation-property-height.js b/testing/web-platform/tests/document-policy/experimental-features/resources/animation-property-height.js new file mode 100644 index 0000000000..79316cb488 --- /dev/null +++ b/testing/web-platform/tests/document-policy/experimental-features/resources/animation-property-height.js @@ -0,0 +1,3 @@ +let div = document.createElement("div"); +document.body.appendChild(div); +div.animate([{"height": "0px"}, {"height": "100px"}]); diff --git a/testing/web-platform/tests/document-policy/experimental-features/resources/async-script.js b/testing/web-platform/tests/document-policy/experimental-features/resources/async-script.js new file mode 100644 index 0000000000..3c0ee6d023 --- /dev/null +++ b/testing/web-platform/tests/document-policy/experimental-features/resources/async-script.js @@ -0,0 +1 @@ +window.didExecuteExternalAsyncScript = true; diff --git a/testing/web-platform/tests/document-policy/experimental-features/resources/common.js b/testing/web-platform/tests/document-policy/experimental-features/resources/common.js new file mode 100644 index 0000000000..639847abf3 --- /dev/null +++ b/testing/web-platform/tests/document-policy/experimental-features/resources/common.js @@ -0,0 +1,90 @@ +const url_base = "/document-policy/experimental-features/resources/"; +window.messageResponseCallback = null; + +// Returns a promise which is resolved when the + + diff --git a/testing/web-platform/tests/document-policy/experimental-features/unsized-media.tentative.https.sub.html.headers b/testing/web-platform/tests/document-policy/experimental-features/unsized-media.tentative.https.sub.html.headers new file mode 100644 index 0000000000..cf59933e8d --- /dev/null +++ b/testing/web-platform/tests/document-policy/experimental-features/unsized-media.tentative.https.sub.html.headers @@ -0,0 +1 @@ +Document-Policy: unsized-media=?0 diff --git a/testing/web-platform/tests/document-policy/font-display/override-to-optional.tentative-ref.html b/testing/web-platform/tests/document-policy/font-display/override-to-optional.tentative-ref.html new file mode 100644 index 0000000000..78bca05b12 --- /dev/null +++ b/testing/web-platform/tests/document-policy/font-display/override-to-optional.tentative-ref.html @@ -0,0 +1,30 @@ + +Test for no-font-display-late-swap document policy behavior + + +

Tests if font-display is set to optional for each option except for when it is set to fallback

+ + + + + + + + + + + + + + + + + +
not-setautoblockswapfallbackoptional
aaaaaa
diff --git a/testing/web-platform/tests/document-policy/font-display/override-to-optional.tentative.html b/testing/web-platform/tests/document-policy/font-display/override-to-optional.tentative.html new file mode 100644 index 0000000000..26927bb8c6 --- /dev/null +++ b/testing/web-platform/tests/document-policy/font-display/override-to-optional.tentative.html @@ -0,0 +1,46 @@ + + +Test for no-font-display-late-swap document policy behavior + + + +

Tests if font-display is set to optional for each option except for when it is set to fallback

+ + + + + + + + + +
not-setautoblockswapfallbackoptional
+ + diff --git a/testing/web-platform/tests/document-policy/font-display/override-to-optional.tentative.html.headers b/testing/web-platform/tests/document-policy/font-display/override-to-optional.tentative.html.headers new file mode 100644 index 0000000000..01b8bbccd4 --- /dev/null +++ b/testing/web-platform/tests/document-policy/font-display/override-to-optional.tentative.html.headers @@ -0,0 +1 @@ +Document-Policy: font-display-late-swap=?0 diff --git a/testing/web-platform/tests/document-policy/font-display/report-only-auto.tentative.html b/testing/web-platform/tests/document-policy/font-display/report-only-auto.tentative.html new file mode 100644 index 0000000000..9eea350de4 --- /dev/null +++ b/testing/web-platform/tests/document-policy/font-display/report-only-auto.tentative.html @@ -0,0 +1,9 @@ + +Test for font-display-late-swap document policy with font display value 'auto' + + + + + diff --git a/testing/web-platform/tests/document-policy/font-display/report-only-auto.tentative.html.headers b/testing/web-platform/tests/document-policy/font-display/report-only-auto.tentative.html.headers new file mode 100644 index 0000000000..1509127277 --- /dev/null +++ b/testing/web-platform/tests/document-policy/font-display/report-only-auto.tentative.html.headers @@ -0,0 +1 @@ +Document-Policy-Report-Only: font-display-late-swap=?0 \ No newline at end of file diff --git a/testing/web-platform/tests/document-policy/font-display/report-only-blank.tentative.html b/testing/web-platform/tests/document-policy/font-display/report-only-blank.tentative.html new file mode 100644 index 0000000000..628dbccb4d --- /dev/null +++ b/testing/web-platform/tests/document-policy/font-display/report-only-blank.tentative.html @@ -0,0 +1,9 @@ + +Test for font-display-late-swap document policy with font display value empty + + + + + diff --git a/testing/web-platform/tests/document-policy/font-display/report-only-blank.tentative.html.headers b/testing/web-platform/tests/document-policy/font-display/report-only-blank.tentative.html.headers new file mode 100644 index 0000000000..1509127277 --- /dev/null +++ b/testing/web-platform/tests/document-policy/font-display/report-only-blank.tentative.html.headers @@ -0,0 +1 @@ +Document-Policy-Report-Only: font-display-late-swap=?0 \ No newline at end of file diff --git a/testing/web-platform/tests/document-policy/font-display/report-only-block.tentative.html b/testing/web-platform/tests/document-policy/font-display/report-only-block.tentative.html new file mode 100644 index 0000000000..a383695317 --- /dev/null +++ b/testing/web-platform/tests/document-policy/font-display/report-only-block.tentative.html @@ -0,0 +1,9 @@ + +Test for font-display-late-swap document policy with font display value 'block' + + + + + diff --git a/testing/web-platform/tests/document-policy/font-display/report-only-block.tentative.html.headers b/testing/web-platform/tests/document-policy/font-display/report-only-block.tentative.html.headers new file mode 100644 index 0000000000..1509127277 --- /dev/null +++ b/testing/web-platform/tests/document-policy/font-display/report-only-block.tentative.html.headers @@ -0,0 +1 @@ +Document-Policy-Report-Only: font-display-late-swap=?0 \ No newline at end of file diff --git a/testing/web-platform/tests/document-policy/font-display/report-only-fallback.tentative.html b/testing/web-platform/tests/document-policy/font-display/report-only-fallback.tentative.html new file mode 100644 index 0000000000..a03015e47d --- /dev/null +++ b/testing/web-platform/tests/document-policy/font-display/report-only-fallback.tentative.html @@ -0,0 +1,9 @@ + +Test for font-display-late-swap document policy with font display value 'fallback' + + + + + diff --git a/testing/web-platform/tests/document-policy/font-display/report-only-fallback.tentative.html.headers b/testing/web-platform/tests/document-policy/font-display/report-only-fallback.tentative.html.headers new file mode 100644 index 0000000000..1509127277 --- /dev/null +++ b/testing/web-platform/tests/document-policy/font-display/report-only-fallback.tentative.html.headers @@ -0,0 +1 @@ +Document-Policy-Report-Only: font-display-late-swap=?0 \ No newline at end of file diff --git a/testing/web-platform/tests/document-policy/font-display/report-only-optional.tentative.html b/testing/web-platform/tests/document-policy/font-display/report-only-optional.tentative.html new file mode 100644 index 0000000000..2a4673f153 --- /dev/null +++ b/testing/web-platform/tests/document-policy/font-display/report-only-optional.tentative.html @@ -0,0 +1,9 @@ + +Test for font-display-late-swap document policy with font display value 'optional' + + + + + diff --git a/testing/web-platform/tests/document-policy/font-display/report-only-optional.tentative.html.headers b/testing/web-platform/tests/document-policy/font-display/report-only-optional.tentative.html.headers new file mode 100644 index 0000000000..1509127277 --- /dev/null +++ b/testing/web-platform/tests/document-policy/font-display/report-only-optional.tentative.html.headers @@ -0,0 +1 @@ +Document-Policy-Report-Only: font-display-late-swap=?0 \ No newline at end of file diff --git a/testing/web-platform/tests/document-policy/font-display/report-only-swap.tentative.html b/testing/web-platform/tests/document-policy/font-display/report-only-swap.tentative.html new file mode 100644 index 0000000000..ad1f437f8c --- /dev/null +++ b/testing/web-platform/tests/document-policy/font-display/report-only-swap.tentative.html @@ -0,0 +1,9 @@ + +Test for font-display-late-swap document policy with font display value 'swap' + + + + + diff --git a/testing/web-platform/tests/document-policy/font-display/report-only-swap.tentative.html.headers b/testing/web-platform/tests/document-policy/font-display/report-only-swap.tentative.html.headers new file mode 100644 index 0000000000..1509127277 --- /dev/null +++ b/testing/web-platform/tests/document-policy/font-display/report-only-swap.tentative.html.headers @@ -0,0 +1 @@ +Document-Policy-Report-Only: font-display-late-swap=?0 \ No newline at end of file diff --git a/testing/web-platform/tests/document-policy/font-display/reporting-auto.tentative.html b/testing/web-platform/tests/document-policy/font-display/reporting-auto.tentative.html new file mode 100644 index 0000000000..01857dd90e --- /dev/null +++ b/testing/web-platform/tests/document-policy/font-display/reporting-auto.tentative.html @@ -0,0 +1,9 @@ + +Test for font-display-late-swap document policy with font display value 'auto' + + + + + diff --git a/testing/web-platform/tests/document-policy/font-display/reporting-auto.tentative.html.headers b/testing/web-platform/tests/document-policy/font-display/reporting-auto.tentative.html.headers new file mode 100644 index 0000000000..273ca3564d --- /dev/null +++ b/testing/web-platform/tests/document-policy/font-display/reporting-auto.tentative.html.headers @@ -0,0 +1 @@ +Document-Policy: font-display-late-swap=?0 \ No newline at end of file diff --git a/testing/web-platform/tests/document-policy/font-display/reporting-blank.tentative.html b/testing/web-platform/tests/document-policy/font-display/reporting-blank.tentative.html new file mode 100644 index 0000000000..6521ae131a --- /dev/null +++ b/testing/web-platform/tests/document-policy/font-display/reporting-blank.tentative.html @@ -0,0 +1,9 @@ + +Test for font-display-late-swap document policy with font display value empty + + + + + diff --git a/testing/web-platform/tests/document-policy/font-display/reporting-blank.tentative.html.headers b/testing/web-platform/tests/document-policy/font-display/reporting-blank.tentative.html.headers new file mode 100644 index 0000000000..273ca3564d --- /dev/null +++ b/testing/web-platform/tests/document-policy/font-display/reporting-blank.tentative.html.headers @@ -0,0 +1 @@ +Document-Policy: font-display-late-swap=?0 \ No newline at end of file diff --git a/testing/web-platform/tests/document-policy/font-display/reporting-block.tentative.html b/testing/web-platform/tests/document-policy/font-display/reporting-block.tentative.html new file mode 100644 index 0000000000..60403c67a4 --- /dev/null +++ b/testing/web-platform/tests/document-policy/font-display/reporting-block.tentative.html @@ -0,0 +1,9 @@ + +Test for font-display-late-swap document policy with font display value 'block' + + + + + diff --git a/testing/web-platform/tests/document-policy/font-display/reporting-block.tentative.html.headers b/testing/web-platform/tests/document-policy/font-display/reporting-block.tentative.html.headers new file mode 100644 index 0000000000..273ca3564d --- /dev/null +++ b/testing/web-platform/tests/document-policy/font-display/reporting-block.tentative.html.headers @@ -0,0 +1 @@ +Document-Policy: font-display-late-swap=?0 \ No newline at end of file diff --git a/testing/web-platform/tests/document-policy/font-display/reporting-fallback.tentative.html b/testing/web-platform/tests/document-policy/font-display/reporting-fallback.tentative.html new file mode 100644 index 0000000000..a03015e47d --- /dev/null +++ b/testing/web-platform/tests/document-policy/font-display/reporting-fallback.tentative.html @@ -0,0 +1,9 @@ + +Test for font-display-late-swap document policy with font display value 'fallback' + + + + + diff --git a/testing/web-platform/tests/document-policy/font-display/reporting-fallback.tentative.html.headers b/testing/web-platform/tests/document-policy/font-display/reporting-fallback.tentative.html.headers new file mode 100644 index 0000000000..273ca3564d --- /dev/null +++ b/testing/web-platform/tests/document-policy/font-display/reporting-fallback.tentative.html.headers @@ -0,0 +1 @@ +Document-Policy: font-display-late-swap=?0 \ No newline at end of file diff --git a/testing/web-platform/tests/document-policy/font-display/reporting-optional.tentative.html b/testing/web-platform/tests/document-policy/font-display/reporting-optional.tentative.html new file mode 100644 index 0000000000..2a4673f153 --- /dev/null +++ b/testing/web-platform/tests/document-policy/font-display/reporting-optional.tentative.html @@ -0,0 +1,9 @@ + +Test for font-display-late-swap document policy with font display value 'optional' + + + + + diff --git a/testing/web-platform/tests/document-policy/font-display/reporting-optional.tentative.html.headers b/testing/web-platform/tests/document-policy/font-display/reporting-optional.tentative.html.headers new file mode 100644 index 0000000000..273ca3564d --- /dev/null +++ b/testing/web-platform/tests/document-policy/font-display/reporting-optional.tentative.html.headers @@ -0,0 +1 @@ +Document-Policy: font-display-late-swap=?0 \ No newline at end of file diff --git a/testing/web-platform/tests/document-policy/font-display/reporting-swap.tentative.html b/testing/web-platform/tests/document-policy/font-display/reporting-swap.tentative.html new file mode 100644 index 0000000000..53d823f178 --- /dev/null +++ b/testing/web-platform/tests/document-policy/font-display/reporting-swap.tentative.html @@ -0,0 +1,9 @@ + +Test for font-display-late-swap document policy with font display value 'swap' + + + + + diff --git a/testing/web-platform/tests/document-policy/font-display/reporting-swap.tentative.html.headers b/testing/web-platform/tests/document-policy/font-display/reporting-swap.tentative.html.headers new file mode 100644 index 0000000000..273ca3564d --- /dev/null +++ b/testing/web-platform/tests/document-policy/font-display/reporting-swap.tentative.html.headers @@ -0,0 +1 @@ +Document-Policy: font-display-late-swap=?0 \ No newline at end of file diff --git a/testing/web-platform/tests/document-policy/font-display/resources/font-display-reporting-helper.js b/testing/web-platform/tests/document-policy/font-display/resources/font-display-reporting-helper.js new file mode 100644 index 0000000000..f3c8a22b7a --- /dev/null +++ b/testing/web-platform/tests/document-policy/font-display/resources/font-display-reporting-helper.js @@ -0,0 +1,81 @@ +function check_report_format(report, expected_url, expected_disposition) { + assert_equals(report.type, 'document-policy-violation'); + assert_equals(report.url, expected_url); + assert_equals(report.body.featureId, 'font-display-late-swap'); + assert_equals(report.body.disposition, expected_disposition); + assert_true('sourceFile' in report.body); + assert_true('lineNumber' in report.body); + assert_true('columnNumber' in report.body); +} + +function check_violation_report_format(report, expected_url) { + check_report_format(report, expected_url, 'enforce'); +} + +function check_report_only_report_format(report, expected_url) { + check_report_format(report, expected_url, 'report'); +} + +function makeFontFaceDeclaration(family, display) { + url = '/fonts/Ahem.ttf?pipe=trickle(d1)'; // Before the swap period is over + return `@font-face { font-family: ${family}; src: url("${url}"); font-display: ${display}; }`; +} + +/** + * Run font-display test with given parameters. + * + * A violation report is expected with fontDisplayValue set to + * ['', 'auto', 'block', 'swap'] + * + * No violation report is expected with fontDisplayValue set to + * ['fallback', 'optional'] + + * @param {String} fontDisplayValue + * @param {(Report, String) => () | undefined} format_check pass a callback to + * check report format if a violation report is expected. If no report is + * expected to be generated, leave this argument undefined. + */ +function runTest(fontDisplayValue, format_check) { + window.onload = () => { + const family = fontDisplayValue + '-face'; + const rule = makeFontFaceDeclaration(family, fontDisplayValue); + + const style = document.createElement('style'); + style.innerHTML = rule; + document.body.appendChild(style); + + const div = document.createElement('div'); + div.textContent = 'a'; + div.style.fontFamily = family + ', Arial'; + document.body.appendChild(div); + }; + + const t = async_test('font-display-late-swap Report Format'); + + new ReportingObserver( + t.step_func_done((reports, _) => { + assert_equals(reports.length, 1); + assert_true(!!format_check); + format_check(reports[0], document.location.href); + }), { + types: ['document-policy-violation'], + buffered: true + } + ).observe(); + + t.step_timeout(t.step_func_done(() => { + assert_false(!!format_check, 'Expected violation report but did not get one.'); + }), 400); // 400ms should be sufficient to observe the violation report. +} + +function testFontDisplayPolicyViolationGenerated(fontDisplayValue) { + runTest(fontDisplayValue, check_violation_report_format); +} + +function testFontDisplayPolicyReportOnlyGenerated(fontDisplayValue) { + runTest(fontDisplayValue, check_report_only_report_format); +} + +function testCompliantWithFontDisplayPolicy(fontDisplayValue) { + runTest(fontDisplayValue); +} \ No newline at end of file diff --git a/testing/web-platform/tests/document-policy/reporting/document-write-report-only-tentative.html b/testing/web-platform/tests/document-policy/reporting/document-write-report-only-tentative.html new file mode 100644 index 0000000000..bf17807f4a --- /dev/null +++ b/testing/web-platform/tests/document-policy/reporting/document-write-report-only-tentative.html @@ -0,0 +1,26 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/document-policy/reporting/document-write-report-only-tentative.html.headers b/testing/web-platform/tests/document-policy/reporting/document-write-report-only-tentative.html.headers new file mode 100644 index 0000000000..924dac8e87 --- /dev/null +++ b/testing/web-platform/tests/document-policy/reporting/document-write-report-only-tentative.html.headers @@ -0,0 +1 @@ +Document-Policy-Report-Only: document-write=?0 diff --git a/testing/web-platform/tests/document-policy/reporting/document-write-reporting-tentative.html b/testing/web-platform/tests/document-policy/reporting/document-write-reporting-tentative.html new file mode 100644 index 0000000000..65a584ce19 --- /dev/null +++ b/testing/web-platform/tests/document-policy/reporting/document-write-reporting-tentative.html @@ -0,0 +1,32 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/document-policy/reporting/document-write-reporting-tentative.html.headers b/testing/web-platform/tests/document-policy/reporting/document-write-reporting-tentative.html.headers new file mode 100644 index 0000000000..6d05e969b5 --- /dev/null +++ b/testing/web-platform/tests/document-policy/reporting/document-write-reporting-tentative.html.headers @@ -0,0 +1 @@ +Document-Policy: document-write=?0 diff --git a/testing/web-platform/tests/document-policy/reporting/image.jpg b/testing/web-platform/tests/document-policy/reporting/image.jpg new file mode 100644 index 0000000000..c059b96d97 Binary files /dev/null and b/testing/web-platform/tests/document-policy/reporting/image.jpg differ diff --git a/testing/web-platform/tests/document-policy/reporting/lossy-images-max-bpp-reporting-onload-tentative.html b/testing/web-platform/tests/document-policy/reporting/lossy-images-max-bpp-reporting-onload-tentative.html new file mode 100644 index 0000000000..85e1349a19 --- /dev/null +++ b/testing/web-platform/tests/document-policy/reporting/lossy-images-max-bpp-reporting-onload-tentative.html @@ -0,0 +1,26 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/document-policy/reporting/lossy-images-max-bpp-reporting-onload-tentative.html.headers b/testing/web-platform/tests/document-policy/reporting/lossy-images-max-bpp-reporting-onload-tentative.html.headers new file mode 100644 index 0000000000..cb28d40ec1 --- /dev/null +++ b/testing/web-platform/tests/document-policy/reporting/lossy-images-max-bpp-reporting-onload-tentative.html.headers @@ -0,0 +1 @@ +Document-Policy: lossy-images-max-bpp=0.5 diff --git a/testing/web-platform/tests/document-policy/reporting/lossy-images-max-bpp-reporting-tentative.html b/testing/web-platform/tests/document-policy/reporting/lossy-images-max-bpp-reporting-tentative.html new file mode 100644 index 0000000000..b6876f4880 --- /dev/null +++ b/testing/web-platform/tests/document-policy/reporting/lossy-images-max-bpp-reporting-tentative.html @@ -0,0 +1,27 @@ + + + + + + + + + + + diff --git a/testing/web-platform/tests/document-policy/reporting/lossy-images-max-bpp-reporting-tentative.html.headers b/testing/web-platform/tests/document-policy/reporting/lossy-images-max-bpp-reporting-tentative.html.headers new file mode 100644 index 0000000000..cb28d40ec1 --- /dev/null +++ b/testing/web-platform/tests/document-policy/reporting/lossy-images-max-bpp-reporting-tentative.html.headers @@ -0,0 +1 @@ +Document-Policy: lossy-images-max-bpp=0.5 diff --git a/testing/web-platform/tests/document-policy/reporting/oversized-images-reporting-tentative.html b/testing/web-platform/tests/document-policy/reporting/oversized-images-reporting-tentative.html new file mode 100644 index 0000000000..bef7db27a7 --- /dev/null +++ b/testing/web-platform/tests/document-policy/reporting/oversized-images-reporting-tentative.html @@ -0,0 +1,32 @@ + + + + + + + + + oversized image + + + + diff --git a/testing/web-platform/tests/document-policy/reporting/oversized-images-reporting-tentative.html.headers b/testing/web-platform/tests/document-policy/reporting/oversized-images-reporting-tentative.html.headers new file mode 100644 index 0000000000..10f5be1c33 --- /dev/null +++ b/testing/web-platform/tests/document-policy/reporting/oversized-images-reporting-tentative.html.headers @@ -0,0 +1 @@ +Document-Policy: oversized-images=2.0 diff --git a/testing/web-platform/tests/document-policy/reporting/oversized.jpg b/testing/web-platform/tests/document-policy/reporting/oversized.jpg new file mode 100644 index 0000000000..497ed770bf Binary files /dev/null and b/testing/web-platform/tests/document-policy/reporting/oversized.jpg differ diff --git a/testing/web-platform/tests/document-policy/reporting/resources/sync-script.js b/testing/web-platform/tests/document-policy/reporting/resources/sync-script.js new file mode 100644 index 0000000000..10d582cb0e --- /dev/null +++ b/testing/web-platform/tests/document-policy/reporting/resources/sync-script.js @@ -0,0 +1,20 @@ +// This is deliberately split from sync-script-reporting.html so that it will +// not be blocked by policy, and can actuall be executed. + +var t = async_test("Sync-script Report Format"); + +var check_report_format = (reports, observer) => { + let report = reports[0]; + assert_equals(report.type, "document-policy-violation"); + assert_equals(report.url, document.location.href); + assert_equals(report.body.featureId, "sync-script"); + assert_equals(report.body.sourceFile, null); + assert_equals(report.body.lineNumber, null); + assert_equals(report.body.columnNumber, null); + assert_equals(report.body.disposition, "enforce"); + check_report_json(report); +}; + +new ReportingObserver(t.step_func_done(check_report_format), + { types: ['document-policy-violation'], + buffered: true}).observe(); diff --git a/testing/web-platform/tests/document-policy/reporting/sync-script-reporting.html b/testing/web-platform/tests/document-policy/reporting/sync-script-reporting.html new file mode 100644 index 0000000000..45e1b8fc3c --- /dev/null +++ b/testing/web-platform/tests/document-policy/reporting/sync-script-reporting.html @@ -0,0 +1,14 @@ + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/document-policy/reporting/sync-script-reporting.html.headers b/testing/web-platform/tests/document-policy/reporting/sync-script-reporting.html.headers new file mode 100644 index 0000000000..cfe200c27b --- /dev/null +++ b/testing/web-platform/tests/document-policy/reporting/sync-script-reporting.html.headers @@ -0,0 +1 @@ +Document-Policy: sync-script=?0 diff --git a/testing/web-platform/tests/document-policy/reporting/sync-xhr-report-only.html b/testing/web-platform/tests/document-policy/reporting/sync-xhr-report-only.html new file mode 100644 index 0000000000..a68cf713ee --- /dev/null +++ b/testing/web-platform/tests/document-policy/reporting/sync-xhr-report-only.html @@ -0,0 +1,28 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/document-policy/reporting/sync-xhr-report-only.html.headers b/testing/web-platform/tests/document-policy/reporting/sync-xhr-report-only.html.headers new file mode 100644 index 0000000000..8de201c750 --- /dev/null +++ b/testing/web-platform/tests/document-policy/reporting/sync-xhr-report-only.html.headers @@ -0,0 +1 @@ +Document-Policy-Report-Only: sync-xhr=?0 diff --git a/testing/web-platform/tests/document-policy/reporting/sync-xhr-reporting.html b/testing/web-platform/tests/document-policy/reporting/sync-xhr-reporting.html new file mode 100644 index 0000000000..3bcb63459d --- /dev/null +++ b/testing/web-platform/tests/document-policy/reporting/sync-xhr-reporting.html @@ -0,0 +1,36 @@ + + + + + + + + + + + diff --git a/testing/web-platform/tests/document-policy/reporting/sync-xhr-reporting.html.headers b/testing/web-platform/tests/document-policy/reporting/sync-xhr-reporting.html.headers new file mode 100644 index 0000000000..ab319fc4ce --- /dev/null +++ b/testing/web-platform/tests/document-policy/reporting/sync-xhr-reporting.html.headers @@ -0,0 +1 @@ +Document-Policy: sync-xhr=?0 diff --git a/testing/web-platform/tests/document-policy/reporting/unoptimized-image.jpg b/testing/web-platform/tests/document-policy/reporting/unoptimized-image.jpg new file mode 100644 index 0000000000..599137a55d Binary files /dev/null and b/testing/web-platform/tests/document-policy/reporting/unoptimized-image.jpg differ diff --git a/testing/web-platform/tests/document-policy/reporting/unsized-media-reporting-tentative.html b/testing/web-platform/tests/document-policy/reporting/unsized-media-reporting-tentative.html new file mode 100644 index 0000000000..47a3643646 --- /dev/null +++ b/testing/web-platform/tests/document-policy/reporting/unsized-media-reporting-tentative.html @@ -0,0 +1,24 @@ + + + + + + + + + + + diff --git a/testing/web-platform/tests/document-policy/reporting/unsized-media-reporting-tentative.html.headers b/testing/web-platform/tests/document-policy/reporting/unsized-media-reporting-tentative.html.headers new file mode 100644 index 0000000000..cf59933e8d --- /dev/null +++ b/testing/web-platform/tests/document-policy/reporting/unsized-media-reporting-tentative.html.headers @@ -0,0 +1 @@ +Document-Policy: unsized-media=?0 diff --git a/testing/web-platform/tests/document-policy/required-policy/document-policy.html b/testing/web-platform/tests/document-policy/required-policy/document-policy.html new file mode 100644 index 0000000000..aaa8d69200 --- /dev/null +++ b/testing/web-platform/tests/document-policy/required-policy/document-policy.html @@ -0,0 +1,54 @@ + + + + Test advertised required document policy + + + +

Test advertised required document policy

+ + + diff --git a/testing/web-platform/tests/document-policy/required-policy/document-policy.html.headers b/testing/web-platform/tests/document-policy/required-policy/document-policy.html.headers new file mode 100644 index 0000000000..20629ac15f --- /dev/null +++ b/testing/web-platform/tests/document-policy/required-policy/document-policy.html.headers @@ -0,0 +1 @@ +Document-Policy: lossless-images-max-bpp=1.1 diff --git a/testing/web-platform/tests/document-policy/required-policy/no-document-policy.html b/testing/web-platform/tests/document-policy/required-policy/no-document-policy.html new file mode 100644 index 0000000000..8a3624440f --- /dev/null +++ b/testing/web-platform/tests/document-policy/required-policy/no-document-policy.html @@ -0,0 +1,44 @@ + + + + Test advertised required document policy + + + +

Test advertised required document policy

+ + + diff --git a/testing/web-platform/tests/document-policy/required-policy/required-document-policy-nested.html b/testing/web-platform/tests/document-policy/required-policy/required-document-policy-nested.html new file mode 100644 index 0000000000..33de2533a2 --- /dev/null +++ b/testing/web-platform/tests/document-policy/required-policy/required-document-policy-nested.html @@ -0,0 +1,65 @@ + + + + Test advertised required document policy + + + +

Test advertised required document policy

+ + + diff --git a/testing/web-platform/tests/document-policy/required-policy/required-document-policy.html b/testing/web-platform/tests/document-policy/required-policy/required-document-policy.html new file mode 100644 index 0000000000..1058e3582a --- /dev/null +++ b/testing/web-platform/tests/document-policy/required-policy/required-document-policy.html @@ -0,0 +1,65 @@ + + + + Test advertised required document policy + + + +

Test advertised required document policy

+ + + diff --git a/testing/web-platform/tests/document-policy/required-policy/required-document-policy.html.headers b/testing/web-platform/tests/document-policy/required-policy/required-document-policy.html.headers new file mode 100644 index 0000000000..ac1bf268b5 --- /dev/null +++ b/testing/web-platform/tests/document-policy/required-policy/required-document-policy.html.headers @@ -0,0 +1 @@ +Require-Document-Policy: lossless-images-max-bpp=1.1 diff --git a/testing/web-platform/tests/document-policy/required-policy/separate-document-policies.html b/testing/web-platform/tests/document-policy/required-policy/separate-document-policies.html new file mode 100644 index 0000000000..1ed94a81e7 --- /dev/null +++ b/testing/web-platform/tests/document-policy/required-policy/separate-document-policies.html @@ -0,0 +1,64 @@ + + + + Test advertised required document policy + + + +

Test advertised required document policy

+ + + diff --git a/testing/web-platform/tests/document-policy/required-policy/separate-document-policies.html.headers b/testing/web-platform/tests/document-policy/required-policy/separate-document-policies.html.headers new file mode 100644 index 0000000000..3c593a32aa --- /dev/null +++ b/testing/web-platform/tests/document-policy/required-policy/separate-document-policies.html.headers @@ -0,0 +1,2 @@ +Document-Policy: lossless-images-max-bpp=1.1 +Require-Document-Policy: lossless-images-max-bpp=1.0 diff --git a/testing/web-platform/tests/document-policy/resources/document-policy-report-json.js b/testing/web-platform/tests/document-policy/resources/document-policy-report-json.js new file mode 100644 index 0000000000..035857ba39 --- /dev/null +++ b/testing/web-platform/tests/document-policy/resources/document-policy-report-json.js @@ -0,0 +1,20 @@ +/** + * @fileoverview functions for ensuring document policy report is serializable + */ + +const check_report_json = (report) => { + // Ensures toJSON method exists on report. + assert_equals(typeof report.toJSON, "function"); + const report_json = report.toJSON(); + // Ensures toJSON() call is successful. + assert_equals(report.type, report_json.type); + assert_equals(report.url, report_json.url); + assert_equals(report.body.featureId, report_json.body.featureId); + assert_equals(report.body.disposition, report_json.body.disposition); + assert_equals(report.body.sourceFile, report_json.body.sourceFile); + assert_equals(report.body.lineNumber, report_json.body.lineNumber); + assert_equals(report.body.columnNumber, report_json.body.columnNumber); + // Ensures JSON.stringify() serializes the report correctly. + assert_false(JSON.stringify(report) === "{}"); + assert_equals(JSON.stringify(report), JSON.stringify(report_json)); +} \ No newline at end of file -- cgit v1.2.3