| Index: LayoutTests/fast/dom/DeviceLight/script-tests/add-during-dispatch.js
|
| diff --git a/LayoutTests/fast/dom/DeviceLight/script-tests/add-during-dispatch.js b/LayoutTests/fast/dom/DeviceLight/script-tests/add-during-dispatch.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..2026edbd9d92b9554539485f3c42ca9026435a00
|
| --- /dev/null
|
| +++ b/LayoutTests/fast/dom/DeviceLight/script-tests/add-during-dispatch.js
|
| @@ -0,0 +1,41 @@
|
| +description('Test no fire listeners added during event dispatch.');
|
| +
|
| +var mockEvent;
|
| +function setMockLight(value) {
|
| +
|
| + mockEvent = {value: value};
|
| +
|
| + if (window.testRunner)
|
| + testRunner.setMockDeviceLight(null != mockEvent.value, null == mockEvent.value ? 0 : mockEvent.value);
|
| + else
|
| + debug('This test can not be run without the TestRunner');
|
| +}
|
| +
|
| +
|
| +var deviceMotionLight;
|
| +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);
|
| +}
|
| +
|
| +var numSecondListenerCalls = 0;
|
| +function secondListener(event) {
|
| + ++numSecondListenerCalls;
|
| +}
|
| +
|
| +function finish() {
|
| + shouldBe('numSecondListenerCalls', '1');
|
| + finishJSTest();
|
| +}
|
| +
|
| +setMockLight(1, 10);
|
| +window.addEventListener('devicelight', firstListener);
|
| +
|
| +window.jsTestIsAsync = true;
|
|
|