Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Unified Diff: LayoutTests/http/tests/security/referrer-policy-attribute-iframe.html

Issue 1328183002: Implement referrerpolicy attr for iframes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: move referrerpolicy retrieval to subclass Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/http/tests/security/referrer-policy-attribute-iframe.html
diff --git a/LayoutTests/http/tests/security/referrer-policy-attribute-iframe.html b/LayoutTests/http/tests/security/referrer-policy-attribute-iframe.html
new file mode 100644
index 0000000000000000000000000000000000000000..c6edf6038bbe43750dee9a33c38c0a8637924b50
--- /dev/null
+++ b/LayoutTests/http/tests/security/referrer-policy-attribute-iframe.html
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <meta name="referrer" content="origin">
+ <script>
+ async_test(function () {
+ window.onmessage = this.step_func(function (event) {
+ if (event.data.policy === "no-referrer") {
+ assert_equals(event.data.referrer, "");
+ this.done();
+ }
+ });
+ }, "no-referrer attribute on iframe");
+ </script>
+
+ <iframe src="resources/referrer-attr-iframe-target.html#no-referrer"
+ referrerpolicy="no-referrer" />
+
+ <script>
+ async_test(function () {
+ window.onmessage = this.step_func(function (event) {
+ if (event.data.policy === "origin-when-crossorigin") {
+ assert_equals(event.data.referrer, "http://127.0.0.1:8000/");
+ this.done();
+ }
+ });
+ }, "origin-when-crossorigin referrerpolicy attribute on iframe");
+ </script>
+
+ <iframe src="resources/referrer-attr-iframe-target.html#origin-when-crossorigin"
+ referrerpolicy="origin-when-crossorigin" />
+
+ <script>
+ async_test(function () {
+ window.onmessage = this.step_func(function (event) {
+ if (event.data.policy === "origin") {
+ assert_equals(event.data.referrer, "http://127.0.0.1:8000/");
+ this.done();
+ }
+ });
+ }, "origin referrerpolicy attribute on iframe");
+ </script>
+
+ <iframe src="resources/referrer-attr-iframe-target.html#origin"
+ referrerpolicy="origin" />
+
+ <script>
+ async_test(function () {
+ window.onmessage = this.step_func(function (event) {
+ if (event.data.policy === "unsafe-url") {
+ assert_equals(event.data.referrer, "http://127.0.0.1:8000/security/referrer-policy-attribute-iframe.html");
+ this.done();
+ }
+ });
+ }, "unsafe-url referrerpolicy attribute on iframe");
+ </script>
+
+ <iframe src="http://localhost:8000/security/resources/referrer-attr-iframe-target.html#unsafe-url" referrerpolicy="unsafe-url" />
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698