summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/font-access/permissions-policy
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/font-access/permissions-policy')
-rw-r--r--testing/web-platform/tests/font-access/permissions-policy/local-fonts-allowed-by-permissions-policy-attribute-redirect-on-load.https.sub.html28
-rw-r--r--testing/web-platform/tests/font-access/permissions-policy/local-fonts-allowed-by-permissions-policy-attribute.https.sub.html27
-rw-r--r--testing/web-platform/tests/font-access/permissions-policy/local-fonts-allowed-by-permissions-policy.https.sub.html35
-rw-r--r--testing/web-platform/tests/font-access/permissions-policy/local-fonts-allowed-by-permissions-policy.https.sub.html.headers1
-rw-r--r--testing/web-platform/tests/font-access/permissions-policy/local-fonts-default-permissions-policy.https.sub.html35
-rw-r--r--testing/web-platform/tests/font-access/permissions-policy/local-fonts-disabled-by-permissions-policy.https.sub.html33
-rw-r--r--testing/web-platform/tests/font-access/permissions-policy/local-fonts-disabled-by-permissions-policy.https.sub.html.headers1
-rw-r--r--testing/web-platform/tests/font-access/permissions-policy/local-fonts-supported-by-permissions-policy.html11
8 files changed, 171 insertions, 0 deletions
diff --git a/testing/web-platform/tests/font-access/permissions-policy/local-fonts-allowed-by-permissions-policy-attribute-redirect-on-load.https.sub.html b/testing/web-platform/tests/font-access/permissions-policy/local-fonts-allowed-by-permissions-policy-attribute-redirect-on-load.https.sub.html
new file mode 100644
index 0000000000..d829cc4a3b
--- /dev/null
+++ b/testing/web-platform/tests/font-access/permissions-policy/local-fonts-allowed-by-permissions-policy-attribute-redirect-on-load.https.sub.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<body>
+ <script src=/font-access/resources/font-test-utils.js></script>
+ <script src=/resources/testdriver.js></script>
+ <script src=/resources/testdriver-vendor.js></script>
+ <script src=/resources/testharness.js></script>
+ <script src=/resources/testharnessreport.js></script>
+ <script src=/permissions-policy/resources/permissions-policy.js></script>
+ <script>
+ 'use strict';
+ const relative_path = '/permissions-policy/resources/permissions-policy-local-fonts.html';
+ const base_src = '/permissions-policy/resources/redirect-on-load.html#';
+ const same_origin_src = base_src + relative_path;
+ const cross_origin_src =
+ base_src + 'https://{{domains[www]}}:{{ports[https][0]}}' + relative_path;
+ const header = 'permissions policy allow="local-fonts"';
+
+ async_test(t => {
+ test_feature_availability('local-fonts', t, same_origin_src,
+ expect_feature_available_default, 'local-fonts');
+ }, header + ' allows same-origin navigation in an iframe.');
+
+ async_test(t => {
+ test_feature_availability('local-fonts', t, cross_origin_src,
+ expect_feature_unavailable_default, 'local-fonts');
+ }, header + ' disallows cross-origin navigation in an iframe.');
+ </script>
+</body> \ No newline at end of file
diff --git a/testing/web-platform/tests/font-access/permissions-policy/local-fonts-allowed-by-permissions-policy-attribute.https.sub.html b/testing/web-platform/tests/font-access/permissions-policy/local-fonts-allowed-by-permissions-policy-attribute.https.sub.html
new file mode 100644
index 0000000000..ba802606a1
--- /dev/null
+++ b/testing/web-platform/tests/font-access/permissions-policy/local-fonts-allowed-by-permissions-policy-attribute.https.sub.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<body>
+ <script src=/font-access/resources/font-test-utils.js></script>
+ <script src=/resources/testharness.js></script>
+ <script src=/resources/testharnessreport.js></script>
+ <script src=/resources/testdriver.js></script>
+ <script src=/resources/testdriver-vendor.js></script>
+ <script src=/permissions-policy/resources/permissions-policy.js></script>
+ <script>
+ 'use strict';
+ const same_origin_src = '/permissions-policy/resources/permissions-policy-local-fonts.html';
+ const cross_origin_src = 'https://{{domains[www]}}:{{ports[https][0]}}' +
+ same_origin_src;
+ const feature_name = 'permissions policy "local-fonts"';
+ const header = 'allow="local-fonts" attribute';
+
+ async_test(t => {
+ test_feature_availability('local-fonts', t, same_origin_src,
+ expect_feature_available_default, 'local-fonts');
+ }, feature_name + ' can be enabled in same-origin iframe using ' + header);
+
+ async_test(t => {
+ test_feature_availability('local-fonts', t, cross_origin_src,
+ expect_feature_available_default, 'local-fonts');
+ }, feature_name + ' can be enabled in cross-origin iframe using ' + header);
+ </script>
+</body> \ No newline at end of file
diff --git a/testing/web-platform/tests/font-access/permissions-policy/local-fonts-allowed-by-permissions-policy.https.sub.html b/testing/web-platform/tests/font-access/permissions-policy/local-fonts-allowed-by-permissions-policy.https.sub.html
new file mode 100644
index 0000000000..4f63b6e013
--- /dev/null
+++ b/testing/web-platform/tests/font-access/permissions-policy/local-fonts-allowed-by-permissions-policy.https.sub.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<meta name="timeout" content="long"> <!-- this is a long-running test at least on some platforms ! -->
+<body>
+ <script src=/font-access/resources/font-test-utils.js></script>
+ <script src=/resources/testharness.js></script>
+ <script src=/resources/testharnessreport.js></script>
+ <script src=/resources/testdriver.js></script>
+ <script src=/resources/testdriver-vendor.js></script>
+ <script src=/permissions-policy/resources/permissions-policy.js></script>
+ <script>
+ 'use strict';
+ const same_origin_src = '/permissions-policy/resources/permissions-policy-local-fonts.html';
+ const cross_origin_src = 'https://{{domains[www]}}:{{ports[https][0]}}' +
+ same_origin_src;
+ const header = 'permissions policy header: local-fonts *';
+
+ font_access_test(async t => {
+ try {
+ await self.queryLocalFonts();
+ } catch (error) {
+ assert_unreached(error);
+ }
+ }, header + ' allows the top-level document.');
+
+ async_test(t => {
+ test_feature_availability('local-fonts', t, same_origin_src,
+ expect_feature_available_default);
+ }, header + ' allows same-origin iframes.');
+
+ async_test(t => {
+ test_feature_availability('local-fonts', t, cross_origin_src,
+ expect_feature_unavailable_default);
+ }, header + ' disallows cross-origin iframes.');
+ </script>
+</body> \ No newline at end of file
diff --git a/testing/web-platform/tests/font-access/permissions-policy/local-fonts-allowed-by-permissions-policy.https.sub.html.headers b/testing/web-platform/tests/font-access/permissions-policy/local-fonts-allowed-by-permissions-policy.https.sub.html.headers
new file mode 100644
index 0000000000..d88db128d9
--- /dev/null
+++ b/testing/web-platform/tests/font-access/permissions-policy/local-fonts-allowed-by-permissions-policy.https.sub.html.headers
@@ -0,0 +1 @@
+Permissions-Policy: local-fonts=* \ No newline at end of file
diff --git a/testing/web-platform/tests/font-access/permissions-policy/local-fonts-default-permissions-policy.https.sub.html b/testing/web-platform/tests/font-access/permissions-policy/local-fonts-default-permissions-policy.https.sub.html
new file mode 100644
index 0000000000..c0cfdc070d
--- /dev/null
+++ b/testing/web-platform/tests/font-access/permissions-policy/local-fonts-default-permissions-policy.https.sub.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<meta name="timeout" content="long"> <!-- this is a long-running test at least on some platforms ! -->
+<body>
+ <script src=/font-access/resources/font-test-utils.js></script>
+ <script src=/resources/testharness.js></script>
+ <script src=/resources/testharnessreport.js></script>
+ <script src=/resources/testdriver.js></script>
+ <script src=/resources/testdriver-vendor.js></script>
+ <script src=/permissions-policy/resources/permissions-policy.js></script>
+ <script>
+ 'use strict';
+ const same_origin_src = '/permissions-policy/resources/permissions-policy-local-fonts.html';
+ const cross_origin_src =
+ 'https://{{domains[www]}}:{{ports[https][0]}}' + same_origin_src;
+ const header = 'Default "local-fonts" permissions policy ["self"]';
+
+ font_access_test(async t => {
+ try {
+ await self.queryLocalFonts();
+ } catch (error) {
+ assert_unreached(error);
+ }
+ }, header + ' allows the top-level document.');
+
+ async_test(t => {
+ test_feature_availability('local-fonts', t, same_origin_src,
+ expect_feature_available_default);
+ }, header + ' allows same-origin iframes.');
+
+ async_test(t => {
+ test_feature_availability('local-fonts', t, cross_origin_src,
+ expect_feature_unavailable_default);
+ }, header + ' disallows cross-origin iframes.');
+ </script>
+</body> \ No newline at end of file
diff --git a/testing/web-platform/tests/font-access/permissions-policy/local-fonts-disabled-by-permissions-policy.https.sub.html b/testing/web-platform/tests/font-access/permissions-policy/local-fonts-disabled-by-permissions-policy.https.sub.html
new file mode 100644
index 0000000000..c9912c6dc3
--- /dev/null
+++ b/testing/web-platform/tests/font-access/permissions-policy/local-fonts-disabled-by-permissions-policy.https.sub.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<meta name="timeout" content="long"> <!-- this is a long-running test at least on some platforms ! -->
+<body>
+ <script src=/font-access/resources/font-test-utils.js></script>
+ <script src=/resources/testharness.js></script>
+ <script src=/resources/testharnessreport.js></script>
+ <script src=/resources/testdriver.js></script>
+ <script src=/resources/testdriver-vendor.js></script>
+ <script src=/permissions-policy/resources/permissions-policy.js></script>
+ <script>
+ 'use strict';
+ const same_origin_src = '/permissions-policy/resources/permissions-policy-local-fonts.html';
+ const cross_origin_src = 'https://{{domains[www]}}:{{ports[https][0]}}' +
+ same_origin_src;
+ const header = 'permissions policy header: "local-fonts=()"';
+
+ font_access_test(async t => {
+ await promise_rejects_dom(t, 'SecurityError', self.queryLocalFonts(),
+ 'queryLocalFonts() throws security error when disallowed by ' +
+ 'permission policy');
+ }, header + ' disallows the top-level document.');
+
+ async_test(t => {
+ test_feature_availability('local-fonts', t, same_origin_src,
+ expect_feature_unavailable_default);
+ }, header + ' disallows same-origin iframes.');
+
+ async_test(t => {
+ test_feature_availability('local-fonts', t, cross_origin_src,
+ expect_feature_unavailable_default);
+ }, header + ' disallows cross-origin iframes.');
+ </script>
+</body> \ No newline at end of file
diff --git a/testing/web-platform/tests/font-access/permissions-policy/local-fonts-disabled-by-permissions-policy.https.sub.html.headers b/testing/web-platform/tests/font-access/permissions-policy/local-fonts-disabled-by-permissions-policy.https.sub.html.headers
new file mode 100644
index 0000000000..f52d4e0d72
--- /dev/null
+++ b/testing/web-platform/tests/font-access/permissions-policy/local-fonts-disabled-by-permissions-policy.https.sub.html.headers
@@ -0,0 +1 @@
+Permissions-Policy: local-fonts=() \ No newline at end of file
diff --git a/testing/web-platform/tests/font-access/permissions-policy/local-fonts-supported-by-permissions-policy.html b/testing/web-platform/tests/font-access/permissions-policy/local-fonts-supported-by-permissions-policy.html
new file mode 100644
index 0000000000..671c0fa539
--- /dev/null
+++ b/testing/web-platform/tests/font-access/permissions-policy/local-fonts-supported-by-permissions-policy.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<title>Test that local fonts is advertised in the feature list</title>
+<link rel="help" href="https://w3c.github.io/webappsec-permissions-policy/#dom-permissions-policy-features">
+<link rel="help" href="https://wicg.github.io/local-fonts/#permissions-policy">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+ test(() => {
+ assert_in_array('local-fonts', document.featurePolicy.features());
+ }, 'document.featurePolicy.features should advertise local-fonts.');
+</script> \ No newline at end of file