| 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..781626f83e78d1cf9f0f189fc907ae4a6b7d6a43
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/fast/events/event-target-passive-histograms.html
|
| @@ -0,0 +1,43 @@
|
| +<!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 silentHistogramCount(bucket)
|
| +{
|
| + try {
|
| + return internals.histogramCount("Event.PassiveForcedEventDispatchCancelled", bucket);
|
| + } catch(err) {
|
| + }
|
| + return 0;
|
| +}
|
| +
|
| +test(function() {
|
| + window.addEventListener('touchstart', function(e) {
|
| + assert_false(e.cancelable);
|
| + }, {});
|
| +
|
| + var countBefore = silentHistogramCount(kPreventDefaultNotCalled);
|
| + window.dispatchEvent(new TouchEvent('touchstart', {cancelable: false}));
|
| + assert_equals(countBefore + 1, silentHistogramCount(kPreventDefaultNotCalled));
|
| +
|
| +}, "Not calling prevent default");
|
| +
|
| +test(function() {
|
| + window.addEventListener('touchstart', function(e) {
|
| + assert_false(e.cancelable);
|
| + e.preventDefault();
|
| + }, {});
|
| +
|
| + var countBefore = silentHistogramCount(kDocumentLevelTouchPreventDefaultCalled);
|
| + window.dispatchEvent(new TouchEvent('touchstart', {cancelable: false}));
|
| + assert_equals(countBefore + 1, silentHistogramCount(kDocumentLevelTouchPreventDefaultCalled));
|
| +
|
| +}, "Caling prevent default");
|
| +
|
| +</script>
|
|
|