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

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

Issue 2534703002: [Sensors] Layouts test to check frequency hint (Closed)
Patch Set: Comments from Reilly Created 4 years 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 var readsCount = 0;
15 16
16 function update_sensor_reading(buffer) { 17 function update_sensor_reading(buffer, expects_modified_reading) {
17 buffer[1] = window.performance.now(); 18 buffer[1] = window.performance.now();
18 buffer[2] = kDefaultReadingValue; 19 buffer[2] = kDefaultReadingValue;
20 if (expects_modified_reading)
21 buffer[2] += readsCount;
22
23 readsCount++;
19 } 24 }
20 25
21 function verify_sensor_reading(reading) { 26 function verify_sensor_reading(reading) {
22 return reading.illuminance == kDefaultReadingValue; 27 return reading.illuminance == kDefaultReadingValue;
23 } 28 }
24 29
25 runGenericSensorTests(AmbientLightSensor, update_sensor_reading, verify_sensor_r eading); 30 runGenericSensorTests(AmbientLightSensor, update_sensor_reading, verify_sensor_r eading);
26 </script> 31 </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