michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: "use strict"; michael@0: michael@0: function test() { michael@0: requestLongerTimeout(2); michael@0: runTests(); michael@0: } michael@0: michael@0: function setup() { michael@0: PanelUI.hide(); michael@0: michael@0: if (!BrowserUI.isStartTabVisible) { michael@0: let tab = yield addTab("about:start"); michael@0: michael@0: yield waitForCondition(() => BrowserUI.isStartTabVisible); michael@0: michael@0: yield hideContextUI(); michael@0: } michael@0: michael@0: BookmarksTestHelper.setup(); michael@0: HistoryTestHelper.setup(); michael@0: } michael@0: michael@0: function tearDown() { michael@0: PanelUI.hide(); michael@0: BookmarksTestHelper.restore(); michael@0: HistoryTestHelper.restore(); michael@0: Browser.selectedTab michael@0: .browser michael@0: .contentWindow michael@0: .QueryInterface(Ci.nsIInterfaceRequestor) michael@0: .getInterface(Ci.nsIDOMWindowUtils).clearNativeTouchSequence(); michael@0: } michael@0: michael@0: /* michael@0: * short up/down touch scroll. This test isn't affected by michael@0: * skate or stationary apzc prefs provided the display port michael@0: * is twice the height of the screen. Measures apzc/composition michael@0: * perf since the display port (should) only render once. michael@0: */ michael@0: gTests.push({ michael@0: desc: "short up/down touch scroll", michael@0: run: function run() { michael@0: yield addTab(chromeRoot + "res/scroll_test.html"); michael@0: yield hideContextUI(); michael@0: yield hideNavBar(); michael@0: michael@0: let stopwatch = new StopWatch(); michael@0: let win = Browser.selectedTab.browser.contentWindow; michael@0: let domUtils = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils); michael@0: var touchdrag = new TouchDragAndHold(); michael@0: touchdrag.useNativeEvents = true; michael@0: touchdrag.stepTimeout = 5; michael@0: touchdrag.numSteps = 20; michael@0: michael@0: stopwatch.start(); michael@0: let recordingHandle = domUtils.startFrameTimeRecording(); michael@0: for (let count = 0; count < 5; count++) { michael@0: yield touchdrag.start(win, 100, (win.innerHeight - 50), 100, 50); michael@0: touchdrag.end(); michael@0: yield touchdrag.start(win, 100, 50, 100, (win.innerHeight - 50)); michael@0: touchdrag.end(); michael@0: } michael@0: let intervals = domUtils.stopFrameTimeRecording(recordingHandle); michael@0: let msec = stopwatch.stop(); michael@0: michael@0: michael@0: PerfTest.declareTest("14C693E5-3ED3-4A5D-93BC-A31F130A8CDE", michael@0: "touch scroll window", "graphics", "apzc", michael@0: "Measures performance of up/down apzc scrolling within a window using FTR."); michael@0: PerfTest.declareFrameRateResult(intervals.length, msec, "fps"); michael@0: } michael@0: }); michael@0: michael@0: /* michael@0: * Long scroll a page of text, which will include repainting michael@0: * content. michael@0: */ michael@0: gTests.push({ michael@0: desc: "touch scroll", michael@0: run: function run() { michael@0: yield addTab(chromeRoot + "res/scroll_test_tall.html"); michael@0: yield hideContextUI(); michael@0: yield hideNavBar(); michael@0: michael@0: let stopwatch = new StopWatch(); michael@0: let win = Browser.selectedTab.browser.contentWindow; michael@0: let domUtils = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils); michael@0: var touchdrag = new TouchDragAndHold(); michael@0: touchdrag.useNativeEvents = true; michael@0: touchdrag.stepTimeout = 5; michael@0: touchdrag.numSteps = 20; michael@0: michael@0: stopwatch.start(); michael@0: let recordingHandle = domUtils.startFrameTimeRecording(); michael@0: for (let count = 0; count < 5; count++) { michael@0: yield touchdrag.start(win, 100, (win.innerHeight - 50), 100, 50); michael@0: touchdrag.end(); michael@0: } michael@0: let intervals = domUtils.stopFrameTimeRecording(recordingHandle); michael@0: let msec = stopwatch.stop(); michael@0: michael@0: michael@0: PerfTest.declareTest("4546F318-DC1B-4225-9196-D5196C87982A", michael@0: "touch scroll text", "graphics", "apzc", michael@0: "Measures performance of apzc scrolling for a large page of text using FTR."); michael@0: PerfTest.declareFrameRateResult(intervals.length, msec, "fps"); michael@0: } michael@0: }); michael@0: michael@0: /* michael@0: * Fling a page of text downward over a set of iterations michael@0: * taking measurements for each fling. Content will repaint michael@0: * and includes measurements that cover fling logic/prefs. michael@0: */ michael@0: gTests.push({ michael@0: desc: "fling scroll", michael@0: run: function run() { michael@0: yield addTab(chromeRoot + "res/scroll_test_tall.html"); michael@0: yield hideContextUI(); michael@0: yield hideNavBar(); michael@0: michael@0: let stopwatch = new StopWatch(); michael@0: let win = Browser.selectedTab.browser.contentWindow; michael@0: let domUtils = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils); michael@0: var touchdrag = new TouchDragAndHold(); michael@0: touchdrag.useNativeEvents = true; michael@0: touchdrag.stepTimeout = 5; michael@0: touchdrag.numSteps = 10; michael@0: michael@0: let iterations = 3; michael@0: let sets = []; michael@0: for (let count = 0; count < iterations; count++) { michael@0: let obsPromise = waitForObserver("apzc-transform-end", 30000); michael@0: stopwatch.start(); michael@0: let recordingHandle = domUtils.startFrameTimeRecording(); michael@0: yield touchdrag.start(win, 100, (win.innerHeight - 50), 100, 50); michael@0: touchdrag.end(); michael@0: yield obsPromise; michael@0: let intervals = domUtils.stopFrameTimeRecording(recordingHandle); michael@0: let msec = stopwatch.stop(); michael@0: sets[count] = { michael@0: bands: PerfTest.computeHighLowBands(intervals, .1), michael@0: frameRate: intervals.length / (msec / 1000.0) michael@0: }; michael@0: yield waitForMs(300); michael@0: } michael@0: michael@0: let frameRate = 0, low = 0, ave = 0, high = 0; michael@0: for (let count = 0; count < iterations; count++) { michael@0: frameRate += sets[count].frameRate; michael@0: low += sets[count].bands.low; michael@0: ave += sets[count].bands.ave; michael@0: high += sets[count].bands.high; michael@0: michael@0: } michael@0: frameRate /= iterations; michael@0: low /= iterations; michael@0: ave /= iterations; michael@0: high /= iterations; michael@0: michael@0: PerfTest.declareTest("A8EDF0D6-562B-4C4A-AC6B-1E4900FE0EE9", michael@0: "fling text", "graphics", "apzc", michael@0: "Measures frame rate of apzc fling for a large page of text using FTR."); michael@0: PerfTest.declareNumericalResult(frameRate, "fps"); michael@0: michael@0: PerfTest.declareTest("F5E83238-383F-4665-8415-878AA027B4A3", michael@0: "fling jank", "graphics", "apzc", michael@0: "Displays the low, high, and average FTR frame intervals when flinging a page of text."); michael@0: PerfTest.declareNumericalResults([ michael@0: { value: low, desc: "low" }, michael@0: { value: high, desc: "high", shareAxis: 0 }, michael@0: { value: ave, desc: "average", shareAxis: 0 } michael@0: ]); michael@0: } michael@0: }); michael@0: michael@0: /* michael@0: * touch scroll the about:start page back and forth averaging michael@0: * values across the entire set. Generally about:start should michael@0: * only need to be painted once. Exercises composition and apzc. michael@0: */ michael@0: gTests.push({ michael@0: desc: "touch scroll start", michael@0: setUp: setup, michael@0: tearDown: tearDown, michael@0: run: function run() { michael@0: let stopwatch = new StopWatch(); michael@0: let win = Browser.selectedTab.browser.contentWindow; michael@0: let domUtils = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils); michael@0: michael@0: var touchdrag = new TouchDragAndHold(); michael@0: touchdrag.useNativeEvents = true; michael@0: touchdrag.stepTimeout = 5; michael@0: touchdrag.numSteps = 20; michael@0: michael@0: stopwatch.start(); michael@0: let recordingHandle = domUtils.startFrameTimeRecording(); michael@0: for (let count = 0; count < 5; count++) { michael@0: yield touchdrag.start(win, (win.innerWidth - 50), (win.innerHeight - 50), 50, (win.innerHeight - 50)); michael@0: touchdrag.end(); michael@0: yield touchdrag.start(win, 50, (win.innerHeight - 50), (win.innerWidth - 50), (win.innerHeight - 50)); michael@0: touchdrag.end(); michael@0: } michael@0: let intervals = domUtils.stopFrameTimeRecording(recordingHandle); michael@0: let msec = stopwatch.stop(); michael@0: michael@0: PerfTest.declareTest("24C693E5-3ED3-4A5D-93BC-A31F130A8CDE", michael@0: "touch scroll about:start", "graphics", "apzc", michael@0: "Measures performance of apzc scrolling for about:start using FTR."); michael@0: PerfTest.declareFrameRateResult(intervals.length, msec, "fps"); michael@0: michael@0: let results = PerfTest.computeHighLowBands(intervals, .1); michael@0: PerfTest.declareTest("2E60F8B5-8925-4628-988E-E4C0BC6B34C7", michael@0: "about:start jank", "graphics", "apzc", michael@0: "Displays the low, high, and average FTR frame intervals for about:start."); michael@0: PerfTest.declareNumericalResults([ michael@0: { value: results.low, desc: "low" }, michael@0: { value: results.high, desc: "high", shareAxis: 0 }, michael@0: { value: results.ave, desc: "average", shareAxis: 0 } michael@0: ]); michael@0: } michael@0: });