blob: f4ef0ac61ef1a1b90a1858e011bf0d5e47a432bb [file] [log] [blame]
<!DOCTYPE html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="../http/tests/resources/sensor-helpers.js"></script>
<script src="file:///gen/layout_test_data/mojo/public/js/mojo_bindings.js"></script>
<script src="file:///gen/services/device/public/mojom/sensor_provider.mojom.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 kDefaultReadingValue = 3.1415;
function update_sensor_reading(buffer) {
buffer[2] = kDefaultReadingValue;
}
function verify_sensor_reading({illuminance, timestamp}, is_null) {
if (is_null)
return illuminance === null && timestamp === null;
return illuminance === kDefaultReadingValue && timestamp !== null;
}
runGenericSensorTests(AmbientLightSensor,
device.mojom.SensorType.AMBIENT_LIGHT,
update_sensor_reading,
verify_sensor_reading,
null,
['ambient-light-sensor']);
</script>