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: function timeTab(aUrl) { michael@0: return Task.spawn(function() { michael@0: let stopwatch = new StopWatch(true); michael@0: let tab = Browser.addTab(aUrl, true); michael@0: yield tab.pageShowPromise; michael@0: stopwatch.stop(); michael@0: Browser.closeTab(tab, { forceClose: true }) michael@0: yield waitForMs(500); michael@0: throw new Task.Result(stopwatch.time()); michael@0: }); michael@0: } michael@0: michael@0: gTests.push({ michael@0: desc: "tab open", michael@0: run: function run() { michael@0: yield addTab("about:blank"); michael@0: yield hideContextUI(); michael@0: yield waitForMs(5000); michael@0: michael@0: let openDataSet = new Array(); michael@0: for (let idx = 0; idx < 20; idx++) { michael@0: let time = yield timeTab("about:blank"); michael@0: openDataSet.push(time); michael@0: } michael@0: michael@0: // Give the browser a little time to clean up its tabs. 2 because michael@0: // we open a tab above as a base to get rid of the start screen. michael@0: yield waitForCondition(() => Browser.tabs.length == 2); michael@0: michael@0: PerfTest.declareTest("FBD7A532-D63A-44B5-9744-5CB07CFD131A", michael@0: "tab open", "browser", "ux", michael@0: "Open twenty tabs in succession, closing each before the next is opened. " + michael@0: "Gives the browser time to settle in between. Lets the ui react however it " + michael@0: "is designed to. Strips outliers."); michael@0: let result = PerfTest.computeAverage(openDataSet, { stripOutliers: true }); michael@0: PerfTest.declareNumericalResult(result, "msec"); michael@0: } michael@0: }); michael@0: