blob: a74da6a7a7d60fcdc35dd32873ea25cf5e356dea [file] [log] [blame]
<!DOCTYPE html>
<link rel="author" href="mtrzos@google.com" title="Maciek Trzos">
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/fetch/sec-metadata/resources/helper.js></script>
<link id="style" href="https://foo.bar" rel="stylesheet">
<body></body>
<script>
function generate_test(expected, name) {
async_test(t => {
t.step_timeout(_ => {
return fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=report-" + name)
.then(response => response.text())
.then(text => assert_header_equals(text, expected))
.then(_ => t.done());
}, 1000);
}, name + " report");
}
test(_ => {
let counter = 0;
document.addEventListener("securitypolicyviolation", (e) => {
counter++;
if (counter == 3) {
generate_test({"destination":"report", "site":"same-origin"}, "same-origin");
generate_test({"destination":"report", "site":"same-site"}, "same-site");
generate_test({"destination":"report", "site":"cross-site"}, "cross-site");
}
});
}, "Initialization.");
</script>