Chromium Code Reviews| Index: LayoutTests/fast/dom/DeviceLight/add-during-dispatch.html |
| diff --git a/LayoutTests/fast/dom/DeviceLight/add-during-dispatch.html b/LayoutTests/fast/dom/DeviceLight/add-during-dispatch.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b039dea352c4bad4392520e0d5ec5ced6ede7167 |
| --- /dev/null |
| +++ b/LayoutTests/fast/dom/DeviceLight/add-during-dispatch.html |
| @@ -0,0 +1,46 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<body> |
| +<script src="../../../resources/js-test.js"></script> |
| +<script> |
| +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.
|
| + |
| +var mockEvent; |
| +function setMockLight(value) { |
| + mockEvent = {value: value}; |
| + if (window.testRunner) |
| + testRunner.setMockDeviceLight(mockEvent.value); |
| + else |
| + debug('This test can not be run without the TestRunner'); |
| +} |
| + |
| +var deviceLightEvent; |
| +function checkLight(event) { |
| + deviceLightEvent = event; |
| + shouldBe('deviceLightEvent.value', 'mockEvent.value'); |
| +} |
| + |
| +function firstListener(event) { |
| + checkLight(event); |
| + window.removeEventListener('devicelight', firstListener); |
| + window.addEventListener('devicelight', secondListener); |
| + setTimeout(function(){finish();}, 100); |
|
timvolodine
2014/09/29 16:43:53
why do we need timeout of 100ms? generally it's be
|
| +} |
| + |
| +var numSecondListenerCalls = 0; |
| +function secondListener(event) { |
| + ++numSecondListenerCalls; |
| +} |
| + |
| +function finish() { |
| + shouldBe('numSecondListenerCalls', '1'); |
| + finishJSTest(); |
| +} |
| + |
| +setMockLight(10); |
| +window.addEventListener('devicelight', firstListener); |
| + |
| +window.jsTestIsAsync = true; |
| +</script> |
| +</body> |
| +</html> |