summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/orientation-sensor/resources/sensor-data.js
blob: a2886e7553bd0e59689a30bb0e5b5a68ed387d37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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];