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

Unified Diff: LayoutTests/fast/dom/DeviceLight/add-listener-from-callback.html

Issue 490773003: [DeviceLight] Add Layout tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix comments Created 6 years 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/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..5b0c63c17ab1b66049061f32092e7f0d99231993
--- /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 invokes a callback.');
timvolodine 2015/03/30 13:00:54 why is this test called add-listener-from-callback
riju_ 2015/03/31 11:03:41 Done.
+
+var mockLight = 10;
+
+if (window.testRunner) {
+ testRunner.setMockDeviceLight(mockLight);
+ debug('TEST MODE enabled');
timvolodine 2015/03/30 13:00:54 don't think this debug message is necessary
riju_ 2015/03/31 11:03:41 Done.
+} 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>

Powered by Google App Engine
This is Rietveld 408576698