|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 "use strict"; |
|
5 |
|
6 function test() { |
|
7 requestLongerTimeout(2); |
|
8 runTests(); |
|
9 } |
|
10 |
|
11 function setup() { |
|
12 PanelUI.hide(); |
|
13 |
|
14 if (!BrowserUI.isStartTabVisible) { |
|
15 let tab = yield addTab("about:start"); |
|
16 |
|
17 yield waitForCondition(() => BrowserUI.isStartTabVisible); |
|
18 |
|
19 yield hideContextUI(); |
|
20 } |
|
21 |
|
22 BookmarksTestHelper.setup(); |
|
23 HistoryTestHelper.setup(); |
|
24 } |
|
25 |
|
26 function tearDown() { |
|
27 PanelUI.hide(); |
|
28 BookmarksTestHelper.restore(); |
|
29 HistoryTestHelper.restore(); |
|
30 Browser.selectedTab |
|
31 .browser |
|
32 .contentWindow |
|
33 .QueryInterface(Ci.nsIInterfaceRequestor) |
|
34 .getInterface(Ci.nsIDOMWindowUtils).clearNativeTouchSequence(); |
|
35 } |
|
36 |
|
37 /* |
|
38 * short up/down touch scroll. This test isn't affected by |
|
39 * skate or stationary apzc prefs provided the display port |
|
40 * is twice the height of the screen. Measures apzc/composition |
|
41 * perf since the display port (should) only render once. |
|
42 */ |
|
43 gTests.push({ |
|
44 desc: "short up/down touch scroll", |
|
45 run: function run() { |
|
46 yield addTab(chromeRoot + "res/scroll_test.html"); |
|
47 yield hideContextUI(); |
|
48 yield hideNavBar(); |
|
49 |
|
50 let stopwatch = new StopWatch(); |
|
51 let win = Browser.selectedTab.browser.contentWindow; |
|
52 let domUtils = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils); |
|
53 var touchdrag = new TouchDragAndHold(); |
|
54 touchdrag.useNativeEvents = true; |
|
55 touchdrag.stepTimeout = 5; |
|
56 touchdrag.numSteps = 20; |
|
57 |
|
58 stopwatch.start(); |
|
59 let recordingHandle = domUtils.startFrameTimeRecording(); |
|
60 for (let count = 0; count < 5; count++) { |
|
61 yield touchdrag.start(win, 100, (win.innerHeight - 50), 100, 50); |
|
62 touchdrag.end(); |
|
63 yield touchdrag.start(win, 100, 50, 100, (win.innerHeight - 50)); |
|
64 touchdrag.end(); |
|
65 } |
|
66 let intervals = domUtils.stopFrameTimeRecording(recordingHandle); |
|
67 let msec = stopwatch.stop(); |
|
68 |
|
69 |
|
70 PerfTest.declareTest("14C693E5-3ED3-4A5D-93BC-A31F130A8CDE", |
|
71 "touch scroll window", "graphics", "apzc", |
|
72 "Measures performance of up/down apzc scrolling within a window using FTR."); |
|
73 PerfTest.declareFrameRateResult(intervals.length, msec, "fps"); |
|
74 } |
|
75 }); |
|
76 |
|
77 /* |
|
78 * Long scroll a page of text, which will include repainting |
|
79 * content. |
|
80 */ |
|
81 gTests.push({ |
|
82 desc: "touch scroll", |
|
83 run: function run() { |
|
84 yield addTab(chromeRoot + "res/scroll_test_tall.html"); |
|
85 yield hideContextUI(); |
|
86 yield hideNavBar(); |
|
87 |
|
88 let stopwatch = new StopWatch(); |
|
89 let win = Browser.selectedTab.browser.contentWindow; |
|
90 let domUtils = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils); |
|
91 var touchdrag = new TouchDragAndHold(); |
|
92 touchdrag.useNativeEvents = true; |
|
93 touchdrag.stepTimeout = 5; |
|
94 touchdrag.numSteps = 20; |
|
95 |
|
96 stopwatch.start(); |
|
97 let recordingHandle = domUtils.startFrameTimeRecording(); |
|
98 for (let count = 0; count < 5; count++) { |
|
99 yield touchdrag.start(win, 100, (win.innerHeight - 50), 100, 50); |
|
100 touchdrag.end(); |
|
101 } |
|
102 let intervals = domUtils.stopFrameTimeRecording(recordingHandle); |
|
103 let msec = stopwatch.stop(); |
|
104 |
|
105 |
|
106 PerfTest.declareTest("4546F318-DC1B-4225-9196-D5196C87982A", |
|
107 "touch scroll text", "graphics", "apzc", |
|
108 "Measures performance of apzc scrolling for a large page of text using FTR."); |
|
109 PerfTest.declareFrameRateResult(intervals.length, msec, "fps"); |
|
110 } |
|
111 }); |
|
112 |
|
113 /* |
|
114 * Fling a page of text downward over a set of iterations |
|
115 * taking measurements for each fling. Content will repaint |
|
116 * and includes measurements that cover fling logic/prefs. |
|
117 */ |
|
118 gTests.push({ |
|
119 desc: "fling scroll", |
|
120 run: function run() { |
|
121 yield addTab(chromeRoot + "res/scroll_test_tall.html"); |
|
122 yield hideContextUI(); |
|
123 yield hideNavBar(); |
|
124 |
|
125 let stopwatch = new StopWatch(); |
|
126 let win = Browser.selectedTab.browser.contentWindow; |
|
127 let domUtils = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils); |
|
128 var touchdrag = new TouchDragAndHold(); |
|
129 touchdrag.useNativeEvents = true; |
|
130 touchdrag.stepTimeout = 5; |
|
131 touchdrag.numSteps = 10; |
|
132 |
|
133 let iterations = 3; |
|
134 let sets = []; |
|
135 for (let count = 0; count < iterations; count++) { |
|
136 let obsPromise = waitForObserver("apzc-transform-end", 30000); |
|
137 stopwatch.start(); |
|
138 let recordingHandle = domUtils.startFrameTimeRecording(); |
|
139 yield touchdrag.start(win, 100, (win.innerHeight - 50), 100, 50); |
|
140 touchdrag.end(); |
|
141 yield obsPromise; |
|
142 let intervals = domUtils.stopFrameTimeRecording(recordingHandle); |
|
143 let msec = stopwatch.stop(); |
|
144 sets[count] = { |
|
145 bands: PerfTest.computeHighLowBands(intervals, .1), |
|
146 frameRate: intervals.length / (msec / 1000.0) |
|
147 }; |
|
148 yield waitForMs(300); |
|
149 } |
|
150 |
|
151 let frameRate = 0, low = 0, ave = 0, high = 0; |
|
152 for (let count = 0; count < iterations; count++) { |
|
153 frameRate += sets[count].frameRate; |
|
154 low += sets[count].bands.low; |
|
155 ave += sets[count].bands.ave; |
|
156 high += sets[count].bands.high; |
|
157 |
|
158 } |
|
159 frameRate /= iterations; |
|
160 low /= iterations; |
|
161 ave /= iterations; |
|
162 high /= iterations; |
|
163 |
|
164 PerfTest.declareTest("A8EDF0D6-562B-4C4A-AC6B-1E4900FE0EE9", |
|
165 "fling text", "graphics", "apzc", |
|
166 "Measures frame rate of apzc fling for a large page of text using FTR."); |
|
167 PerfTest.declareNumericalResult(frameRate, "fps"); |
|
168 |
|
169 PerfTest.declareTest("F5E83238-383F-4665-8415-878AA027B4A3", |
|
170 "fling jank", "graphics", "apzc", |
|
171 "Displays the low, high, and average FTR frame intervals when flinging a page of text."); |
|
172 PerfTest.declareNumericalResults([ |
|
173 { value: low, desc: "low" }, |
|
174 { value: high, desc: "high", shareAxis: 0 }, |
|
175 { value: ave, desc: "average", shareAxis: 0 } |
|
176 ]); |
|
177 } |
|
178 }); |
|
179 |
|
180 /* |
|
181 * touch scroll the about:start page back and forth averaging |
|
182 * values across the entire set. Generally about:start should |
|
183 * only need to be painted once. Exercises composition and apzc. |
|
184 */ |
|
185 gTests.push({ |
|
186 desc: "touch scroll start", |
|
187 setUp: setup, |
|
188 tearDown: tearDown, |
|
189 run: function run() { |
|
190 let stopwatch = new StopWatch(); |
|
191 let win = Browser.selectedTab.browser.contentWindow; |
|
192 let domUtils = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils); |
|
193 |
|
194 var touchdrag = new TouchDragAndHold(); |
|
195 touchdrag.useNativeEvents = true; |
|
196 touchdrag.stepTimeout = 5; |
|
197 touchdrag.numSteps = 20; |
|
198 |
|
199 stopwatch.start(); |
|
200 let recordingHandle = domUtils.startFrameTimeRecording(); |
|
201 for (let count = 0; count < 5; count++) { |
|
202 yield touchdrag.start(win, (win.innerWidth - 50), (win.innerHeight - 50), 50, (win.innerHeight - 50)); |
|
203 touchdrag.end(); |
|
204 yield touchdrag.start(win, 50, (win.innerHeight - 50), (win.innerWidth - 50), (win.innerHeight - 50)); |
|
205 touchdrag.end(); |
|
206 } |
|
207 let intervals = domUtils.stopFrameTimeRecording(recordingHandle); |
|
208 let msec = stopwatch.stop(); |
|
209 |
|
210 PerfTest.declareTest("24C693E5-3ED3-4A5D-93BC-A31F130A8CDE", |
|
211 "touch scroll about:start", "graphics", "apzc", |
|
212 "Measures performance of apzc scrolling for about:start using FTR."); |
|
213 PerfTest.declareFrameRateResult(intervals.length, msec, "fps"); |
|
214 |
|
215 let results = PerfTest.computeHighLowBands(intervals, .1); |
|
216 PerfTest.declareTest("2E60F8B5-8925-4628-988E-E4C0BC6B34C7", |
|
217 "about:start jank", "graphics", "apzc", |
|
218 "Displays the low, high, and average FTR frame intervals for about:start."); |
|
219 PerfTest.declareNumericalResults([ |
|
220 { value: results.low, desc: "low" }, |
|
221 { value: results.high, desc: "high", shareAxis: 0 }, |
|
222 { value: results.ave, desc: "average", shareAxis: 0 } |
|
223 ]); |
|
224 } |
|
225 }); |