Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(537)

Side by Side Diff: LayoutTests/fast/dom/DeviceLight/script-tests/add-during-dispatch.js

Issue 143823004: Implement DeviceLight (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Work in Adam's comments Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 description('Test no fire listeners added during event dispatch.');
2
3 var mockEvent;
4 function setMockLight(value) {
5
6 mockEvent = {value: value};
7
8 if (window.testRunner)
9 testRunner.setMockDeviceLight(null != mockEvent.value, null == mockEvent .value ? 0 : mockEvent.value);
10 else
11 debug('This test can not be run without the TestRunner');
12 }
13
14 var deviceLightEvent;
15 function checkLight(event) {
16 deviceLightEvent = event;
17 shouldBe('deviceLightEvent.value', 'mockEvent.value');
18 }
19
20 function firstListener(event) {
21 checkLight(event);
22 window.removeEventListener('devicelight', firstListener);
23 window.addEventListener('devicelight', secondListener);
24 setTimeout(function(){finish();}, 100);
25 }
26
27 var numSecondListenerCalls = 0;
28 function secondListener(event) {
29 ++numSecondListenerCalls;
30 }
31
32 function finish() {
33 shouldBe('numSecondListenerCalls', '1');
34 finishJSTest();
35 }
36
37 setMockLight(10);
38 window.addEventListener('devicelight', firstListener);
39
40 window.jsTestIsAsync = true;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698