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

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

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 runTests();
michael@0 8 }
michael@0 9
michael@0 10 function timeTab(aUrl) {
michael@0 11 return Task.spawn(function() {
michael@0 12 let stopwatch = new StopWatch(true);
michael@0 13 let tab = Browser.addTab(aUrl, true);
michael@0 14 yield tab.pageShowPromise;
michael@0 15 stopwatch.stop();
michael@0 16 Browser.closeTab(tab, { forceClose: true })
michael@0 17 yield waitForMs(500);
michael@0 18 throw new Task.Result(stopwatch.time());
michael@0 19 });
michael@0 20 }
michael@0 21
michael@0 22 gTests.push({
michael@0 23 desc: "tab open",
michael@0 24 run: function run() {
michael@0 25 yield addTab("about:blank");
michael@0 26 yield hideContextUI();
michael@0 27 yield waitForMs(5000);
michael@0 28
michael@0 29 let openDataSet = new Array();
michael@0 30 for (let idx = 0; idx < 20; idx++) {
michael@0 31 let time = yield timeTab("about:blank");
michael@0 32 openDataSet.push(time);
michael@0 33 }
michael@0 34
michael@0 35 // Give the browser a little time to clean up its tabs. 2 because
michael@0 36 // we open a tab above as a base to get rid of the start screen.
michael@0 37 yield waitForCondition(() => Browser.tabs.length == 2);
michael@0 38
michael@0 39 PerfTest.declareTest("FBD7A532-D63A-44B5-9744-5CB07CFD131A",
michael@0 40 "tab open", "browser", "ux",
michael@0 41 "Open twenty tabs in succession, closing each before the next is opened. " +
michael@0 42 "Gives the browser time to settle in between. Lets the ui react however it " +
michael@0 43 "is designed to. Strips outliers.");
michael@0 44 let result = PerfTest.computeAverage(openDataSet, { stripOutliers: true });
michael@0 45 PerfTest.declareNumericalResult(result, "msec");
michael@0 46 }
michael@0 47 });
michael@0 48

mercurial