Chromium Code Reviews| 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 from a callback works as expected.'); | |
|
timvolodine
2014/09/29 16:43:53
what does "from a callback" mean? i don't see any
riju_
2015/03/27 12:25:36
Done.
| |
| 7 | |
| 8 var mockLight = 10; | |
| 9 | |
| 10 if (window.testRunner) { | |
| 11 testRunner.setMockDeviceLight(mockLight); | |
| 12 debug('TEST MODE enabled'); | |
| 13 } else | |
| 14 debug('This test can not be run without the TestRunner'); | |
| 15 | |
| 16 var deviceLightEvent; | |
| 17 function checkLight(event) { | |
| 18 deviceLightEvent = event; | |
| 19 shouldBe('deviceLightEvent.value', 'mockLight'); | |
| 20 } | |
| 21 | |
| 22 function listener(event) { | |
| 23 checkLight(event); | |
| 24 finishJSTest(); | |
| 25 } | |
| 26 | |
| 27 window.addEventListener('devicelight', listener); | |
| 28 window.jsTestIsAsync = true; | |
| 29 </script> | |
| 30 </body> | |
| 31 </html> | |
| OLD | NEW |