Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(704)

Unified Diff: third_party/WebKit/LayoutTests/fast/events/event-target-passive-histograms.html

Issue 2137483003: Add UMA metrics for root scroller intervention to track forcing passive breakage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address nits Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/core.gypi » ('j') | third_party/WebKit/Source/platform/Histogram.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698