Chromium Code Reviews| Index: LayoutTests/fast/dom/DeviceLight/add-listener-from-callback.html |
| diff --git a/LayoutTests/fast/dom/DeviceLight/add-listener-from-callback.html b/LayoutTests/fast/dom/DeviceLight/add-listener-from-callback.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ae5a03524050e66415b7b03fc20bb4961b4bd5ec |
| --- /dev/null |
| +++ b/LayoutTests/fast/dom/DeviceLight/add-listener-from-callback.html |
| @@ -0,0 +1,31 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<body> |
| +<script src="../../../resources/js-test.js"></script> |
| +<script> |
| +description('Tests that adding a new devicelight event listener from a callback works as expected.'); |
|
timvolodine
2014/09/29 16:43:53
what does "from a callback" mean? i don't see any
riju_
2015/03/27 12:25:36
Done.
|
| + |
| +var mockLight = 10; |
| + |
| +if (window.testRunner) { |
| + testRunner.setMockDeviceLight(mockLight); |
| + debug('TEST MODE enabled'); |
| +} else |
| + debug('This test can not be run without the TestRunner'); |
| + |
| +var deviceLightEvent; |
| +function checkLight(event) { |
| + deviceLightEvent = event; |
| + shouldBe('deviceLightEvent.value', 'mockLight'); |
| +} |
| + |
| +function listener(event) { |
| + checkLight(event); |
| + finishJSTest(); |
| +} |
| + |
| +window.addEventListener('devicelight', listener); |
| +window.jsTestIsAsync = true; |
| +</script> |
| +</body> |
| +</html> |