summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/client-hints/inner-delegation
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/client-hints/inner-delegation')
-rw-r--r--testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_all.sub.https.html37
-rw-r--r--testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_all.sub.https.html.headers2
-rw-r--r--testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_none.sub.https.html36
-rw-r--r--testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_none.sub.https.html.headers2
-rw-r--r--testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_self.sub.https.html37
-rw-r--r--testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_self.sub.https.html.headers2
-rw-r--r--testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_some.sub.https.html37
-rw-r--r--testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_some.sub.https.html.sub.headers2
-rw-r--r--testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_src.sub.https.html37
-rw-r--r--testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_src.sub.https.html.headers2
-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
23 files changed, 483 insertions, 0 deletions
diff --git a/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_all.sub.https.html b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_all.sub.https.html
new file mode 100644
index 0000000000..27ce76302d
--- /dev/null
+++ b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_all.sub.https.html
@@ -0,0 +1,37 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Client Hints: Delegation of hints to cross-origin frames and resources for *</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<body>
+<script>
+// Here's the set-up for this test:
+// Step 1. (Site 1 Window) verify ch-device-memory availability.
+// Step 2. (Site 1 Window) set up listener and embed Site 2 Frame.
+// Step 3. (Site 2 Frame) verify ch-device-memory availability.
+// Step 4. (Site 2 Frame) embeds Site 1 Frame.
+// Step 5. (Site 3 Frame) verify ch-device-memory availability.
+// Step 6. (Site 1 Window) exit.
+
+promise_test(async (t) => {
+ // Step 1
+ let r = await fetch("/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ assert_equals(r.status, 200, "Site 1 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");
+ assert_equals(r.status, 200, "Site 1 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");
+ assert_equals(r.status, 200, "Site 1 fetching Site 3 didn't recieve sec-ch-device-memory");
+ // Step 2
+ const site2Frame = document.createElement("iframe");
+ site2Frame.src = "https://{{hosts[alt][]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/accept_ch_delegation_to_all_iframe.sub.https.html";
+ site2Frame.allow = "ch-device-memory *"
+ document.body.appendChild(site2Frame);
+ // Step 6
+ return new Promise(resolve => {
+ window.addEventListener("message", resolve);
+ }).then(e => {
+ assert_equals(e.data, "ch-device-memory is available as expected for all");
+ });
+}, "postMessage: First-Party to Third-Party, Cross-Partition, Same-Origin");
+</script>
+</body>
diff --git a/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_all.sub.https.html.headers b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_all.sub.https.html.headers
new file mode 100644
index 0000000000..a8b1708b9d
--- /dev/null
+++ b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_all.sub.https.html.headers
@@ -0,0 +1,2 @@
+Permissions-Policy: ch-device-memory=(*)
+Accept-CH: Sec-CH-Device-Memory
diff --git a/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_none.sub.https.html b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_none.sub.https.html
new file mode 100644
index 0000000000..1d4bfffe0a
--- /dev/null
+++ b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_none.sub.https.html
@@ -0,0 +1,36 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Client Hints: Delegation of hints to cross-origin frames and resources for none</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<body>
+<script>
+// Here's the set-up for this test:
+// Step 1. (Site 1 Window) verify ch-device-memory availability.
+// Step 2. (Site 1 Window) set up listener and embed Site 2 Frame.
+// Step 3. (Site 2 Frame) verify ch-device-memory availability.
+// Step 4. (Site 2 Frame) embeds Site 1 Frame.
+// Step 5. (Site 3 Frame) verify ch-device-memory availability.
+// Step 6. (Site 1 Window) exit.
+
+promise_test(async (t) => {
+ // Step 1
+ let r = await fetch("/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ assert_equals(r.status, 400, "Site 1 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");
+ assert_equals(r.status, 400, "Site 1 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");
+ assert_equals(r.status, 400, "Site 1 fetching Site 3 did recieve sec-ch-device-memory");
+ // Step 2
+ const site2Frame = document.createElement("iframe");
+ site2Frame.src = "https://{{hosts[alt][]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/accept_ch_delegation_to_none_iframe.sub.https.html";
+ document.body.appendChild(site2Frame);
+ // Step 6
+ return new Promise(resolve => {
+ window.addEventListener("message", resolve);
+ }).then(e => {
+ assert_equals(e.data, "ch-device-memory is available as expected for none");
+ });
+}, "postMessage: First-Party to Third-Party, Cross-Partition, Same-Origin");
+</script>
+</body>
diff --git a/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_none.sub.https.html.headers b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_none.sub.https.html.headers
new file mode 100644
index 0000000000..0b260a43f0
--- /dev/null
+++ b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_none.sub.https.html.headers
@@ -0,0 +1,2 @@
+Permissions-Policy: ch-device-memory=()
+Accept-CH: Sec-CH-Device-Memory
diff --git a/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_self.sub.https.html b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_self.sub.https.html
new file mode 100644
index 0000000000..9647a8741a
--- /dev/null
+++ b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_self.sub.https.html
@@ -0,0 +1,37 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Client Hints: Delegation of hints to cross-origin frames and resources for self</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<body>
+<script>
+// Here's the set-up for this test:
+// Step 1. (Site 1 Window) verify ch-device-memory availability.
+// Step 2. (Site 1 Window) set up listener and embed Site 2 Frame.
+// Step 3. (Site 2 Frame) verify ch-device-memory availability.
+// Step 4. (Site 2 Frame) embeds Site 1 Frame.
+// Step 5. (Site 3 Frame) verify ch-device-memory availability.
+// Step 6. (Site 1 Window) exit.
+
+promise_test(async (t) => {
+ // Step 1
+ let r = await fetch("/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ assert_equals(r.status, 200, "Site 1 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");
+ assert_equals(r.status, 400, "Site 1 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");
+ assert_equals(r.status, 400, "Site 1 fetching Site 3 did recieve sec-ch-device-memory");
+ // Step 2
+ const site2Frame = document.createElement("iframe");
+ site2Frame.src = "https://{{hosts[alt][]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/accept_ch_delegation_to_self_iframe.sub.https.html";
+ site2Frame.allow = "ch-device-memory self"
+ document.body.appendChild(site2Frame);
+ // Step 6
+ return new Promise(resolve => {
+ window.addEventListener("message", resolve);
+ }).then(e => {
+ assert_equals(e.data, "ch-device-memory is available as expected for self");
+ });
+}, "postMessage: First-Party to Third-Party, Cross-Partition, Same-Origin");
+</script>
+</body>
diff --git a/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_self.sub.https.html.headers b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_self.sub.https.html.headers
new file mode 100644
index 0000000000..3b9de86bbd
--- /dev/null
+++ b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_self.sub.https.html.headers
@@ -0,0 +1,2 @@
+Permissions-Policy: ch-device-memory=(self)
+Accept-CH: Sec-CH-Device-Memory
diff --git a/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_some.sub.https.html b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_some.sub.https.html
new file mode 100644
index 0000000000..9ea0049c39
--- /dev/null
+++ b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_some.sub.https.html
@@ -0,0 +1,37 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Client Hints: Delegation of hints to cross-origin frames and resources for some</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<body>
+<script>
+// Here's the set-up for this test:
+// Step 1. (Site 1 Window) verify ch-device-memory availability.
+// Step 2. (Site 1 Window) set up listener and embed Site 2 Frame.
+// Step 3. (Site 2 Frame) verify ch-device-memory availability.
+// Step 4. (Site 2 Frame) embeds Site 1 Frame.
+// Step 5. (Site 3 Frame) verify ch-device-memory availability.
+// Step 6. (Site 1 Window) exit.
+
+promise_test(async (t) => {
+ // Step 1
+ let r = await fetch("/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ assert_equals(r.status, 200, "Site 1 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");
+ assert_equals(r.status, 200, "Site 1 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");
+ assert_equals(r.status, 400, "Site 1 fetching Site 3 did recieve sec-ch-device-memory");
+ // Step 2
+ const site2Frame = document.createElement("iframe");
+ site2Frame.src = "https://{{hosts[alt][]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe.sub.https.html";
+ site2Frame.allow = "ch-device-memory https://{{hosts[alt][]}}:{{ports[https][0]}}"
+ document.body.appendChild(site2Frame);
+ // Step 6
+ return new Promise(resolve => {
+ window.addEventListener("message", resolve);
+ }).then(e => {
+ assert_equals(e.data, "ch-device-memory is available as expected for some");
+ });
+}, "postMessage: First-Party to Third-Party, Cross-Partition, Same-Origin");
+</script>
+</body>
diff --git a/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_some.sub.https.html.sub.headers b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_some.sub.https.html.sub.headers
new file mode 100644
index 0000000000..24fe4e84c8
--- /dev/null
+++ b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_some.sub.https.html.sub.headers
@@ -0,0 +1,2 @@
+Permissions-Policy: ch-device-memory=("https://{{host}}:{{ports[https][0]}}" "https://{{hosts[alt][]}}:{{ports[https][0]}}")
+Accept-CH: Sec-CH-Device-Memory
diff --git a/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_src.sub.https.html b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_src.sub.https.html
new file mode 100644
index 0000000000..e01853e5e9
--- /dev/null
+++ b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_src.sub.https.html
@@ -0,0 +1,37 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Client Hints: Delegation of hints to cross-origin frames and resources for src</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<body>
+<script>
+// Here's the set-up for this test:
+// Step 1. (Site 1 Window) verify ch-device-memory availability.
+// Step 2. (Site 1 Window) set up listener and embed Site 2 Frame.
+// Step 3. (Site 2 Frame) verify ch-device-memory availability.
+// Step 4. (Site 2 Frame) embeds Site 1 Frame.
+// Step 5. (Site 3 Frame) verify ch-device-memory availability.
+// Step 6. (Site 1 Window) exit.
+
+promise_test(async (t) => {
+ // Step 1
+ let r = await fetch("/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py");
+ assert_equals(r.status, 200, "Site 1 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");
+ assert_equals(r.status, 400, "Site 1 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");
+ assert_equals(r.status, 400, "Site 1 fetching Site 3 did recieve sec-ch-device-memory");
+ // Step 2
+ const site2Frame = document.createElement("iframe");
+ site2Frame.src = "https://{{hosts[alt][]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/accept_ch_delegation_to_src_iframe.sub.https.html";
+ site2Frame.allow = "ch-device-memory src"
+ document.body.appendChild(site2Frame);
+ // Step 6
+ return new Promise(resolve => {
+ window.addEventListener("message", resolve);
+ }).then(e => {
+ assert_equals(e.data, "ch-device-memory is available as expected for src");
+ });
+}, "postMessage: First-Party to Third-Party, Cross-Partition, Same-Origin");
+</script>
+</body>
diff --git a/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_src.sub.https.html.headers b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_src.sub.https.html.headers
new file mode 100644
index 0000000000..3b9de86bbd
--- /dev/null
+++ b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_src.sub.https.html.headers
@@ -0,0 +1,2 @@
+Permissions-Policy: ch-device-memory=(self)
+Accept-CH: Sec-CH-Device-Memory
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