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

Unified Diff: LayoutTests/fast/dom/DeviceLight/script-tests/add-listener-from-callback.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, 10 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/dom/DeviceLight/script-tests/add-listener-from-callback.js
diff --git a/LayoutTests/fast/dom/DeviceLight/script-tests/add-listener-from-callback.js b/LayoutTests/fast/dom/DeviceLight/script-tests/add-listener-from-callback.js
new file mode 100644
index 0000000000000000000000000000000000000000..1d180ea2d68f7771e089287d31c3b138ccc461d0
--- /dev/null
+++ b/LayoutTests/fast/dom/DeviceLight/script-tests/add-listener-from-callback.js
@@ -0,0 +1,23 @@
+description('Tests that adding a new devicelight event listener from a callback works as expected.');
+
+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;

Powered by Google App Engine
This is Rietveld 408576698