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

Side by Side Diff: content/test/data/generic_sensor/ambient_light_sensor_test.html

Issue 2472403002: [Sensors] Align sensor reading attribute implementation with the specification (Closed)
Patch Set: Remove a leftover from test Created 4 years, 1 month 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 <html> 1 <html>
2 <head> 2 <head>
3 <title>AmbientLight Generic Sensor test</title> 3 <title>AmbientLight Generic Sensor test</title>
4 <script type="text/javascript"> 4 <script type="text/javascript">
5 var timeOrigin; 5 var timeOrigin;
6 var sensor;
6 function onAmbientLightReadingChange(event) { 7 function onAmbientLightReadingChange(event) {
timvolodine 2016/11/07 15:49:19 what's the event here? SensorReadingEvent has been
Mikhail 2016/11/08 09:09:15 indeed, thanks for the catch!
7 if (event.reading.illuminance == 50 && 8 if (sensor.reading.illuminance == 50 &&
8 event.reading.timeStamp > timeOrigin && 9 sensor.reading.timeStamp > timeOrigin &&
9 event.reading.timeStamp < window.performance.now()) { 10 sensor.reading.timeStamp < window.performance.now()) {
10 pass(); 11 pass();
11 } else { 12 } else {
12 fail(); 13 fail();
13 } 14 }
14 } 15 }
15 16
16 function start() { 17 function start() {
17 var sensor = new AmbientLightSensor(); 18 sensor = new AmbientLightSensor();
18 timeOrigin = window.performance.now(); 19 timeOrigin = window.performance.now();
19 sensor.onchange = function(e) { 20 sensor.onchange = function(e) {
20 onAmbientLightReadingChange(e); 21 onAmbientLightReadingChange(e);
21 }; 22 };
22 sensor.start(); 23 sensor.start();
23 } 24 }
24 25
25 function pass() { 26 function pass() {
26 document.getElementById('status').innerHTML = 'PASS'; 27 document.getElementById('status').innerHTML = 'PASS';
27 document.location = '#pass'; 28 document.location = '#pass';
28 } 29 }
29 30
30 function fail() { 31 function fail() {
31 document.location = '#fail'; 32 document.location = '#fail';
32 } 33 }
33 </script> 34 </script>
34 </head> 35 </head>
35 <body onLoad="start()"> 36 <body onLoad="start()">
36 <div id="status">FAIL</div> 37 <div id="status">FAIL</div>
37 </body> 38 </body>
38 </html> 39 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698