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

Unified Diff: third_party/WebKit/LayoutTests/fast/events/eventlisteneroptions/passive_inequality.html

Issue 1922093003: Add AddEventListenerOptions addEventListenerOptions interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 7 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: third_party/WebKit/LayoutTests/fast/events/eventlisteneroptions/passive_inequality.html
diff --git a/third_party/WebKit/LayoutTests/fast/events/eventlisteneroptions/passive_inequality.html b/third_party/WebKit/LayoutTests/fast/events/eventlisteneroptions/passive_inequality.html
new file mode 100644
index 0000000000000000000000000000000000000000..726e3db8768f8fb99c489de914e39449d35d3236
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/events/eventlisteneroptions/passive_inequality.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML>
+<body/>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+
+<script>
+
+function passiveHandlerAddNonPassive() {
+ var handler = function handler(e) {
+ e.preventDefault();
+ assert_false(e.defaultPrevented);
+ }
+ document.addEventListener('test', handler, {"passive": true});
+ document.addEventListener('test', handler, {"passive": false});
+ document.body.dispatchEvent(new Event('test', {'bubbles': true, 'cancelable': true}));
+}
+
+function nonPassiveHandlerAddPassive() {
+ var handler = function handler(e) {
+ e.preventDefault();
+ assert_true(e.defaultPrevented);
+ }
+ document.addEventListener('test', handler, {"passive": false});
+ document.addEventListener('test', handler, {"passive": true});
+ document.body.dispatchEvent(new Event('test', {'bubbles': true, 'cancelable': true}));
+}
+
+function passiveHandlerAddNonPassiveCapturing() {
+ var handlersCalled = 0;
+ var handler = function handler(e) {
+ handlersCalled++;
+ }
+ document.addEventListener('test', handler, {"passive": true});
+ document.addEventListener('test', handler, {"passive": false, "capture": true});
+ document.body.dispatchEvent(new Event('test', {'bubbles': true, 'cancelable': true}));
+ assert_equals(handlersCalled, 2, "Handlers called correct number of times");
+}
+
+test(passiveHandlerAddNonPassive, "Passive Handler");
+test(nonPassiveHandlerAddPassive, "Non Passive Handler");
+test(passiveHandlerAddNonPassiveCapturing, "Passive Handler And Non Passive Capturing");
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698