summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/client-hints/inner-delegation/resources
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/client-hints/inner-delegation/resources')
-rw-r--r--testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_all_iframe.sub.https.html32
-rw-r--r--testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_all_iframe_iframe.sub.https.html23
-rw-r--r--testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_none_iframe.sub.https.html32
-rw-r--r--testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_none_iframe_iframe.sub.https.html23
-rw-r--r--testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_self_iframe.sub.https.html32
-rw-r--r--testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_self_iframe_iframe.sub.https.html23
-rw-r--r--testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe.sub.https.html32
-rw-r--r--testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe.sub.https.html.headers1
-rw-r--r--testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe_iframe.sub.https.html23
-rw-r--r--testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe_iframe.sub.https.html.sub.headers1
-rw-r--r--testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_src_iframe.sub.https.html33
-rw-r--r--testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_src_iframe_iframe.sub.https.html23
-rw-r--r--testing/web-platform/tests/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py11
13 files changed, 289 insertions, 0 deletions
diff --git a/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_all_iframe.sub.https.html b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_all_iframe.sub.https.html
new file mode 100644
index 0000000000..09df9ec46f
--- /dev/null
+++ b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_all_iframe.sub.https.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<meta charset=utf-8>
+<body>
+<script>
+async function test() {
+ // Step 3 (client-hints/inner-delegation/accept_ch_delegation_to_all.sub.https.html)
+ let r = await fetch("https://{{host}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ if (r.status == 200) {
+ return "Site 2 fetching Site 1 did recieve sec-ch-device-memory";
+ }
+ r = await fetch("/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ if (r.status != 200) {
+ return "Site 2 fetching Site 2 didn't recieve sec-ch-device-memory";
+ }
+ r = await fetch("https://{{domains[www2]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ if (r.status == 200) {
+ return "Site 2 fetching Site 3 did recieve sec-ch-device-memory";
+ }
+ // Step 4 (client-hints/inner-delegation/accept_ch_delegation_to_all.sub.https.html)
+ const site3Frame = document.createElement("iframe");
+ site3Frame.src = "https://{{domains[www2]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/accept_ch_delegation_to_all_iframe_iframe.sub.https.html";
+ site3Frame.allow = "ch-device-memory *"
+ document.body.appendChild(site3Frame);
+ return ""
+}
+test().then((message) => {
+ if (message) {
+ window.top.postMessage(message, "*");
+ }
+});
+</script>
+</body>
diff --git a/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_all_iframe_iframe.sub.https.html b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_all_iframe_iframe.sub.https.html
new file mode 100644
index 0000000000..4291ae954c
--- /dev/null
+++ b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_all_iframe_iframe.sub.https.html
@@ -0,0 +1,23 @@
+<!doctype html>
+<meta charset=utf-8>
+<body>
+<script>
+async function test() {
+ // Step 5 (client-hints/inner-delegation/accept_ch_delegation_to_all.sub.https.html)
+ let r = await fetch("https://{{host}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ if (r.status == 200) {
+ return "Site 3 fetching Site 1 did recieve sec-ch-device-memory";
+ }
+ r = await fetch("https://{{hosts[alt][]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ if (r.status == 200) {
+ return "Site 3 fetching Site 2 did recieve sec-ch-device-memory";
+ }
+ r = await fetch("/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ if (r.status != 200) {
+ return "Site 3 fetching Site 3 didn't recieve sec-ch-device-memory";
+ }
+ return "ch-device-memory is available as expected for all"
+}
+test().then((message) => window.top.postMessage(message, "*"));
+</script>
+</body>
diff --git a/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_none_iframe.sub.https.html b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_none_iframe.sub.https.html
new file mode 100644
index 0000000000..cd88fa54fc
--- /dev/null
+++ b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_none_iframe.sub.https.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<meta charset=utf-8>
+<body>
+<script>
+async function test() {
+ // Step 3 (client-hints/inner-delegation/accept_ch_delegation_to_none.sub.https.html)
+ let r = await fetch("https://{{host}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ if (r.status == 200) {
+ return "Site 2 fetching Site 1 did recieve sec-ch-device-memory";
+ }
+ r = await fetch("/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ if (r.status == 200) {
+ return "Site 2 fetching Site 2 did recieve sec-ch-device-memory";
+ }
+ r = await fetch("https://{{domains[www2]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ if (r.status == 200) {
+ return "Site 2 fetching Site 3 did recieve sec-ch-device-memory";
+ }
+ // Step 4 (client-hints/inner-delegation/accept_ch_delegation_to_none.sub.https.html)
+ const site3Frame = document.createElement("iframe");
+ site3Frame.src = "https://{{domains[www2]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/accept_ch_delegation_to_none_iframe_iframe.sub.https.html";
+ site3Frame.allow = "ch-device-memory none"
+ document.body.appendChild(site3Frame);
+ return ""
+}
+test().then((message) => {
+ if (message) {
+ window.top.postMessage(message, "*");
+ }
+});
+</script>
+</body>
diff --git a/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_none_iframe_iframe.sub.https.html b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_none_iframe_iframe.sub.https.html
new file mode 100644
index 0000000000..5d661f4b15
--- /dev/null
+++ b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_none_iframe_iframe.sub.https.html
@@ -0,0 +1,23 @@
+<!doctype html>
+<meta charset=utf-8>
+<body>
+<script>
+async function test() {
+ // Step 5 (client-hints/inner-delegation/accept_ch_delegation_to_none.sub.https.html)
+ let r = await fetch("https://{{host}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ if (r.status == 200) {
+ return "Site 3 fetching Site 1 did recieve sec-ch-device-memory";
+ }
+ r = await fetch("https://{{hosts[alt][]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ if (r.status == 200) {
+ return "Site 3 fetching Site 2 did recieve sec-ch-device-memory";
+ }
+ r = await fetch("/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ if (r.status == 200) {
+ return "Site 3 fetching Site 3 did recieve sec-ch-device-memory";
+ }
+ return "ch-device-memory is available as expected for none"
+}
+test().then((message) => window.top.postMessage(message, "*"));
+</script>
+</body>
diff --git a/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_self_iframe.sub.https.html b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_self_iframe.sub.https.html
new file mode 100644
index 0000000000..92157f4989
--- /dev/null
+++ b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_self_iframe.sub.https.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<meta charset=utf-8>
+<body>
+<script>
+async function test() {
+ // Step 3 (client-hints/inner-delegation/accept_ch_delegation_to_self.sub.https.html)
+ let r = await fetch("https://{{host}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ if (r.status == 200) {
+ return "Site 2 fetching Site 1 did recieve sec-ch-device-memory";
+ }
+ r = await fetch("/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ if (r.status == 200) {
+ return "Site 2 fetching Site 2 did recieve sec-ch-device-memory";
+ }
+ r = await fetch("https://{{domains[www2]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ if (r.status == 200) {
+ return "Site 2 fetching Site 3 did recieve sec-ch-device-memory";
+ }
+ // Step 4 (client-hints/inner-delegation/accept_ch_delegation_to_self.sub.https.html)
+ const site3Frame = document.createElement("iframe");
+ site3Frame.src = "https://{{domains[www2]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/accept_ch_delegation_to_self_iframe_iframe.sub.https.html";
+ site3Frame.allow = "ch-device-memory self"
+ document.body.appendChild(site3Frame);
+ return ""
+}
+test().then((message) => {
+ if (message) {
+ window.top.postMessage(message, "*");
+ }
+});
+</script>
+</body>
diff --git a/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_self_iframe_iframe.sub.https.html b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_self_iframe_iframe.sub.https.html
new file mode 100644
index 0000000000..e12759e076
--- /dev/null
+++ b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_self_iframe_iframe.sub.https.html
@@ -0,0 +1,23 @@
+<!doctype html>
+<meta charset=utf-8>
+<body>
+<script>
+async function test() {
+ // Step 5 (client-hints/inner-delegation/accept_ch_delegation_to_self.sub.https.html)
+ let r = await fetch("https://{{host}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ if (r.status == 200) {
+ return "Site 3 fetching Site 1 did recieve sec-ch-device-memory";
+ }
+ r = await fetch("https://{{hosts[alt][]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ if (r.status == 200) {
+ return "Site 3 fetching Site 2 did recieve sec-ch-device-memory";
+ }
+ r = await fetch("/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ if (r.status == 200) {
+ return "Site 3 fetching Site 3 did recieve sec-ch-device-memory";
+ }
+ return "ch-device-memory is available as expected for self"
+}
+test().then((message) => window.top.postMessage(message, "*"));
+</script>
+</body>
diff --git a/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe.sub.https.html b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe.sub.https.html
new file mode 100644
index 0000000000..39a4307230
--- /dev/null
+++ b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe.sub.https.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<meta charset=utf-8>
+<body>
+<script>
+async function test() {
+ // Step 3 (client-hints/inner-delegation/accept_ch_delegation_to_some.sub.https.html)
+ let r = await fetch("https://{{host}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ if (r.status != 200) {
+ return "Site 2 fetching Site 1 didn't recieve sec-ch-device-memory";
+ }
+ r = await fetch("/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ if (r.status != 200) {
+ return "Site 2 fetching Site 2 didn't recieve sec-ch-device-memory";
+ }
+ r = await fetch("https://{{domains[www2]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ if (r.status != 200) {
+ return "Site 2 fetching Site 3 didn't recieve sec-ch-device-memory";
+ }
+ // Step 4 (client-hints/inner-delegation/accept_ch_delegation_to_some.sub.https.html)
+ const site3Frame = document.createElement("iframe");
+ site3Frame.src = "https://{{domains[www2]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe_iframe.sub.https.html";
+ site3Frame.allow = "ch-device-memory https://{{domains[www2]}}:{{ports[https][0]}}"
+ document.body.appendChild(site3Frame);
+ return ""
+}
+test().then((message) => {
+ if (message) {
+ window.top.postMessage(message, "*");
+ }
+});
+</script>
+</body>
diff --git a/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe.sub.https.html.headers b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe.sub.https.html.headers
new file mode 100644
index 0000000000..3e53702c6e
--- /dev/null
+++ b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe.sub.https.html.headers
@@ -0,0 +1 @@
+Permissions-Policy: ch-device-memory=(*)
diff --git a/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe_iframe.sub.https.html b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe_iframe.sub.https.html
new file mode 100644
index 0000000000..999e3b6c99
--- /dev/null
+++ b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe_iframe.sub.https.html
@@ -0,0 +1,23 @@
+<!doctype html>
+<meta charset=utf-8>
+<body>
+<script>
+async function test() {
+ // Step 5 (client-hints/inner-delegation/accept_ch_delegation_to_some.sub.https.html)
+ let r = await fetch("https://{{host}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ if (r.status != 200) {
+ return "Site 3 fetching Site 1 didn't recieve sec-ch-device-memory";
+ }
+ r = await fetch("https://{{hosts[alt][]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ if (r.status == 200) {
+ return "Site 3 fetching Site 2 did recieve sec-ch-device-memory";
+ }
+ r = await fetch("/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ if (r.status == 200) {
+ return "Site 3 fetching Site 3 did recieve sec-ch-device-memory";
+ }
+ return "ch-device-memory is available as expected for some"
+}
+test().then((message) => window.top.postMessage(message, "*"));
+</script>
+</body>
diff --git a/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe_iframe.sub.https.html.sub.headers b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe_iframe.sub.https.html.sub.headers
new file mode 100644
index 0000000000..e8ccc92f51
--- /dev/null
+++ b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe_iframe.sub.https.html.sub.headers
@@ -0,0 +1 @@
+Permissions-Policy: ch-device-memory=("https://{{host}}:{{ports[https][0]}}")
diff --git a/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_src_iframe.sub.https.html b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_src_iframe.sub.https.html
new file mode 100644
index 0000000000..05d1db9fc9
--- /dev/null
+++ b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_src_iframe.sub.https.html
@@ -0,0 +1,33 @@
+<!doctype html>
+<meta charset=utf-8>
+<body>
+<script>
+async function test() {
+ // Step 3 (client-hints/inner-delegation/accept_ch_delegation_to_src.sub.https.html)
+ const policy = JSON.stringify(document.featurePolicy.getAllowlistForFeature("ch-device-memory"));
+ let r = await fetch("https://{{host}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ if (r.status == 200) {
+ return "Site 2 fetching Site 1 did recieve sec-ch-device-memory";
+ }
+ r = await fetch("/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ if (r.status == 200) {
+ return "Site 2 fetching Site 2 did recieve sec-ch-device-memory";
+ }
+ r = await fetch("https://{{domains[www2]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ if (r.status == 200) {
+ return "Site 2 fetching Site 3 did recieve sec-ch-device-memory";
+ }
+ // Step 4 (client-hints/inner-delegation/accept_ch_delegation_to_src.sub.https.html)
+ const site3Frame = document.createElement("iframe");
+ site3Frame.src = "https://{{domains[www2]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/accept_ch_delegation_to_src_iframe_iframe.sub.https.html";
+ site3Frame.allow = "ch-device-memory src"
+ document.body.appendChild(site3Frame);
+ return ""
+}
+test().then((message) => {
+ if (message) {
+ window.top.postMessage(message, "*");
+ }
+});
+</script>
+</body>
diff --git a/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_src_iframe_iframe.sub.https.html b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_src_iframe_iframe.sub.https.html
new file mode 100644
index 0000000000..497a19161f
--- /dev/null
+++ b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_src_iframe_iframe.sub.https.html
@@ -0,0 +1,23 @@
+<!doctype html>
+<meta charset=utf-8>
+<body>
+<script>
+async function test() {
+ // Step 5 (client-hints/inner-delegation/accept_ch_delegation_to_src.sub.https.html)
+ let r = await fetch("https://{{host}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ if (r.status == 200) {
+ return "Site 3 fetching Site 1 did recieve sec-ch-device-memory";
+ }
+ r = await fetch("https://{{hosts[alt][]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ if (r.status == 200) {
+ return "Site 3 fetching Site 2 did recieve sec-ch-device-memory";
+ }
+ r = await fetch("/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ if (r.status == 200) {
+ return "Site 3 fetching Site 3 did recieve sec-ch-device-memory";
+ }
+ return "ch-device-memory is available as expected for src"
+}
+test().then((message) => window.top.postMessage(message, "*"));
+</script>
+</body>
diff --git a/testing/web-platform/tests/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py b/testing/web-platform/tests/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py
new file mode 100644
index 0000000000..f57e121252
--- /dev/null
+++ b/testing/web-platform/tests/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py
@@ -0,0 +1,11 @@
+def main(request, response):
+ """
+ Simple handler that sets the status based on whether sec-ch-device-memory was received.
+ """
+ response.headers.append(b"Access-Control-Allow-Origin", b"*")
+ response.headers.append(b"Access-Control-Allow-Headers", b"*")
+ response.headers.append(b"Access-Control-Expose-Headers", b"*")
+ if b"sec-ch-device-memory" in request.headers:
+ response.status = 200
+ else:
+ response.status = 400 \ No newline at end of file