OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE HTML> | |
2 <script src="../../resources/testharness.js"></script> | |
3 <script src="../../resources/testharnessreport.js"></script> | |
4 <style> | |
5 | |
6 ::-webkit-scrollbar { | |
7 display: none; | |
8 } | |
9 body { | |
10 margin: 0px; | |
11 height: 1000px; | |
12 width: 1000px; | |
13 } | |
14 #scrollable { | |
15 background-color: #FF7F7F; | |
16 height: 600px; | |
17 width: 600px; | |
18 overflow: scroll; | |
19 } | |
20 #content { | |
21 height: 700px; | |
22 width: 700px; | |
23 } | |
24 | |
25 </style> | |
26 | |
27 <div id="scrollable"> | |
28 <div id="content"></div> | |
29 </div> | |
30 | |
31 <script> | |
32 | |
33 var div = document.getElementById('scrollable'); | |
34 var rect = div.getBoundingClientRect(); | |
35 | |
36 const TOUCH_SOURCE_TYPE = 1; // TOUCH_INPUT from synthetic_gesture_params.h | |
37 const WHEEL_SOURCE_TYPE = 2; // MOUSE_INPUT from synthetic_gesture_params.h | |
38 | |
39 var ScrollByTouch = 1847; // from enum Feature in UseCounter.h | |
40 var ScrollByWheel = 1848; // from enum Feature in UseCounter.h | |
41 | |
42 setup({ explicit_done: true }); | |
43 test(() => { | |
44 // Skip touch scroll use count test on mac since touch smoothScrollBy | |
45 // is not supported for mac. | |
bokan
2017/03/09 17:31:03
Just curious, where does this limitation come from
sahel
2017/03/10 16:21:33
synthetic_gesture_target_mac doesn't override the
bokan
2017/03/10 16:27:13
Acknowledged.
| |
46 if (navigator.platform.indexOf('Mac') == 0) { | |
47 scrollByWheel(); | |
48 } else { | |
49 chrome.gpuBenchmarking.smoothScrollBy(50, waitForTouchScrollAndCheck, | |
50 (rect.left + rect.right) / 2, | |
51 (rect.top + rect.bottom) / 2, | |
52 TOUCH_SOURCE_TYPE, "down", 4000); | |
53 } | |
54 | |
55 }, "Scrolling by touch/wheel on main/compositor should update usecounters."); | |
56 | |
57 function waitForTouchScrollAndCheck() { | |
58 if (internals.isUseCounted(document, ScrollByTouch)) | |
59 scrollByWheel(); | |
60 else | |
61 requestAnimationFrame(waitForTouchScrollAndCheck); | |
62 } | |
63 | |
64 function scrollByWheel() { | |
65 chrome.gpuBenchmarking.smoothScrollBy(50, waitForWheelScrollAndCheck, | |
66 (rect.left + rect.right) / 2, | |
67 (rect.top + rect.bottom) / 2, | |
68 WHEEL_SOURCE_TYPE, "down", 4000); | |
69 } | |
70 | |
71 function waitForWheelScrollAndCheck() { | |
72 if (internals.isUseCounted(document, ScrollByWheel)) | |
73 done(); | |
74 else | |
75 requestAnimationFrame(waitForWheelScrollAndCheck); | |
76 } | |
77 | |
78 </script> | |
OLD | NEW |