Bug 1622035 [wpt PR 22221] - Migrate UnsizedMedia from feature policy to document policy, a=testonly

Automatic update from web-platform-tests
Migrate UnsizedMedia from feature policy to document policy

This CL migrates UnsizedMedia from feature policy to document policy.

Following web tests are being migrated:
- unsized-media.tentative.https.sub.html
- unsized-media-reporting.html

Following web tests are removed, because document policy currently
does not have a js API to list all features available.
- feature-policy-unsized-media-disabled.html
- feature-policy-unsized-media-enabled.html

Bug: 993790
Change-Id: Id5e0189c0277c940177460380970eab0015109d0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2097028
Commit-Queue: Charlie Hu <chenleihu@google.com>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Philip Jägenstedt <foolip@chromium.org>
Reviewed-by: Ian Clelland <iclelland@chromium.org>
Cr-Commit-Position: refs/heads/master@{#750246}

--

wpt-commits: 550ab235e713dc584eb0e60ecc3861a11b644f02
wpt-pr: 22221


--HG--
rename : testing/web-platform/tests/feature-policy/experimental-features/resources/image.jpg => testing/web-platform/tests/document-policy/experimental-features/resources/image.jpg
rename : testing/web-platform/tests/feature-policy/experimental-features/resources/image.png => testing/web-platform/tests/document-policy/experimental-features/resources/image.png
rename : testing/web-platform/tests/feature-policy/experimental-features/resources/image.svg => testing/web-platform/tests/document-policy/experimental-features/resources/image.svg
rename : testing/web-platform/tests/feature-policy/experimental-features/resources/video.ogv => testing/web-platform/tests/document-policy/experimental-features/resources/video.ogv
rename : testing/web-platform/tests/feature-policy/reporting/image.jpg => testing/web-platform/tests/document-policy/reporting/image.jpg
This commit is contained in:
Charlie Hu 2020-03-14 11:30:15 +00:00 committed by moz-wptsync-bot
parent 2a8be286c7
commit 91ea6a3c75
12 changed files with 15 additions and 14 deletions

View File

@ -3,7 +3,7 @@
<script>
window.addEventListener('load', function() {
var img = document.createElement('IMG');
img.setAttribute("src", "/feature-policy/experimental-features/resources/image.jpg");
img.setAttribute("src", "/document-policy/experimental-features/resources/image.jpg");
img.addEventListener('load', function() {
parent.postMessage({width: img.width, height: img.height}, '*');
});

View File

@ -8,9 +8,9 @@
const default_width = 300;
const default_height = 150;
const srcs = [
"/feature-policy/experimental-features/resources/image.jpg",
"/feature-policy/experimental-features/resources/image.png",
"/feature-policy/experimental-features/resources/image.svg"
"/document-policy/experimental-features/resources/image.jpg",
"/document-policy/experimental-features/resources/image.png",
"/document-policy/experimental-features/resources/image.svg"
];
const test_cases = [
// Test when no size is specified, img/video is laid out by the default size.
@ -60,7 +60,7 @@ for (var test of test_cases) {
}));
var expected_width = test.expected_width;
var expected_height = test.expected_height;
video.setAttribute("src", "/feature-policy/experimental-features/resources/video.ogv");
video.setAttribute("src", "/document-policy/experimental-features/resources/video.ogv");
if (typeof test.attribute !== "undefined") {
video.setAttribute(test.attribute, test.value);
}
@ -72,11 +72,12 @@ for (var test of test_cases) {
' and attribute ' + test.attribute1 + '=' + test.value1);
}
// Test unsized-image works in local and remote iframes.
// Subframes do not inherit document policy from parent frame.
// Unsized-Media should not work in subframes.
var iframe = document.querySelector('iframe');
var iframe_srcs = [
"/feature-policy/experimental-features/resources/feature-policy-image.html",
"https://{{domains[www]}}:{{ports[https][0]}}/feature-policy/experimental-features/resources/feature-policy-image.html"];
"/document-policy/experimental-features/resources/document-policy-image.html",
"https://{{domains[www]}}:{{ports[https][0]}}/document-policy/experimental-features/resources/document-policy-image.html"];
for (var src of iframe_srcs) {
promise_test(function() {
iframe.src = src;
@ -85,8 +86,8 @@ for (var src of iframe_srcs) {
resolve(e.data);
});
}).then(function(data) {
assert_equals(data.width, default_width, 'width');
assert_equals(data.height, default_height, 'height');
assert_not_equals(data.width, default_width, 'width');
assert_not_equals(data.height, default_height, 'height');
});
}, 'Test image size is correctly rendered in iframe of src ' + src);
}

View File

@ -0,0 +1 @@
Document-Policy: no-unsized-media

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -9,7 +9,7 @@
<script>
var check_report_format = (reports, observer) => {
let report = reports[0];
assert_equals(report.type, "feature-policy-violation");
assert_equals(report.type, "document-policy-violation");
assert_equals(report.url, document.location.href);
assert_equals(report.body.featureId, "unsized-media");
assert_equals(report.body.disposition, "enforce");
@ -17,7 +17,7 @@ var check_report_format = (reports, observer) => {
async_test(t => {
new ReportingObserver(t.step_func_done(check_report_format),
{types: ['feature-policy-violation'], buffered: true}).observe();
{types: ['document-policy-violation'], buffered: true}).observe();
}, "Unsized-media Report Format");
</script>
</body>

View File

@ -0,0 +1 @@
Document-Policy: no-unsized-media

View File

@ -1 +0,0 @@
Feature-Policy: unsized-media 'none'