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

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

mercurial