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

Side by Side Diff: LayoutTests/fast/dom/DeviceLight/script-tests/null-values.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('Tests using null values for some or all of the event properties.');
2
3 var mockEvent;
4 function setMockLight(lightValue) {
5
6 mockEvent = {value: lightValue};
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 deviceLightEvent;
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 setTimeout(function(){initSecondListener();}, 0);
25 }
26
27 function initSecondListener() {
28 setMockLight(20);
29 window.addEventListener('devicelight', secondListener);
30 }
31
32 function secondListener(event) {
33 checkLight(event);
34 window.removeEventListener('devicelight', secondListener);
35 setTimeout(function(){initThirdListener();}, 0);
36 }
37
38 function initThirdListener() {
39 setMockLight(30);
40 window.addEventListener('devicelight', thirdListener);
41 }
42
43 function thirdListener(event) {
44 checkLight(event);
45 window.removeEventListener('devicelight', thirdListener);
46 setTimeout(function(){initFourthListener();}, 0);
47 }
48
49 function initFourthListener() {
50 setMockLight(40);
51 window.addEventListener('devicelight', fourthListener);
52 }
53
54 function fourthListener(event) {
55 checkLight(event);
56 finishJSTest();
57 }
58
59 setMockLight(50);
60 window.addEventListener('devicelight', firstListener);
61
62 window.jsTestIsAsync = true;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698