Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/external/wpt/referrer-policy/css-integration/external-import-stylesheet.html |
| diff --git a/third_party/WebKit/LayoutTests/external/wpt/referrer-policy/css-integration/external-import-stylesheet.html b/third_party/WebKit/LayoutTests/external/wpt/referrer-policy/css-integration/external-import-stylesheet.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..cb66cde1f1cfb1bfe70c44be308cebbfb494b3cd |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/external/wpt/referrer-policy/css-integration/external-import-stylesheet.html |
| @@ -0,0 +1,50 @@ |
| +<!DOCTYPE html> |
| +<html> |
| + <head> |
| + <title>CSS integration - image from imported stylesheet (external)</title> |
| + <script src="/resources/testharness.js"></script> |
| + <script src="/resources/testharnessreport.js"></script> |
| + <script src="/common/utils.js"></script> |
| + <!-- Common global functions for referrer-policy tests. --> |
| + <script src="/referrer-policy/generic/common.js"></script> |
| + <meta name="referrer" content="never"> |
| + </head> |
| + <body> |
| + <p>Check that resources from imported stylesheets (loaded from external |
| + stylesheets) are loaded with the referrer and referrer policy from the |
| + external stylesheet.</p> |
| + |
| + <div class="styled"></div> |
| + |
| + <script> |
| + var css_test = async_test("Image from imported stylesheet (external)."); |
| + var id = token(); |
| + var crossOriginUrlPrefix = location.protocol + "//www1." + location.hostname + ":" + location.port; |
|
estark
2017/03/28 18:17:20
nit: naming convention differs here from line 20
(
jochen (gone - plz use gerrit)
2017/03/29 08:13:11
I opted for this_style
|
| + var cssUrl = crossOriginUrlPrefix + "/referrer-policy/generic/subresource/stylesheet.py?id=" + id + "&import-rule"; |
| + var urlPrefix = location.protocol + "//" + location.hostname + ":" + location.port; |
| + var cssReferrer = urlPrefix + "/referrer-policy/generic/subresource/stylesheet.py?id=" + id; |
|
estark
2017/03/28 18:17:21
I've been staring at this test and can't figure ou
|
| + var imgUrl = urlPrefix + "/referrer-policy/generic/subresource/image.py" + |
| + "?id=" + id + "&report-headers"; |
| + |
| + var link = document.createElement("link"); |
| + link.href = cssUrl; |
| + link.rel = "stylesheet"; |
| + link.onload = function() { |
| + css_test.step_timeout( |
| + queryXhr.bind(this, imgUrl, |
| + function(message) { |
| + css_test.step(function() { |
| + assert_own_property(message, "headers"); |
| + assert_own_property(message, "referrer"); |
| + assert_equals(message.referrer, cssReferrer); |
| + }); |
| + css_test.done(); |
| + }), |
| + 1000); |
| + }; |
| + document.head.appendChild(link); |
| + </script> |
| + |
| + <div id="log"></div> |
| + </body> |
| +</html> |