Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1535)

Side by Side Diff: third_party/WebKit/LayoutTests/sensor/ambient-light-sensor.html

Issue 2885373002: [Sensors] Simplify calculation of the reporting period (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/sensor/accelerometer.html ('k') | third_party/WebKit/LayoutTests/sensor/gyroscope.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698