Wrap more of the referrer-policy tests in testharness.js.

This commit is contained in:
Josh Matthews 2018-12-20 16:14:15 -05:00
parent bffe2a699e
commit 3cd6df1ef9
30 changed files with 540 additions and 583 deletions

View file

@ -17,33 +17,31 @@
<div class="styled"></div>
<script>
let css_test = async_test("Font from external stylesheet (from ProcessingInstruction).");
let id = token();
let url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;
let css_url = url_prefix +
"/referrer-policy/generic/subresource/stylesheet.py?id=" +
id + "&amp;type=font";
let expected = url_prefix +
"/referrer-policy/generic/subresource/stylesheet.py?id=" +
id + "&type=font";
let font_url = url_prefix + "/referrer-policy/generic/subresource/font.py" +
"?id=" + id + "&report-headers";
async_test(function(css_test) {
let id = token();
let url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;
let css_url = url_prefix +
"/referrer-policy/generic/subresource/stylesheet.py?id=" +
id + "&amp;type=font";
let expected = url_prefix +
"/referrer-policy/generic/subresource/stylesheet.py?id=" +
id + "&type=font";
let font_url = url_prefix + "/referrer-policy/generic/subresource/font.py" +
"?id=" + id + "&report-headers";
let processingInstruction =
document.createProcessingInstruction(
"xml-stylesheet", "href=\"" + css_url + "\" type=\"text/css\"");
css_test.step_timeout(
queryXhr.bind(this, font_url,
function(message) {
css_test.step(function() {
assert_own_property(message, "headers");
assert_own_property(message, "referrer");
assert_equals(message.referrer, expected);
});
css_test.done();
}),
1000);
document.insertBefore(processingInstruction, document.firstChild);
let processingInstruction =
document.createProcessingInstruction(
"xml-stylesheet", "href=\"" + css_url + "\" type=\"text/css\"");
css_test.step_timeout(function() {
queryXhr(font_url, function(message) {
assert_own_property(message, "headers");
assert_own_property(message, "referrer");
assert_equals(message.referrer, expected);
css_test.done();
}, null, null, css_test);
}, 1000);
document.insertBefore(processingInstruction, document.firstChild);
}, "Font from external stylesheet (from ProcessingInstruction).");
</script>
<div id="log"></div>