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

Side by Side Diff: LayoutTests/fast/dom/DeviceLight/add-during-dispatch.html

Issue 490773003: [DeviceLight] Add Layout tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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 <!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>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698