Commit d5b6116a authored by Charlie Hu's avatar Charlie Hu Committed by Commit Bot

Remove wpt/feature-policy/parameters tests

This CL removes tests under directory
third_party/blink/web_tests/external/wpt/feature-policy/parameters/
because params are no longer to be supported for feature policy.

All parameterized policy are going to be migrated to document policy.

Change-Id: I758f3834459bfb0404b4edf09d31af190b619c7e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2089618
Commit-Queue: Charlie Hu <chenleihu@google.com>
Reviewed-by: default avatarIan Clelland <iclelland@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748060}
parent de8b5d44
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test oversized-images policy with threshold 'inf'</title>
</head>
<body>
<!-- The sample image has an intrinsic image size of 200x200px -->
<img src="resources/sample-1.png" width="200" height="200">
<img src="resources/sample-1.png" width="100" height="200">
<img src="resources/sample-1.png" width="50" height="200">
<br>
<img src="resources/sample-1.png" width="200" height="100">
<img src="resources/sample-1.png" width="100" height="100">
<img src="resources/sample-1.png" width="50" height="100">
<br>
<img src="resources/sample-1.png" width="200" height="50">
<img src="resources/sample-1.png" width="100" height="50">
<img src="resources/sample-1.png" width="50" height="50">
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/feature-policy/resources/featurepolicy.js"></script>
<title>Test oversized-images policy with threshold 1.5</title>
</head>
<body>
<iframe scrolling="no" name="a" style="overflow:hidden" width="380" height="220"></iframe>
<iframe scrolling="no" name="b" style="overflow:hidden" width="380" height="220"></iframe>
<iframe scrolling="no" name="c" style="overflow:hidden" width="380" height="220"></iframe>
<iframe scrolling="no" name="d" style="overflow:hidden" width="380" height="220"></iframe>
<iframe scrolling="no" name="e" style="overflow:hidden" width="380" height="220"></iframe>
<script>
const frame_to_test_map = {};
window.addEventListener('message', ev => {
if (ev.data.type == "finished") {
if (frame_to_test_map.hasOwnProperty(ev.data.name)) {
frame_to_test_map[ev.data.name].done();
}
}
});
const config = {
a: {threshold: 0.0, blocked: 3},
b: {threshold: 1.0, blocked: 2},
c: {threshold: 2.5, blocked: 1},
d: {threshold: 4.0, blocked: 0},
e: {threshold: "inf", blocked: 0}
};
const iframes = document.querySelectorAll('iframe');
const total_iframes = iframes.length;
iframes.forEach(iframe => {
const frame_config = config[iframe.name]
async_test(t => {
frame_to_test_map[iframe.name] = t;
iframe.src = "resources/feature-parameters-frame.html?name="+iframe.name+"&n="+frame_config.blocked+"&pipe=header(Feature-Policy,oversized-images%20("+frame_config.threshold+"\\);)";
}, "Test frame with threshold " + frame_config.threshold + " should block " + frame_config.blocked + " images.");
});
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/feature-policy/resources/featurepolicy.js"></script>
<title>Test oversized-images policy with threshold 1.5</title>
</head>
<body>
<!-- The sample image has an intrinsic image size of 200x200px -->
<img src="resources/sample-1.png" width="200" height="200">
<img src="resources/sample-1.png" width="100" height="200">
<img src="resources/sample-1.png" width="50" height="200">
<br>
<img src="resources/sample-1.png" width="200" height="100">
<img src="resources/sample-1.png" width="100" height="100">
<img src="resources/sample-1.png" width="50" height="100">
<br>
<img src="resources/sample-1.png" width="200" height="50">
<img src="resources/sample-1.png" width="100" height="50">
<img src="resources/sample-1.png" width="50" height="50">
<script>
expect_reports(8, "oversized-images", "8 images should be blocked by policy");
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/feature-policy/resources/featurepolicy.js"></script>
<title>Test oversized-images policy in subframe</title>
</head>
<body>
<!-- The sample image has an intrinsic image size of 200x200px -->
<img width="200" height="200">
<img width="100" height="200">
<img width="50" height="200">
<script>
const policy_name = "oversized-images";
const params = new URLSearchParams(document.location.search);
const frame_name = params.get('name');
const expected_report_count = +params.get('n');
var num_received_reports = 0;
const images = document.querySelectorAll('img');
const total_images = images.length;
var images_loaded = 0;
const notifyIfDone = () => {
if (num_received_reports >= expected_report_count &&
images_loaded == total_images) {
parent.postMessage({
"type": "finished",
"name": frame_name
},"*");
}
};
images.forEach(image => {
image.addEventListener('load', () => { images_loaded++; notifyIfDone(); });
image.src = "sample-1.png";
});
new ReportingObserver((reports, observer) => {
const relevant_reports = reports.filter(r => (r.body.featureId === policy_name));
num_received_reports += relevant_reports.length;
notifyIfDone();
}, {types: ['feature-policy-violation'], buffered: true}).observe();
</script>
</body>
</html>
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