diff --git a/battery-status/META.yml b/battery-status/META.yml index 12a2f12c32e9c5..a069984ddb226b 100644 --- a/battery-status/META.yml +++ b/battery-status/META.yml @@ -2,3 +2,4 @@ spec: https://w3c.github.io/battery/ suggested_reviewers: - anssiko - zqzhang + - Honry diff --git a/battery-status/battery-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html b/battery-status/battery-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html new file mode 100644 index 00000000000000..47a9cbac0fc4da --- /dev/null +++ b/battery-status/battery-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html @@ -0,0 +1,28 @@ + + + + + + + diff --git a/battery-status/battery-allowed-by-feature-policy-attribute.https.sub.html b/battery-status/battery-allowed-by-feature-policy-attribute.https.sub.html new file mode 100644 index 00000000000000..96bca54ec8e087 --- /dev/null +++ b/battery-status/battery-allowed-by-feature-policy-attribute.https.sub.html @@ -0,0 +1,27 @@ + + + + + + + diff --git a/battery-status/battery-allowed-by-feature-policy.https.sub.html b/battery-status/battery-allowed-by-feature-policy.https.sub.html new file mode 100644 index 00000000000000..5849af5750148f --- /dev/null +++ b/battery-status/battery-allowed-by-feature-policy.https.sub.html @@ -0,0 +1,28 @@ + + + + + + + diff --git a/battery-status/battery-allowed-by-feature-policy.https.sub.html.headers b/battery-status/battery-allowed-by-feature-policy.https.sub.html.headers new file mode 100644 index 00000000000000..03b98040cc4d2e --- /dev/null +++ b/battery-status/battery-allowed-by-feature-policy.https.sub.html.headers @@ -0,0 +1 @@ +Feature-Policy: battery * diff --git a/battery-status/battery-iframe.https.html b/battery-status/battery-allowed-in-same-origin-iframe.https.html similarity index 53% rename from battery-status/battery-iframe.https.html rename to battery-status/battery-allowed-in-same-origin-iframe.https.html index 1f95b4ecb32037..c0d684f26d7d27 100644 --- a/battery-status/battery-iframe.https.html +++ b/battery-status/battery-allowed-in-same-origin-iframe.https.html @@ -1,6 +1,6 @@ -Battery Test: navigator.getBattery() is not allowed in non top-level browsing context +Battery Test: navigator.getBattery() is allowed in same origin iframe @@ -16,12 +16,11 @@ }); } -promise_test(t => { - var iframe = document.getElementById('blank'); - var src = 'support-iframe.html'; - return load_iframe(iframe, src) - .then(iframe => promise_rejects(t, 'SecurityError', - iframe.contentWindow.navigator.getBattery())); -}, "throw a 'SecurityError' when invoking navigator.getBattery() within iframe"); +promise_test(async t => { + let iframe = document.getElementById('blank'); + const src = 'support-iframe.html'; + iframe = await load_iframe(iframe, src); + await iframe.contentWindow.navigator.getBattery(); +}, "navigator.getBattery() is allowed in same origin iframe"); diff --git a/battery-status/battery-default-feature-policy.https.sub.html b/battery-status/battery-default-feature-policy.https.sub.html new file mode 100644 index 00000000000000..5486a453e4e99c --- /dev/null +++ b/battery-status/battery-default-feature-policy.https.sub.html @@ -0,0 +1,28 @@ + + + + + + + diff --git a/battery-status/battery-disabled-by-feature-policy.https.sub.html b/battery-status/battery-disabled-by-feature-policy.https.sub.html new file mode 100644 index 00000000000000..515c64fe490fbf --- /dev/null +++ b/battery-status/battery-disabled-by-feature-policy.https.sub.html @@ -0,0 +1,28 @@ + + + + + + + diff --git a/battery-status/battery-disabled-by-feature-policy.https.sub.html.headers b/battery-status/battery-disabled-by-feature-policy.https.sub.html.headers new file mode 100644 index 00000000000000..09a5ae84a123aa --- /dev/null +++ b/battery-status/battery-disabled-by-feature-policy.https.sub.html.headers @@ -0,0 +1 @@ +Feature-Policy: battery 'none' diff --git a/battery-status/battery-disallowed-in-cross-origin-iframe.https.sub.html b/battery-status/battery-disallowed-in-cross-origin-iframe.https.sub.html new file mode 100644 index 00000000000000..8b48626b551141 --- /dev/null +++ b/battery-status/battery-disallowed-in-cross-origin-iframe.https.sub.html @@ -0,0 +1,27 @@ + + +Battery Test: navigator.getBattery() is not allowed in cross origin iframe + + + + +
+ + diff --git a/feature-policy/resources/feature-policy-battery.html b/feature-policy/resources/feature-policy-battery.html new file mode 100644 index 00000000000000..dff4b3290d66c4 --- /dev/null +++ b/feature-policy/resources/feature-policy-battery.html @@ -0,0 +1,9 @@ +