browser/metro/base/tests/mochiperf/browser_apzc.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial