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

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 "use strict";
     6 function test() {
     7   runTests();
     8 }
    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 }
    22 gTests.push({
    23   desc: "tab open",
    24   run: function run() {
    25     yield addTab("about:blank");
    26     yield hideContextUI();
    27     yield waitForMs(5000);
    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     }
    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);
    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 });

mercurial