| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <title>AmbientLight Generic Sensor test</title> | |
| 4 <script type="text/javascript"> | |
| 5 var timeOrigin; | |
| 6 var sensor; | |
| 7 function onAmbientLightReadingChange() { | |
| 8 if (sensor.illuminance == 50 && | |
| 9 sensor.timestamp > timeOrigin && | |
| 10 sensor.timestamp < window.performance.now()) { | |
| 11 pass(); | |
| 12 } else { | |
| 13 fail(); | |
| 14 } | |
| 15 } | |
| 16 | |
| 17 function start() { | |
| 18 sensor = new AmbientLightSensor(); | |
| 19 timeOrigin = window.performance.now(); | |
| 20 sensor.onchange = | |
| 21 onAmbientLightReadingChange; | |
| 22 sensor.start(); | |
| 23 } | |
| 24 | |
| 25 function pass() { | |
| 26 document.getElementById('status').innerHTML = 'PASS'; | |
| 27 document.location = '#pass'; | |
| 28 } | |
| 29 | |
| 30 function fail() { | |
| 31 document.location = '#fail'; | |
| 32 } | |
| 33 </script> | |
| 34 </head> | |
| 35 <body onLoad="start()"> | |
| 36 <div id="status">FAIL</div> | |
| 37 </body> | |
| 38 </html> | |
| OLD | NEW |