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

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

Issue 2668173003: [Sensors] Remove SensorReading interfaces (Closed)
Patch Set: updated global-interface-listing.html Created 3 years, 10 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, expects_modified_reading, readsCount) { 16 function update_sensor_reading(buffer, expects_modified_reading, readsCount) {
17 buffer[1] = window.performance.now(); 17 buffer[1] = window.performance.now();
18 buffer[2] = kDefaultReadingValue; 18 buffer[2] = kDefaultReadingValue;
19 if (expects_modified_reading) 19 if (expects_modified_reading)
20 buffer[2] += readsCount; 20 buffer[2] += readsCount;
21 } 21 }
22 22
23 function verify_sensor_reading(reading) { 23 function verify_sensor_reading(reading) {
24 return reading.illuminance == kDefaultReadingValue; 24 return reading.illuminance == kDefaultReadingValue;
25 } 25 }
26 26
27 function verify_sensor_reading(sensor, should_be_null) {
28 if (should_be_null) {
29 return sensor.illuminance == null &&
30 sensor.timestamp == null;
31 }
32 return sensor.illuminance == kDefaultReadingValue &&
33 sensor.timestamp != null;
34 }
35
27 runGenericSensorTests(AmbientLightSensor, update_sensor_reading, verify_sensor_r eading); 36 runGenericSensorTests(AmbientLightSensor, update_sensor_reading, verify_sensor_r eading);
28 </script> 37 </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