| 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 kDefaultReadingValue = 3.1415; | 14 const kDefaultReadingValue = 3.1415; |
| 15 | 15 |
| 16 function update_sensor_reading(buffer) { | 16 function update_sensor_reading(buffer) { |
| 17 buffer[1] = window.performance.now(); | |
| 18 buffer[2] = kDefaultReadingValue; | 17 buffer[2] = kDefaultReadingValue; |
| 19 } | 18 } |
| 20 | 19 |
| 21 function verify_sensor_reading(reading) { | 20 function verify_sensor_reading(reading) { |
| 22 return reading.illuminance == kDefaultReadingValue; | 21 return reading.illuminance == kDefaultReadingValue; |
| 23 } | 22 } |
| 24 | 23 |
| 25 function verify_sensor_reading(sensor, should_be_null) { | 24 function verify_sensor_reading(sensor, should_be_null) { |
| 26 if (should_be_null) { | 25 if (should_be_null) { |
| 27 return sensor.illuminance == null && | 26 return sensor.illuminance == null && |
| 28 sensor.timestamp == null; | 27 sensor.timestamp == null; |
| 29 } | 28 } |
| 30 return sensor.illuminance == kDefaultReadingValue && | 29 return sensor.illuminance == kDefaultReadingValue && |
| 31 sensor.timestamp != null; | 30 sensor.timestamp != null; |
| 32 } | 31 } |
| 33 | 32 |
| 34 runGenericSensorTests(AmbientLightSensor, update_sensor_reading, verify_sensor_r
eading); | 33 runGenericSensorTests(AmbientLightSensor, update_sensor_reading, verify_sensor_r
eading); |
| 35 </script> | 34 </script> |
| OLD | NEW |