| 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..0ded8c613ffc222a03274184147cd9ce84572fe4
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/fast/events/event-target-passive-histograms.html
|
| @@ -0,0 +1,47 @@
|
| +<!DOCTYPE html>
|
| +<script src="../../resources/testharness.js"></script>
|
| +<script src="../../resources/testharnessreport.js"></script>
|
| +<script>
|
| +
|
| +// These constants match the enumeration bucket for the
|
| +// Event.PassiveForcedEventDispatchCancelled histogram.
|
| +var kPreventDefaultNotCalled = 0;
|
| +var kDocumentLevelTouchPreventDefaultCalled = 1;
|
| +
|
| +function histogramCount(bucket)
|
| +{
|
| + return internals.histogramCount("Event.PassiveForcedEventDispatchCancelled", bucket);
|
| +}
|
| +
|
| +test(function() {
|
| + internals.clearHistogramCounts();
|
| +
|
| + var listener = function(e) {
|
| + assert_false(e.cancelable);
|
| + };
|
| +
|
| + window.addEventListener('touchstart', listener, {});
|
| + window.dispatchEvent(new TouchEvent('touchstart', {cancelable: false}));
|
| + window.removeEventListener('touchstart', listener, {});
|
| +
|
| + assert_equals(histogramCount(kDocumentLevelTouchPreventDefaultCalled), 0);
|
| + assert_equals(histogramCount(kPreventDefaultNotCalled), 1);
|
| +}, "Not calling prevent default");
|
| +
|
| +test(function() {
|
| + internals.clearHistogramCounts();
|
| +
|
| + var listener = function(e) {
|
| + assert_false(e.cancelable);
|
| + e.preventDefault();
|
| + };
|
| +
|
| + window.addEventListener('touchstart', listener, {});
|
| + window.dispatchEvent(new TouchEvent('touchstart', {cancelable: false}));
|
| + window.removeEventListener('touchstart', listener, {});
|
| +
|
| + assert_equals(histogramCount(kPreventDefaultNotCalled), 0);
|
| + assert_equals(histogramCount(kDocumentLevelTouchPreventDefaultCalled), 1);
|
| +}, "Caling prevent default");
|
| +
|
| +</script>
|
|
|