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

Unified Diff: LayoutTests/fast/dom/DeviceLight/add-during-dispatch.html

Issue 490773003: [DeviceLight] Add Layout tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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/add-during-dispatch.html
diff --git a/LayoutTests/fast/dom/DeviceLight/add-during-dispatch.html b/LayoutTests/fast/dom/DeviceLight/add-during-dispatch.html
new file mode 100644
index 0000000000000000000000000000000000000000..b039dea352c4bad4392520e0d5ec5ced6ede7167
--- /dev/null
+++ b/LayoutTests/fast/dom/DeviceLight/add-during-dispatch.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src="../../../resources/js-test.js"></script>
+<script>
+description('Test no fire listeners added during event dispatch.');
timvolodine 2014/09/29 16:43:53 it's not clear to me what this is testing. from th
riju_ 2015/03/27 12:25:36 I am deleting this test case as of now.
+
+var mockEvent;
+function setMockLight(value) {
+ mockEvent = {value: value};
+ if (window.testRunner)
+ testRunner.setMockDeviceLight(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);
+ window.addEventListener('devicelight', secondListener);
+ setTimeout(function(){finish();}, 100);
timvolodine 2014/09/29 16:43:53 why do we need timeout of 100ms? generally it's be
+}
+
+var numSecondListenerCalls = 0;
+function secondListener(event) {
+ ++numSecondListenerCalls;
+}
+
+function finish() {
+ shouldBe('numSecondListenerCalls', '1');
+ finishJSTest();
+}
+
+setMockLight(10);
+window.addEventListener('devicelight', firstListener);
+
+window.jsTestIsAsync = true;
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698