| 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 silentHistogramCount(bucket) |
| 12 { |
| 13 try { |
| 14 return internals.histogramCount("Event.PassiveForcedEventDispatchCancelled",
bucket); |
| 15 } catch(err) { |
| 16 } |
| 17 return 0; |
| 18 } |
| 19 |
| 20 test(function() { |
| 21 window.addEventListener('touchstart', function(e) { |
| 22 assert_false(e.cancelable); |
| 23 }, {}); |
| 24 |
| 25 var countBefore = silentHistogramCount(kPreventDefaultNotCalled); |
| 26 window.dispatchEvent(new TouchEvent('touchstart', {cancelable: false})); |
| 27 assert_equals(countBefore + 1, silentHistogramCount(kPreventDefaultNotCalled))
; |
| 28 |
| 29 }, "Not calling prevent default"); |
| 30 |
| 31 test(function() { |
| 32 window.addEventListener('touchstart', function(e) { |
| 33 assert_false(e.cancelable); |
| 34 e.preventDefault(); |
| 35 }, {}); |
| 36 |
| 37 var countBefore = silentHistogramCount(kDocumentLevelTouchPreventDefaultCalled
); |
| 38 window.dispatchEvent(new TouchEvent('touchstart', {cancelable: false})); |
| 39 assert_equals(countBefore + 1, silentHistogramCount(kDocumentLevelTouchPrevent
DefaultCalled)); |
| 40 |
| 41 }, "Caling prevent default"); |
| 42 |
| 43 </script> |
| OLD | NEW |