summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webvr
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/webvr
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/webvr')
-rw-r--r--testing/web-platform/tests/webvr/META.yml3
-rw-r--r--testing/web-platform/tests/webvr/idlharness.https.html28
-rw-r--r--testing/web-platform/tests/webvr/webvr-disabled-by-feature-policy.https.sub.html33
-rw-r--r--testing/web-platform/tests/webvr/webvr-disabled-by-feature-policy.https.sub.html.headers1
-rw-r--r--testing/web-platform/tests/webvr/webvr-enabled-by-feature-policy-attribute-redirect-on-load.https.sub.html27
-rw-r--r--testing/web-platform/tests/webvr/webvr-enabled-by-feature-policy-attribute.https.sub.html25
-rw-r--r--testing/web-platform/tests/webvr/webvr-enabled-by-feature-policy.https.sub.html30
-rw-r--r--testing/web-platform/tests/webvr/webvr-enabled-by-feature-policy.https.sub.html.headers1
-rw-r--r--testing/web-platform/tests/webvr/webvr-enabled-on-self-origin-by-feature-policy.https.sub.html30
-rw-r--r--testing/web-platform/tests/webvr/webvr-enabled-on-self-origin-by-feature-policy.https.sub.html.headers1
-rw-r--r--testing/web-platform/tests/webvr/webvr-supported-by-feature-policy.html11
11 files changed, 190 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webvr/META.yml b/testing/web-platform/tests/webvr/META.yml
new file mode 100644
index 0000000000..b50e559457
--- /dev/null
+++ b/testing/web-platform/tests/webvr/META.yml
@@ -0,0 +1,3 @@
+spec: https://immersive-web.github.io/webvr/spec/1.1/
+suggested_reviewers:
+ - klausw
diff --git a/testing/web-platform/tests/webvr/idlharness.https.html b/testing/web-platform/tests/webvr/idlharness.https.html
new file mode 100644
index 0000000000..ee991158ef
--- /dev/null
+++ b/testing/web-platform/tests/webvr/idlharness.https.html
@@ -0,0 +1,28 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset=utf-8>
+ <title>WebVR IDL test</title>
+ <link rel="help" href="https://w3c.github.io/webvr/">
+
+ <script src=/resources/testharness.js></script>
+ <script src=/resources/testharnessreport.js></script>
+ <script src=/resources/WebIDLParser.js></script>
+ <script src=/resources/idlharness.js></script>
+ </head>
+ <body>
+ <h1 class="instructions">Description</h1>
+ <p class="instructions">
+ This test verifies that implementations of the WebVR API match its WebIDL definition.
+ </p>
+
+ <div id='log'></div>
+
+ <script>
+ idl_test(
+ ['webvr.tentative'],
+ ['gamepad', 'html', 'dom']
+ );
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/webvr/webvr-disabled-by-feature-policy.https.sub.html b/testing/web-platform/tests/webvr/webvr-disabled-by-feature-policy.https.sub.html
new file mode 100644
index 0000000000..567499cefa
--- /dev/null
+++ b/testing/web-platform/tests/webvr/webvr-disabled-by-feature-policy.https.sub.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<body>
+ <script src=/resources/testharness.js></script>
+ <script src=/resources/testharnessreport.js></script>
+ <script src=/feature-policy/resources/featurepolicy.js></script>
+
+ <script>
+ 'use strict';
+ var same_origin_src = '/feature-policy/resources/feature-policy-webvr.html';
+ var cross_origin_src = 'https://{{domains[www]}}:{{ports[https][0]}}' +
+ same_origin_src;
+ var header = 'Feature-Policy header vr "none"';
+
+ promise_test(() => {
+ return navigator.getVRDisplays().then(() => {
+ assert_unreached('expected promise to reject');
+ }, error => {
+ });
+ }, header + ' disallows the top-level document.');
+
+ async_test(t => {
+ test_feature_availability(
+ 'navigator.getVRDisplays()', t, same_origin_src,
+ expect_feature_unavailable_default);
+ }, header + ' disallows same-origin iframes.');
+
+ async_test(t => {
+ test_feature_availability(
+ 'navigator.getVRDisplays()', t, cross_origin_src,
+ expect_feature_unavailable_default);
+ }, header + ' disallows cross-origin iframes.');
+ </script>
+</body>
diff --git a/testing/web-platform/tests/webvr/webvr-disabled-by-feature-policy.https.sub.html.headers b/testing/web-platform/tests/webvr/webvr-disabled-by-feature-policy.https.sub.html.headers
new file mode 100644
index 0000000000..d021af7563
--- /dev/null
+++ b/testing/web-platform/tests/webvr/webvr-disabled-by-feature-policy.https.sub.html.headers
@@ -0,0 +1 @@
+Feature-Policy: vr 'none'
diff --git a/testing/web-platform/tests/webvr/webvr-enabled-by-feature-policy-attribute-redirect-on-load.https.sub.html b/testing/web-platform/tests/webvr/webvr-enabled-by-feature-policy-attribute-redirect-on-load.https.sub.html
new file mode 100644
index 0000000000..da01dafd1c
--- /dev/null
+++ b/testing/web-platform/tests/webvr/webvr-enabled-by-feature-policy-attribute-redirect-on-load.https.sub.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<body>
+ <script src=/resources/testharness.js></script>
+ <script src=/resources/testharnessreport.js></script>
+ <script src=/feature-policy/resources/featurepolicy.js></script>
+ <script>
+ 'use strict';
+ var relative_path = '/feature-policy/resources/feature-policy-webvr.html';
+ var base_src = '/feature-policy/resources/redirect-on-load.html#';
+ var same_origin_src = base_src + relative_path;
+ var cross_origin_src = base_src + 'https://{{domains[www]}}:{{ports[https][0]}}' +
+ relative_path;
+ var header = 'Feature-Policy allow="vr" attribute';
+
+ async_test(t => {
+ test_feature_availability(
+ 'navigator.getVRDisplays()', t, same_origin_src,
+ expect_feature_available_default, 'vr');
+ }, header + ' allows same-origin relocation');
+
+ async_test(t => {
+ test_feature_availability(
+ 'navigator.getVRDisplays()', t, cross_origin_src,
+ expect_feature_unavailable_default, 'vr');
+ }, header + ' disallows cross-origin relocation');
+ </script>
+</body>
diff --git a/testing/web-platform/tests/webvr/webvr-enabled-by-feature-policy-attribute.https.sub.html b/testing/web-platform/tests/webvr/webvr-enabled-by-feature-policy-attribute.https.sub.html
new file mode 100644
index 0000000000..d715f90213
--- /dev/null
+++ b/testing/web-platform/tests/webvr/webvr-enabled-by-feature-policy-attribute.https.sub.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<body>
+ <script src=/resources/testharness.js></script>
+ <script src=/resources/testharnessreport.js></script>
+ <script src=/feature-policy/resources/featurepolicy.js></script>
+ <script>
+ 'use strict';
+ var same_origin_src = '/feature-policy/resources/feature-policy-webvr.html';
+ var cross_origin_src = 'https://{{domains[www]}}:{{ports[https][0]}}' +
+ same_origin_src;
+ var header = 'Feature-Policy allow="vr" attribute';
+
+ async_test(t => {
+ test_feature_availability(
+ 'navigator.getVRDisplays()', t, same_origin_src,
+ expect_feature_available_default, 'vr');
+ }, header + ' allows same-origin iframe');
+
+ async_test(t => {
+ test_feature_availability(
+ 'navigator.getVRDisplays()', t, cross_origin_src,
+ expect_feature_available_default, 'vr');
+ }, header + ' allows cross-origin iframe');
+ </script>
+</body>
diff --git a/testing/web-platform/tests/webvr/webvr-enabled-by-feature-policy.https.sub.html b/testing/web-platform/tests/webvr/webvr-enabled-by-feature-policy.https.sub.html
new file mode 100644
index 0000000000..ee0256684f
--- /dev/null
+++ b/testing/web-platform/tests/webvr/webvr-enabled-by-feature-policy.https.sub.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<body>
+ <script src=/resources/testharness.js></script>
+ <script src=/resources/testharnessreport.js></script>
+ <script src=/feature-policy/resources/featurepolicy.js></script>
+
+ <script>
+ 'use strict';
+ var same_origin_src = '/feature-policy/resources/feature-policy-webvr.html';
+ var cross_origin_src = 'https://{{domains[www]}}:{{ports[https][0]}}' +
+ same_origin_src;
+ var header = 'Feature-Policy header vr *';
+
+ promise_test(
+ () => navigator.getVRDisplays(),
+ header + ' allows the top-level document.');
+
+ async_test(t => {
+ test_feature_availability(
+ 'navigator.getVRDisplays()', t, same_origin_src,
+ expect_feature_available_default);
+ }, header + ' allows same-origin iframes.');
+
+ async_test(t => {
+ test_feature_availability(
+ 'navigator.getVRDisplays()', t, cross_origin_src,
+ expect_feature_available_default);
+ }, header + ' allows cross-origin iframes.');
+ </script>
+</body>
diff --git a/testing/web-platform/tests/webvr/webvr-enabled-by-feature-policy.https.sub.html.headers b/testing/web-platform/tests/webvr/webvr-enabled-by-feature-policy.https.sub.html.headers
new file mode 100644
index 0000000000..e7427ee8c7
--- /dev/null
+++ b/testing/web-platform/tests/webvr/webvr-enabled-by-feature-policy.https.sub.html.headers
@@ -0,0 +1 @@
+Feature-Policy: vr *
diff --git a/testing/web-platform/tests/webvr/webvr-enabled-on-self-origin-by-feature-policy.https.sub.html b/testing/web-platform/tests/webvr/webvr-enabled-on-self-origin-by-feature-policy.https.sub.html
new file mode 100644
index 0000000000..bd7e82f606
--- /dev/null
+++ b/testing/web-platform/tests/webvr/webvr-enabled-on-self-origin-by-feature-policy.https.sub.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<body>
+ <script src=/resources/testharness.js></script>
+ <script src=/resources/testharnessreport.js></script>
+ <script src=/feature-policy/resources/featurepolicy.js></script>
+
+ <script>
+ 'use strict';
+ var same_origin_src = '/feature-policy/resources/feature-policy-webvr.html';
+ var cross_origin_src = 'https://{{domains[www]}}:{{ports[https][0]}}' +
+ same_origin_src;
+ var header = 'Feature-Policy header vr "self"';
+
+ promise_test(
+ () => navigator.getVRDisplays(),
+ header + ' allows the top-level document.');
+
+ async_test(t => {
+ test_feature_availability(
+ 'navigator.getVRDisplays()', t, same_origin_src,
+ expect_feature_available_default);
+ }, header + ' allows same-origin iframes.');
+
+ async_test(t => {
+ test_feature_availability(
+ 'navigator.getVRDisplays()', t, cross_origin_src,
+ expect_feature_unavailable_default);
+ }, header + ' disallows cross-origin iframes.');
+ </script>
+</body>
diff --git a/testing/web-platform/tests/webvr/webvr-enabled-on-self-origin-by-feature-policy.https.sub.html.headers b/testing/web-platform/tests/webvr/webvr-enabled-on-self-origin-by-feature-policy.https.sub.html.headers
new file mode 100644
index 0000000000..87d343d8f8
--- /dev/null
+++ b/testing/web-platform/tests/webvr/webvr-enabled-on-self-origin-by-feature-policy.https.sub.html.headers
@@ -0,0 +1 @@
+Feature-Policy: vr 'self'
diff --git a/testing/web-platform/tests/webvr/webvr-supported-by-feature-policy.html b/testing/web-platform/tests/webvr/webvr-supported-by-feature-policy.html
new file mode 100644
index 0000000000..416e286c04
--- /dev/null
+++ b/testing/web-platform/tests/webvr/webvr-supported-by-feature-policy.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<title>Test that (obsolete) vr is advertised in the feature list</title>
+<!-- Some WebVR implementations used "vr", but this is now obsolete and WebXR is moving in a different direction.-->>
+<link rel="help" href="https://github.com/immersive-web/webxr/issues/308">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+test(() => {
+ assert_in_array('vr', document.featurePolicy.features());
+}, 'document.featurePolicy.features should advertise (obsolete) vr.');
+</script>