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

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: DeviceLight API working fine (make the flag back to status=experimental) 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
15 var deviceMotionLight;
16 function checkLight(event) {
17 deviceLightEvent = event;
18 shouldBe('deviceLightEvent.value', 'mockEvent.value');
19 }
20
21 function firstListener(event) {
22 checkLight(event);
23 window.removeEventListener('devicelight', firstListener);
24 window.addEventListener('devicelight', secondListener);
25 setTimeout(function(){finish();}, 100);
26 }
27
28 var numSecondListenerCalls = 0;
29 function secondListener(event) {
30 ++numSecondListenerCalls;
31 }
32
33 function finish() {
34 shouldBe('numSecondListenerCalls', '1');
35 finishJSTest();
36 }
37
38 setMockLight(1, 10);
39 window.addEventListener('devicelight', firstListener);
40
41 window.jsTestIsAsync = true;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698