summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/gyroscope
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/gyroscope
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--testing/web-platform/tests/gyroscope/Gyroscope-disabled-by-feature-policy.https.html13
-rw-r--r--testing/web-platform/tests/gyroscope/Gyroscope-disabled-by-feature-policy.https.html.headers1
-rw-r--r--testing/web-platform/tests/gyroscope/Gyroscope-enabled-by-feature-policy-attribute-redirect-on-load.https.html13
-rw-r--r--testing/web-platform/tests/gyroscope/Gyroscope-enabled-by-feature-policy-attribute.https.html13
-rw-r--r--testing/web-platform/tests/gyroscope/Gyroscope-enabled-by-feature-policy.https.html13
-rw-r--r--testing/web-platform/tests/gyroscope/Gyroscope-enabled-by-feature-policy.https.html.headers1
-rw-r--r--testing/web-platform/tests/gyroscope/Gyroscope-enabled-on-self-origin-by-feature-policy.https.html13
-rw-r--r--testing/web-platform/tests/gyroscope/Gyroscope-enabled-on-self-origin-by-feature-policy.https.html.headers1
-rw-r--r--testing/web-platform/tests/gyroscope/Gyroscope-iframe-access.https.html15
-rw-r--r--testing/web-platform/tests/gyroscope/Gyroscope-supported-by-feature-policy.html11
-rw-r--r--testing/web-platform/tests/gyroscope/Gyroscope.https.html33
-rw-r--r--testing/web-platform/tests/gyroscope/Gyroscope_insecure_context.html20
-rw-r--r--testing/web-platform/tests/gyroscope/META.yml5
-rw-r--r--testing/web-platform/tests/gyroscope/idlharness.https.window.js16
14 files changed, 168 insertions, 0 deletions
diff --git a/testing/web-platform/tests/gyroscope/Gyroscope-disabled-by-feature-policy.https.html b/testing/web-platform/tests/gyroscope/Gyroscope-disabled-by-feature-policy.https.html
new file mode 100644
index 0000000000..02cc44ec78
--- /dev/null
+++ b/testing/web-platform/tests/gyroscope/Gyroscope-disabled-by-feature-policy.https.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<body>
+<title>Gyroscope Feature Policy Test: Disabled</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/feature-policy/resources/featurepolicy.js"></script>
+<script src="/generic-sensor/generic-sensor-feature-policy-test.sub.js"></script>
+<script>
+"use strict";
+
+run_fp_tests_disabled('Gyroscope');
+</script>
+</body>
diff --git a/testing/web-platform/tests/gyroscope/Gyroscope-disabled-by-feature-policy.https.html.headers b/testing/web-platform/tests/gyroscope/Gyroscope-disabled-by-feature-policy.https.html.headers
new file mode 100644
index 0000000000..3d91d5840b
--- /dev/null
+++ b/testing/web-platform/tests/gyroscope/Gyroscope-disabled-by-feature-policy.https.html.headers
@@ -0,0 +1 @@
+Feature-Policy: gyroscope 'none'
diff --git a/testing/web-platform/tests/gyroscope/Gyroscope-enabled-by-feature-policy-attribute-redirect-on-load.https.html b/testing/web-platform/tests/gyroscope/Gyroscope-enabled-by-feature-policy-attribute-redirect-on-load.https.html
new file mode 100644
index 0000000000..e1aa0f944a
--- /dev/null
+++ b/testing/web-platform/tests/gyroscope/Gyroscope-enabled-by-feature-policy-attribute-redirect-on-load.https.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<body>
+<title>Gyroscope Feature Policy Test: Enabled by attribute redirect on load</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/feature-policy/resources/featurepolicy.js"></script>
+<script src="/generic-sensor/generic-sensor-feature-policy-test.sub.js"></script>
+<script>
+"use strict";
+
+run_fp_tests_enabled_by_attribute_redirect_on_load('Gyroscope');
+</script>
+</body>
diff --git a/testing/web-platform/tests/gyroscope/Gyroscope-enabled-by-feature-policy-attribute.https.html b/testing/web-platform/tests/gyroscope/Gyroscope-enabled-by-feature-policy-attribute.https.html
new file mode 100644
index 0000000000..17e5b27e1a
--- /dev/null
+++ b/testing/web-platform/tests/gyroscope/Gyroscope-enabled-by-feature-policy-attribute.https.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<body>
+<title>Gyroscope Feature Policy Test: Enabled by attribute</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/feature-policy/resources/featurepolicy.js"></script>
+<script src="/generic-sensor/generic-sensor-feature-policy-test.sub.js"></script>
+<script>
+"use strict";
+
+run_fp_tests_enabled_by_attribute('Gyroscope');
+</script>
+</body>
diff --git a/testing/web-platform/tests/gyroscope/Gyroscope-enabled-by-feature-policy.https.html b/testing/web-platform/tests/gyroscope/Gyroscope-enabled-by-feature-policy.https.html
new file mode 100644
index 0000000000..9bcced92b7
--- /dev/null
+++ b/testing/web-platform/tests/gyroscope/Gyroscope-enabled-by-feature-policy.https.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<body>
+<title>Gyroscope Feature Policy Test: Enabled</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/feature-policy/resources/featurepolicy.js"></script>
+<script src="/generic-sensor/generic-sensor-feature-policy-test.sub.js"></script>
+<script>
+"use strict";
+
+run_fp_tests_enabled('Gyroscope');
+</script>
+</body>
diff --git a/testing/web-platform/tests/gyroscope/Gyroscope-enabled-by-feature-policy.https.html.headers b/testing/web-platform/tests/gyroscope/Gyroscope-enabled-by-feature-policy.https.html.headers
new file mode 100644
index 0000000000..0fd938b4aa
--- /dev/null
+++ b/testing/web-platform/tests/gyroscope/Gyroscope-enabled-by-feature-policy.https.html.headers
@@ -0,0 +1 @@
+Feature-Policy: gyroscope *
diff --git a/testing/web-platform/tests/gyroscope/Gyroscope-enabled-on-self-origin-by-feature-policy.https.html b/testing/web-platform/tests/gyroscope/Gyroscope-enabled-on-self-origin-by-feature-policy.https.html
new file mode 100644
index 0000000000..76d1c5e729
--- /dev/null
+++ b/testing/web-platform/tests/gyroscope/Gyroscope-enabled-on-self-origin-by-feature-policy.https.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<body>
+<title>Gyroscope Feature Policy Test: Enabled on self origin</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/feature-policy/resources/featurepolicy.js"></script>
+<script src="/generic-sensor/generic-sensor-feature-policy-test.sub.js"></script>
+<script>
+"use strict";
+
+run_fp_tests_enabled_on_self_origin('Gyroscope');
+</script>
+</body>
diff --git a/testing/web-platform/tests/gyroscope/Gyroscope-enabled-on-self-origin-by-feature-policy.https.html.headers b/testing/web-platform/tests/gyroscope/Gyroscope-enabled-on-self-origin-by-feature-policy.https.html.headers
new file mode 100644
index 0000000000..7cf4fd8f6b
--- /dev/null
+++ b/testing/web-platform/tests/gyroscope/Gyroscope-enabled-on-self-origin-by-feature-policy.https.html.headers
@@ -0,0 +1 @@
+Feature-Policy: gyroscope 'self'
diff --git a/testing/web-platform/tests/gyroscope/Gyroscope-iframe-access.https.html b/testing/web-platform/tests/gyroscope/Gyroscope-iframe-access.https.html
new file mode 100644
index 0000000000..ed0183bef9
--- /dev/null
+++ b/testing/web-platform/tests/gyroscope/Gyroscope-iframe-access.https.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Gyroscope iframe test</title>
+<link rel="author" title="Intel" href="http://www.intel.com">
+<link rel="help" href="https://www.w3.org/TR/gyroscope/">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/generic-sensor/resources/generic-sensor-helpers.js"></script>
+<script src="/generic-sensor/generic-sensor-iframe-tests.sub.js"></script>
+<script src="/generic-sensor/generic-sensor-feature-policy-test.sub.js"></script>
+<div id="log"></div>
+<script>
+
+run_generic_sensor_iframe_tests('Gyroscope');
+</script>
diff --git a/testing/web-platform/tests/gyroscope/Gyroscope-supported-by-feature-policy.html b/testing/web-platform/tests/gyroscope/Gyroscope-supported-by-feature-policy.html
new file mode 100644
index 0000000000..06a4137f17
--- /dev/null
+++ b/testing/web-platform/tests/gyroscope/Gyroscope-supported-by-feature-policy.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<title>Test that gyroscope is advertised in the feature list</title>
+<link rel="help" href="https://w3c.github.io/webappsec-feature-policy/#dom-featurepolicy-features">
+<link rel="help" href="https://w3c.github.io/sensors/#feature-policy-api">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+test(() => {
+ assert_in_array('gyroscope', document.featurePolicy.features());
+}, 'document.featurePolicy.features should advertise gyroscope.');
+</script>
diff --git a/testing/web-platform/tests/gyroscope/Gyroscope.https.html b/testing/web-platform/tests/gyroscope/Gyroscope.https.html
new file mode 100644
index 0000000000..f85349f531
--- /dev/null
+++ b/testing/web-platform/tests/gyroscope/Gyroscope.https.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Gyroscope Test</title>
+<meta name="timeout" content="long">
+<link rel="author" title="Intel" href="http://www.intel.com">
+<link rel="help" href="https://www.w3.org/TR/gyroscope/">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/generic-sensor/resources/generic-sensor-helpers.js"></script>
+<script src="/generic-sensor/generic-sensor-tests.js"></script>
+<script>
+
+'use strict';
+
+const kReadings = {
+ readings: [
+ [1.12345, 2.12345, 3.12345]
+ ],
+ expectedReadings: [
+ [1.12345, 2.12345, 3.12345]
+ ],
+ expectedRemappedReadings: [
+ [-2.12345, 1.12345, 3.12345]
+ ]
+};
+
+runGenericSensorTests(
+ 'Gyroscope',
+ kReadings,
+ verifyXyzSensorReading,
+ ['gyroscope']);
+
+</script>
diff --git a/testing/web-platform/tests/gyroscope/Gyroscope_insecure_context.html b/testing/web-platform/tests/gyroscope/Gyroscope_insecure_context.html
new file mode 100644
index 0000000000..2ae8117d70
--- /dev/null
+++ b/testing/web-platform/tests/gyroscope/Gyroscope_insecure_context.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Gyroscope Test: insecure context</title>
+<link rel="author" title="Intel" href="http://www.intel.com">
+<link rel="help" href="https://www.w3.org/TR/gyroscope/">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/generic-sensor/generic-sensor-tests.js"></script>
+<div id="log"></div>
+<h2>Precondition</h2>
+<ol>
+ <li>
+ Run test in an insecure context, e.g. http://example.com/.
+ </li>
+</ol>
+<script>
+
+runGenericSensorInsecureContext("Gyroscope");
+
+</script>
diff --git a/testing/web-platform/tests/gyroscope/META.yml b/testing/web-platform/tests/gyroscope/META.yml
new file mode 100644
index 0000000000..8f553a86ca
--- /dev/null
+++ b/testing/web-platform/tests/gyroscope/META.yml
@@ -0,0 +1,5 @@
+spec: https://w3c.github.io/gyroscope/
+suggested_reviewers:
+ - riju
+ - Honry
+ - rakuco
diff --git a/testing/web-platform/tests/gyroscope/idlharness.https.window.js b/testing/web-platform/tests/gyroscope/idlharness.https.window.js
new file mode 100644
index 0000000000..00f6696d79
--- /dev/null
+++ b/testing/web-platform/tests/gyroscope/idlharness.https.window.js
@@ -0,0 +1,16 @@
+// META: script=/resources/WebIDLParser.js
+// META: script=/resources/idlharness.js
+
+// https://w3c.github.io/gyroscope/
+
+'use strict';
+
+idl_test(
+ ['gyroscope'],
+ ['generic-sensor', 'dom'],
+ idl_array => {
+ idl_array.add_objects({
+ Gyroscope: ['new Gyroscope();']
+ });
+ }
+);