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: runTests(); michael@0: } michael@0: michael@0: gTests.push({ michael@0: desc: "deck offset", michael@0: run: function run() { michael@0: yield addTab("about:mozilla"); michael@0: yield hideContextUI(); michael@0: yield hideNavBar(); michael@0: yield waitForMs(3000); michael@0: michael@0: let shiftDataSet = new Array(); michael@0: let paintDataSet = new Array(); 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: for (let idx = 0; idx < 10; idx++) { michael@0: let recordingHandle = domUtils.startFrameTimeRecording(); michael@0: stopwatch.start(); michael@0: let promise = waitForEvent(window, "MozDeckOffsetChanged"); michael@0: ContentAreaObserver.shiftBrowserDeck(300); michael@0: yield promise; michael@0: promise = waitForEvent(window, "MozDeckOffsetChanged"); michael@0: ContentAreaObserver.shiftBrowserDeck(0); michael@0: yield promise; michael@0: stopwatch.stop(); michael@0: yield waitForMs(500); michael@0: let intervals = domUtils.stopFrameTimeRecording(recordingHandle); michael@0: shiftDataSet.push(stopwatch.time()); michael@0: paintDataSet.push(intervals.length); michael@0: } michael@0: michael@0: PerfTest.declareTest("ecb5fbec-0b3d-490f-8d4a-13fa8963e54a", michael@0: "shift browser deck", "browser", "ux", michael@0: "Triggers multiple SKB deck shifting operations using an offset " + michael@0: "value of 300px. Measures total time in milliseconds for a up/down " + michael@0: "shift operation plus the total number of frames. Strips outliers."); michael@0: let shiftAverage = PerfTest.computeAverage(shiftDataSet, { stripOutliers: true }); michael@0: let paintAverage = PerfTest.computeAverage(paintDataSet, { stripOutliers: true }); michael@0: PerfTest.declareNumericalResults([ michael@0: { value: shiftAverage, desc: "msec" }, michael@0: { value: paintAverage, desc: "frame count" }, michael@0: ]); michael@0: } michael@0: }); michael@0: