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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script>
4 <script>
5
6 // These constants match the enumeration bucket for the
7 // Event.PassiveForcedEventDispatchCancelled histogram.
8 var kPreventDefaultNotCalled = 0;
9 var kDocumentLevelTouchPreventDefaultCalled = 1;
10
11 function silentHistogramCount(bucket)
12 {
13 try {
14 return internals.histogramCount("Event.PassiveForcedEventDispatchCancelled", bucket);
15 } catch(err) {
16 }
17 return 0;
18 }
19
20 test(function() {
21 window.addEventListener('touchstart', function(e) {
22 assert_false(e.cancelable);
23 }, {});
24
25 var countBefore = silentHistogramCount(kPreventDefaultNotCalled);
26 window.dispatchEvent(new TouchEvent('touchstart', {cancelable: false}));
27 assert_equals(countBefore + 1, silentHistogramCount(kPreventDefaultNotCalled)) ;
28
29 }, "Not calling prevent default");
30
31 test(function() {
32 window.addEventListener('touchstart', function(e) {
33 assert_false(e.cancelable);
34 e.preventDefault();
35 }, {});
36
37 var countBefore = silentHistogramCount(kDocumentLevelTouchPreventDefaultCalled );
38 window.dispatchEvent(new TouchEvent('touchstart', {cancelable: false}));
39 assert_equals(countBefore + 1, silentHistogramCount(kDocumentLevelTouchPrevent DefaultCalled));
40
41 }, "Caling prevent default");
42
43 </script>
OLDNEW
« 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