Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/events/event-target-passive-histograms.html |
| diff --git a/third_party/WebKit/LayoutTests/fast/events/event-target-passive-histograms.html b/third_party/WebKit/LayoutTests/fast/events/event-target-passive-histograms.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..cbb2f0d17332e5983b4e3d05719da857a20ab5b4 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/fast/events/event-target-passive-histograms.html |
| @@ -0,0 +1,38 @@ |
| +<!DOCTYPE html> |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| +<script> |
| + |
| +function silentHistogramCount(bucket) |
| +{ |
| + try { |
| + return internals.histogramCount("Event.PassiveForcedEventDispatchBreakage", bucket); |
| + } catch(err) { |
| + } |
| + return 0; |
| +} |
| + |
| +test(function() { |
| + window.addEventListener('touchstart', function(e) { |
| + assert_false(e.cancelable); |
| + }, {}); |
| + |
| + var countBefore = silentHistogramCount(0); |
| + window.dispatchEvent(new TouchEvent('touchstart', {cancelable: false})); |
| + assert_equals(countBefore + 1, silentHistogramCount(0)); |
|
Rick Byers
2016/07/11 14:41:52
nit: rather than use hard-coded bucket values, ple
dtapuska
2016/07/11 15:46:05
Done.
|
| + |
| +}, "Not calling prevent default"); |
| + |
| +test(function() { |
| + window.addEventListener('touchstart', function(e) { |
| + assert_false(e.cancelable); |
| + e.preventDefault(); |
| + }, {}); |
| + |
| + var countBefore = silentHistogramCount(1); |
| + window.dispatchEvent(new TouchEvent('touchstart', {cancelable: false})); |
| + assert_equals(countBefore + 1, silentHistogramCount(1)); |
| + |
| +}, "Caling prevent default"); |
| + |
| +</script> |