blob: be4f4333a8f1e4f58bbae48a8b272a5c021579ec [file] [log] [blame]
<!DOCTYPE html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="file:///gen/layout_test_data/mojo/public/js/mojo_bindings.js"></script>
<script src="file:///gen/services/device/public/interfaces/sensor_provider.mojom.js"></script>
<script src="resources/sensor-helpers.js"></script>
<script src="resources/generic-sensor-tests.js"></script>
<script>
'use strict';
if (!window.testRunner)
debug('This test cannot be run without the TestRunner');
const kDefaultReading = [1.12345, 2.12345, 3.12345];
function update_sensor_reading(buffer) {
buffer.set(kDefaultReading, 2);
}
function verify_sensor_reading({x, y, z, timestamp}, is_null) {
if (is_null)
return [x, y, z, timestamp].every(r => r === null);
return [x, y, z].every((r, i) => r === kDefaultReading[i]) && timestamp !== null;
}
runGenericSensorTests(Gyroscope, update_sensor_reading, verify_sensor_reading);
</script>