summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/gyroscope
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/gyroscope')
-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.html18
-rw-r--r--testing/web-platform/tests/gyroscope/Gyroscope-supported-by-feature-policy.html11
-rw-r--r--testing/web-platform/tests/gyroscope/Gyroscope.https.html21
-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
-rw-r--r--testing/web-platform/tests/gyroscope/resources/sensor-data.js23
15 files changed, 182 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..c94016764d
--- /dev/null
+++ b/testing/web-platform/tests/gyroscope/Gyroscope-iframe-access.https.html
@@ -0,0 +1,18 @@
+<!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="/resources/testdriver.js"></script>
+<script src="/resources/testdriver-vendor.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>
+<script src="resources/sensor-data.js"></script>
+<div id="log"></div>
+<script>
+
+run_generic_sensor_iframe_tests(kGyroscopeSensorData, kGyroscopeReadings);
+</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..8aab94693a
--- /dev/null
+++ b/testing/web-platform/tests/gyroscope/Gyroscope.https.html
@@ -0,0 +1,21 @@
+<!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="/resources/testdriver.js"></script>
+<script src="/resources/testdriver-vendor.js"></script>
+<script src="/page-visibility/resources/window_state_context.js"></script>
+<script src="/generic-sensor/resources/generic-sensor-helpers.js"></script>
+<script src="/generic-sensor/generic-sensor-tests.js"></script>
+<script src="resources/sensor-data.js"></script>
+<script>
+
+'use strict';
+
+runGenericSensorTests(kGyroscopeSensorData, kGyroscopeReadings);
+
+</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();']
+ });
+ }
+);
diff --git a/testing/web-platform/tests/gyroscope/resources/sensor-data.js b/testing/web-platform/tests/gyroscope/resources/sensor-data.js
new file mode 100644
index 0000000000..409ffef9a1
--- /dev/null
+++ b/testing/web-platform/tests/gyroscope/resources/sensor-data.js
@@ -0,0 +1,23 @@
+'use strict';
+
+const kGyroscopeSensorData = {
+ sensorName: 'Gyroscope',
+ permissionName: 'gyroscope',
+ testDriverName: 'gyroscope',
+ featurePolicyNames: ['gyroscope']
+};
+
+// Due to the gyroscope input values being rounded using a precision of
+// 0.1 deg/sec, the expectedReadings and expectedRemappedReadings contain
+// a significant number of decimal places.
+const kGyroscopeReadings = {
+ readings: [
+ { x: 1, y: 2, z: 3 }
+ ],
+ expectedReadings: [
+ { x: 1.00007366, y: 2.00014732, z: 3.00022098 }
+ ],
+ expectedRemappedReadings: [
+ { x: -2.00014732, y: 1.00007366, z: 3.00022098 }
+ ]
+};