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

Side by Side Diff: LayoutTests/perf/compositor-touch-hit-rects.html

Issue 1149253002: Remove LayoutTests/perf and associated references (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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 <html>
2 <head>
3 <style>
4 #test {
5 height: 0px;
6 }
7 .child {
8 height: 5px;
9 width: 5px;
10 margin: 5px;
11 }
12 .layer {
13 transform: translateZ(0);
14 }
15 </style>
16 </head>
17 <body>
18 <div id='test'>
19 </div>
20 <script src="../resources/magnitude-perf.js"></script>
21 <script>
22
23 function log(msg)
24 {
25 Magnitude._log(msg);
26 }
27
28 var testNode;
29
30 function setupFunction(magnitude, className)
31 {
32 testNode = document.getElementById('test');
33 testNode.innerHTML = '';
34 for(var i = 0; i < magnitude; i++) {
35 var child = document.createElement('div');
36 child.className = className;
37 testNode.appendChild(child);
38 }
39
40 // Force any pending full layout (since hit rect computation will be skipped
41 // when there is a layout pending). It's important that layout isn't dirtie d
42 // after this before the tests run, or we'll get low linear times for everyt hing.
43 document.body.getBoundingClientRect();
44
45 }
46
47 // Test 1 tests that rect calculation is linear in the number of rects in a laye r.
48
49 function setupFunction1(magnitude)
50 {
51 setupFunction(magnitude, 'child');
52 }
53
54 // Test 2 tests that rect calculation is linear in the number of layers.
55
56 function setupFunction2(magnitude)
57 {
58 setupFunction(magnitude, 'child layer');
59 }
60
61 function touchHandler(event)
62 {
63 }
64
65 function test(magnitude)
66 {
67 // Adding or removing a touch handler will force recomputation of the
68 // touch hit rects. Note layout also forces recomputation and is the more
69 // relevant scenario, but is too noisy to use for a perf test.
70 testNode.addEventListener('touchstart', touchHandler);
71
72 // Note that if the times aren't coming out as expected, you should check he re that the expected
73 // touch hit rects were generated by using window.internals.touchEventTarget LayerRects(document).
74 // For example, run in content_shell with --expose-internals-for-testing.
75 testNode.removeEventListener('touchstart', touchHandler);
76 }
77
78 Magnitude.description('Tests that compositor touch hit rect calculation is ' +
79 'linear in the number of rects and in the number of layers .');
80
81 // Wait for first layout.
82 document.body.getBoundingClientRect();
83
84 function main()
85 {
86 // Verify that compositor touch hit testing is properly enabled.
87 if (!window.internals) {
88 log("WARNING - missing windows.internals, can't verify hit testing is en abled.");
89 return;
90 }
91 var testNode = document.getElementById('test');
92 r = testNode.getBoundingClientRect();
93
94 testNode.addEventListener('touchstart', touchHandler);
95 var rects = window.internals.touchEventTargetLayerRects(document);
96 if (!rects) {
97 log("FAIL - no hit test rects exist, is compositing enabled?");
98 return;
99 }
100 if (!rects.length) {
101 log("FAIL - no hit test rects found, is ScrollingCoordinator::touchHitTest ingEnabled false?");
102 return;
103 }
104 testNode.removeEventListener('touchstart', touchHandler);
105
106
107 Magnitude.trim = 1;
108 Magnitude.tolerance = 0.80;
109
110 Magnitude.initialExponent = 7;
111 Magnitude.numPoints = 5;
112 Magnitude.run(setupFunction1, test, Magnitude.LINEAR);
113
114 Magnitude.initialExponent = 4;
115 Magnitude.numPoints = 5;
116 Magnitude.run(setupFunction2, test, Magnitude.LINEAR);
117 }
118 main();
119
120 </script>
121 </body>
OLDNEW
« no previous file with comments | « LayoutTests/perf/array-nested-loop-expected.txt ('k') | LayoutTests/perf/compositor-touch-hit-rects-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698