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('Test no fire listeners added during event dispatch.'); | |
|
timvolodine
2014/09/29 16:43:53
it's not clear to me what this is testing. from th
riju_
2015/03/27 12:25:36
I am deleting this test case as of now.
| |
| 7 | |
| 8 var mockEvent; | |
| 9 function setMockLight(value) { | |
| 10 mockEvent = {value: value}; | |
| 11 if (window.testRunner) | |
| 12 testRunner.setMockDeviceLight(mockEvent.value); | |
| 13 else | |
| 14 debug('This test can not be run without the TestRunner'); | |
| 15 } | |
| 16 | |
| 17 var deviceLightEvent; | |
| 18 function checkLight(event) { | |
| 19 deviceLightEvent = event; | |
| 20 shouldBe('deviceLightEvent.value', 'mockEvent.value'); | |
| 21 } | |
| 22 | |
| 23 function firstListener(event) { | |
| 24 checkLight(event); | |
| 25 window.removeEventListener('devicelight', firstListener); | |
| 26 window.addEventListener('devicelight', secondListener); | |
| 27 setTimeout(function(){finish();}, 100); | |
|
timvolodine
2014/09/29 16:43:53
why do we need timeout of 100ms? generally it's be
| |
| 28 } | |
| 29 | |
| 30 var numSecondListenerCalls = 0; | |
| 31 function secondListener(event) { | |
| 32 ++numSecondListenerCalls; | |
| 33 } | |
| 34 | |
| 35 function finish() { | |
| 36 shouldBe('numSecondListenerCalls', '1'); | |
| 37 finishJSTest(); | |
| 38 } | |
| 39 | |
| 40 setMockLight(10); | |
| 41 window.addEventListener('devicelight', firstListener); | |
| 42 | |
| 43 window.jsTestIsAsync = true; | |
| 44 </script> | |
| 45 </body> | |
| 46 </html> | |
| OLD | NEW |