Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <script src="../resources/testharness.js"></script> | |
| 3 <script src="../resources/testharnessreport.js"></script> | |
| 4 <script src="../resources/mojo-helpers.js"></script> | |
| 5 <script src="resources/sensor-helpers.js"></script> | |
| 6 <script src="resources/generic-sensor-tests.js"></script> | |
| 7 <script> | |
| 8 | |
| 9 'use strict'; | |
| 10 | |
| 11 if (!window.testRunner) | |
| 12 debug('This test cannot be run without the TestRunner'); | |
| 13 | |
| 14 const kIdentityQuaternion = [1, 0, 0, 0]; | |
| 15 const kIdentityMatrix = [1, 0, 0, 0, | |
|
shalamov
2017/03/23 08:41:06
Would be cool if we provide predefined quats and v
Mikhail
2017/03/24 14:47:09
Done.
| |
| 16 0, 1, 0, 0, | |
| 17 0, 0, 1, 0, | |
| 18 0, 0, 0, 1]; | |
| 19 | |
| 20 function update_sensor_reading(buffer, expects_modified_reading, readsCount) { | |
| 21 buffer[1] = window.performance.now(); | |
| 22 buffer[2] = 0; | |
| 23 buffer[3] = 0; | |
| 24 buffer[4] = 0; | |
| 25 buffer[5] = 1; | |
| 26 } | |
| 27 | |
| 28 function verify_sensor_reading(sensor, should_be_null) { | |
| 29 if (should_be_null) | |
| 30 return sensor.quaternion == null && sensor.timestamp == null; | |
| 31 | |
| 32 if (sensor.timestamp == null || | |
| 33 sensor.quaternion.toString() != kIdentityQuaternion.toString()) | |
| 34 return false; | |
| 35 | |
| 36 let rotationMatrix = new Float32Array(16); | |
| 37 sensor.populateMatrix(rotationMatrix); | |
| 38 | |
| 39 return rotationMatrix.toString() == kIdentityMatrix.toString(); | |
|
shalamov
2017/03/23 08:41:05
I think there were array comparison helpers, maybe
Mikhail
2017/03/24 14:47:09
I found only asserts being exposed
| |
| 40 } | |
| 41 | |
| 42 runGenericSensorTests(AbsoluteOrientationSensor, update_sensor_reading, verify_s ensor_reading); | |
| 43 | |
| 44 </script> | |
| OLD | NEW |