OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <body> |
| 4 <script src="../../../resources/js-test.js"></script> |
| 5 <script> |
| 6 description('Tests that adding a new devicelight event listener invokes a callba
ck.'); |
| 7 |
| 8 var mockLight = 10; |
| 9 |
| 10 if (window.testRunner) |
| 11 testRunner.setMockDeviceLight(mockLight); |
| 12 else |
| 13 debug('This test can not be run without the TestRunner'); |
| 14 |
| 15 var deviceLightEvent; |
| 16 function checkLight(event) { |
| 17 deviceLightEvent = event; |
| 18 shouldBe('deviceLightEvent.value', 'mockLight'); |
| 19 } |
| 20 |
| 21 function listener(event) { |
| 22 checkLight(event); |
| 23 finishJSTest(); |
| 24 } |
| 25 |
| 26 window.addEventListener('devicelight', listener); |
| 27 window.jsTestIsAsync = true; |
| 28 </script> |
| 29 </body> |
| 30 </html> |
OLD | NEW |