| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../resources/testharness.js"></script> |
| 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <script> |
| 5 |
| 6 // These constants match the enumeration bucket for the |
| 7 // Event.PassiveForcedEventDispatchCancelled histogram. |
| 8 var kPreventDefaultNotCalled = 0; |
| 9 var kDocumentLevelTouchPreventDefaultCalled = 1; |
| 10 |
| 11 function histogramCount(bucket) |
| 12 { |
| 13 return internals.histogramCount("Event.PassiveForcedEventDispatchCancelled", b
ucket); |
| 14 } |
| 15 |
| 16 test(function() { |
| 17 internals.clearHistogramCounts(); |
| 18 |
| 19 var listener = function(e) { |
| 20 assert_false(e.cancelable); |
| 21 }; |
| 22 |
| 23 window.addEventListener('touchstart', listener, {}); |
| 24 window.dispatchEvent(new TouchEvent('touchstart', {cancelable: false})); |
| 25 window.removeEventListener('touchstart', listener, {}); |
| 26 |
| 27 assert_equals(histogramCount(kDocumentLevelTouchPreventDefaultCalled), 0); |
| 28 assert_equals(histogramCount(kPreventDefaultNotCalled), 1); |
| 29 }, "Not calling prevent default"); |
| 30 |
| 31 test(function() { |
| 32 internals.clearHistogramCounts(); |
| 33 |
| 34 var listener = function(e) { |
| 35 assert_false(e.cancelable); |
| 36 e.preventDefault(); |
| 37 }; |
| 38 |
| 39 window.addEventListener('touchstart', listener, {}); |
| 40 window.dispatchEvent(new TouchEvent('touchstart', {cancelable: false})); |
| 41 window.removeEventListener('touchstart', listener, {}); |
| 42 |
| 43 assert_equals(histogramCount(kPreventDefaultNotCalled), 0); |
| 44 assert_equals(histogramCount(kDocumentLevelTouchPreventDefaultCalled), 1); |
| 45 }, "Caling prevent default"); |
| 46 |
| 47 </script> |
| OLD | NEW |