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

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: Add ability to test histograms from layout tests 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..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>

Powered by Google App Engine
This is Rietveld 408576698