Commit 3b3993a7 authored by Ian Clelland's avatar Ian Clelland Committed by Commit Bot

Add WPT for separate document and required document policies

Bug: 993790
Change-Id: I7d90f98cd3a2b1ef63441a39ed51512b8068c927
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2015782Reviewed-by: default avatarIan Clelland <iclelland@chromium.org>
Reviewed-by: default avatarJason Chase <chasej@chromium.org>
Commit-Queue: Ian Clelland <iclelland@chromium.org>
Cr-Commit-Position: refs/heads/master@{#735412}
parent 6e93b9d3
...@@ -6185,6 +6185,8 @@ crbug.com/993790 external/wpt/document-policy/required-policy/document-policy.ht ...@@ -6185,6 +6185,8 @@ crbug.com/993790 external/wpt/document-policy/required-policy/document-policy.ht
crbug.com/993790 external/wpt/document-policy/required-policy/no-document-policy.html [ Failure ] crbug.com/993790 external/wpt/document-policy/required-policy/no-document-policy.html [ Failure ]
crbug.com/993790 external/wpt/document-policy/required-policy/required-document-policy-nested.html [ Failure ] crbug.com/993790 external/wpt/document-policy/required-policy/required-document-policy-nested.html [ Failure ]
crbug.com/993790 external/wpt/document-policy/required-policy/required-document-policy.html [ Failure ] crbug.com/993790 external/wpt/document-policy/required-policy/required-document-policy.html [ Failure ]
crbug.com/993790 external/wpt/document-policy/required-policy/separate-document-policies.html [ Failure ]
crbug.com/993790 virtual/document-policy/external/wpt/document-policy/required-policy/separate-document-policies.html [ Failure ]
# Temporary suppression to allow devtools-frontend changes # Temporary suppression to allow devtools-frontend changes
crbug.com/1029489 http/tests/devtools/elements/elements-linkify-attributes.js [ Pass Failure ] crbug.com/1029489 http/tests/devtools/elements/elements-linkify-attributes.js [ Pass Failure ]
......
<!DOCTYPE html>
<html>
<head>
<title>Test advertised required document policy</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> </head>
<body>
<h1>Test advertised required document policy</h1>
<script>
// The top-level document has a document policy, as well as a required document
// policy (for subframes) which is stricter. This test should load (the required
// policy should not block this page,) but the requirements should be applied to
// nested content.
callbacks = {};
window.addEventListener('message', ev => {
var id = ev.data.id;
if (id && callbacks[id]) {
callbacks[id](ev.data.requiredPolicy || null);
}
});
async_test(t => {
var iframe = document.createElement('iframe');
iframe.src = "/document-policy/echo-policy.py?id=1";
callbacks["1"] = t.step_func_done(result => {
assert_equals(result, "unoptimized-lossless-images;bpp=1.0");
});
document.body.appendChild(iframe);
}, "Child frame with no explicit policy should have the same required policy as its parent.");
async_test(t => {
var iframe = document.createElement('iframe');
iframe.src = "/document-policy/echo-policy.py?id=2";
iframe.policy = "unoptimized-lossless-images;bpp=4";
callbacks["2"] = t.step_func_done(result => {
assert_equals(result, "unoptimized-lossless-images;bpp=1.0");
});
document.body.appendChild(iframe);
}, "Child frame with a less strict required policy should have the stricter value from the parent's policy applied.");
async_test(t => {
var iframe = document.createElement('iframe');
iframe.src = "/document-policy/echo-policy.py?id=3";
iframe.policy = "unoptimized-lossless-images;bpp=0.9";
callbacks["3"] = t.step_func_done(result => {
assert_equals(result, "unoptimized-lossless-images;bpp=0.9");
});
document.body.appendChild(iframe);
}, "Child frame may have a stricter policy than the parent.");
async_test(t => {
var iframe = document.createElement('iframe');
iframe.src = "/document-policy/echo-policy.py?id=4";
iframe.policy = "no-font-display-late-swap";
callbacks["4"] = t.step_func_done(result => {
assert_equals(result, "no-font-display-late-swap, unoptimized-lossless-images;bpp=1.0");
});
document.body.appendChild(iframe);
}, "Any unrelated policy directives should combine with the parent's required policy.");
</script>
</body>
</html>
Document-Policy: unoptimized-lossless-images;bpp=1.1
Require-Document-Policy: unoptimized-lossless-images;bpp=1.0
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