| Index: LayoutTests/fast/dom/DeviceLight/script-tests/null-values.js
|
| diff --git a/LayoutTests/fast/dom/DeviceLight/script-tests/null-values.js b/LayoutTests/fast/dom/DeviceLight/script-tests/null-values.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f1499cfd9f30a7a474ab1303a31415d23d2a0600
|
| --- /dev/null
|
| +++ b/LayoutTests/fast/dom/DeviceLight/script-tests/null-values.js
|
| @@ -0,0 +1,62 @@
|
| +description('Tests using null values for some or all of the event properties.');
|
| +
|
| +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 deviceLightEvent;
|
| +function checkLight(event) {
|
| + deviceLightEvent = event;
|
| + shouldBe('deviceLightEvent.value', 'mockEvent.value');
|
| +}
|
| +
|
| +function firstListener(event) {
|
| + checkLight(event);
|
| + window.removeEventListener('devicelight', firstListener);
|
| + setTimeout(function(){initSecondListener();}, 0);
|
| +}
|
| +
|
| +function initSecondListener() {
|
| + setMockLight(20);
|
| + window.addEventListener('devicelight', secondListener);
|
| +}
|
| +
|
| +function secondListener(event) {
|
| + checkLight(event);
|
| + window.removeEventListener('devicelight', secondListener);
|
| + setTimeout(function(){initThirdListener();}, 0);
|
| +}
|
| +
|
| +function initThirdListener() {
|
| + setMockLight(30);
|
| + window.addEventListener('devicelight', thirdListener);
|
| +}
|
| +
|
| +function thirdListener(event) {
|
| + checkLight(event);
|
| + window.removeEventListener('devicelight', thirdListener);
|
| + setTimeout(function(){initFourthListener();}, 0);
|
| +}
|
| +
|
| +function initFourthListener() {
|
| + setMockLight(40);
|
| + window.addEventListener('devicelight', fourthListener);
|
| +}
|
| +
|
| +function fourthListener(event) {
|
| + checkLight(event);
|
| + finishJSTest();
|
| +}
|
| +
|
| +setMockLight(50);
|
| +window.addEventListener('devicelight', firstListener);
|
| +
|
| +window.jsTestIsAsync = true;
|
|
|