summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/orientation-sensor/resources/sensor-data.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/orientation-sensor/resources/sensor-data.js')
-rw-r--r--testing/web-platform/tests/orientation-sensor/resources/sensor-data.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/testing/web-platform/tests/orientation-sensor/resources/sensor-data.js b/testing/web-platform/tests/orientation-sensor/resources/sensor-data.js
new file mode 100644
index 0000000000..a2886e7553
--- /dev/null
+++ b/testing/web-platform/tests/orientation-sensor/resources/sensor-data.js
@@ -0,0 +1,30 @@
+'use strict';
+
+const kAbsoluteOrientationSensorData = {
+ sensorName: 'AbsoluteOrientationSensor',
+ permissionName: 'accelerometer',
+ testDriverName: 'absolute-orientation',
+ featurePolicyNames: ['accelerometer', 'gyroscope', 'magnetometer']
+};
+
+const kRelativeOrientationSensorData = {
+ sensorName: 'RelativeOrientationSensor',
+ permissionName: 'accelerometer',
+ testDriverName: 'relative-orientation',
+ featurePolicyNames: ['accelerometer', 'gyroscope']
+};
+
+const kOrientationReadings = {
+ // WebDriver input data must be given in Euler angles according to
+ // https://w3c.github.io/deviceorientation/#parse-orientation-data-reading-algorithm
+ // and converted to quaternions via
+ // https://w3c.github.io/orientation-sensor/#create-a-quaternion-from-euler-angles.
+ readings: [{alpha: 0, beta: -180, gamma: 0}],
+ expectedReadings: [{quaternion: [-1, 0, 0, 0]}],
+ expectedRemappedReadings: [{quaternion: [0.70710678, -0.70710678, 0, 0]}]
+};
+
+const kRotationMatrix = [1, 0, 0, 0,
+ 0, -1, 0, 0,
+ 0, 0, -1, 0,
+ 0, 0, 0, 1];