Chromium Code Reviews| 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/> |
|
bokan
2016/04/26 19:54:59
Self closing tags aren't a thing in HTML are they?
|
| +<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> |