OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../resources/testharness.js"></script> | 2 <script src="../resources/testharness.js"></script> |
3 <script src="../resources/testharnessreport.js"></script> | 3 <script src="../resources/testharnessreport.js"></script> |
4 <script src="../resources/mojo-helpers.js"></script> | 4 <script src="../resources/mojo-helpers.js"></script> |
5 <script src="resources/sensor-helpers.js"></script> | 5 <script src="resources/sensor-helpers.js"></script> |
6 <script src="resources/generic-sensor-tests.js"></script> | 6 <script src="resources/generic-sensor-tests.js"></script> |
7 <script> | 7 <script> |
8 | 8 |
9 'use strict'; | 9 'use strict'; |
10 | 10 |
11 if (!window.testRunner) | 11 if (!window.testRunner) |
12 debug('This test cannot be run without the TestRunner'); | 12 debug('This test cannot be run without the TestRunner'); |
13 | 13 |
14 const kQuaternion = [1, 0, 0, 0]; // 180 degrees around X axis. | 14 const kQuaternion = [1, 0, 0, 0]; // 180 degrees around X axis. |
15 const kRotationMatrix = [1, 0, 0, 0, | 15 const kRotationMatrix = [1, 0, 0, 0, |
16 0, -1, 0, 0, | 16 0, -1, 0, 0, |
17 0, 0, -1, 0, | 17 0, 0, -1, 0, |
18 0, 0, 0, 1]; | 18 0, 0, 0, 1]; |
19 const kRotationDOMMatrix = new DOMMatrix(kRotationMatrix); | 19 const kRotationDOMMatrix = new DOMMatrix(kRotationMatrix); |
20 | 20 |
21 function update_sensor_reading(buffer) { | 21 function update_sensor_reading(buffer) { |
22 buffer[1] = window.performance.now(); | |
23 buffer[2] = 1; | 22 buffer[2] = 1; |
24 buffer[3] = 0; | 23 buffer[3] = 0; |
25 buffer[4] = 0; | 24 buffer[4] = 0; |
26 buffer[5] = 0; | 25 buffer[5] = 0; |
27 } | 26 } |
28 | 27 |
29 function verify_sensor_reading(sensor, should_be_null) { | 28 function verify_sensor_reading(sensor, should_be_null) { |
30 if (should_be_null) | 29 if (should_be_null) |
31 return sensor.quaternion == null && sensor.timestamp == null; | 30 return sensor.quaternion == null && sensor.timestamp == null; |
32 | 31 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 }, reject); | 84 }, reject); |
86 | 85 |
87 sensorObject.onchange = wrapper.callback; | 86 sensorObject.onchange = wrapper.callback; |
88 sensorObject.onerror = reject; | 87 sensorObject.onerror = reject; |
89 }); | 88 }); |
90 }) | 89 }) |
91 .then(mockSensor => { return mockSensor.removeConfigurationCalled(); }); | 90 .then(mockSensor => { return mockSensor.removeConfigurationCalled(); }); |
92 }, 'Test AbsoluteOrientationSensor.populateMatrix() method works correctly.'); | 91 }, 'Test AbsoluteOrientationSensor.populateMatrix() method works correctly.'); |
93 | 92 |
94 </script> | 93 </script> |
OLD | NEW |