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

@ -14,24 +14,22 @@
the referrer and referrer policy from the document.</p>
<script>
var css_test = async_test("Image from presentation attributes.");
var id = token();
var css_url = location.protocol + "//www1." + location.hostname + ":" + location.port + "/referrer-policy/generic/subresource/image.py" + "?id=" + id;
var img_url = css_url + "&report-headers";
async_test(function(css_test) {
var id = token();
var css_url = location.protocol + "//www1." + location.hostname + ":" + location.port + "/referrer-policy/generic/subresource/image.py" + "?id=" + id;
var img_url = css_url + "&report-headers";
document.body.background = css_url;
css_test.step_timeout(
queryXhr.bind(this, img_url,
function(message) {
css_test.step(function() {
assert_own_property(message, "headers");
assert_own_property(message, "referrer");
assert_equals(message.referrer, location.origin + "/");
});
css_test.done();
}),
1000);
</script>
document.body.background = css_url;
css_test.step_timeout(function() {
queryXhr(img_url, function(message) {
assert_own_property(message, "headers");
assert_own_property(message, "referrer");
assert_equals(message.referrer, location.origin + "/");
css_test.done();
}, null, null, css_test);
}, 1000);
}, "Image from presentation attributes.");
</script>
<div id="log"></div>
</body>