1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/metro/base/tests/mochiperf/browser_tabs_01.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,48 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +"use strict"; 1.8 + 1.9 +function test() { 1.10 + runTests(); 1.11 +} 1.12 + 1.13 +function timeTab(aUrl) { 1.14 + return Task.spawn(function() { 1.15 + let stopwatch = new StopWatch(true); 1.16 + let tab = Browser.addTab(aUrl, true); 1.17 + yield tab.pageShowPromise; 1.18 + stopwatch.stop(); 1.19 + Browser.closeTab(tab, { forceClose: true }) 1.20 + yield waitForMs(500); 1.21 + throw new Task.Result(stopwatch.time()); 1.22 + }); 1.23 +} 1.24 + 1.25 +gTests.push({ 1.26 + desc: "tab open", 1.27 + run: function run() { 1.28 + yield addTab("about:blank"); 1.29 + yield hideContextUI(); 1.30 + yield waitForMs(5000); 1.31 + 1.32 + let openDataSet = new Array(); 1.33 + for (let idx = 0; idx < 20; idx++) { 1.34 + let time = yield timeTab("about:blank"); 1.35 + openDataSet.push(time); 1.36 + } 1.37 + 1.38 + // Give the browser a little time to clean up its tabs. 2 because 1.39 + // we open a tab above as a base to get rid of the start screen. 1.40 + yield waitForCondition(() => Browser.tabs.length == 2); 1.41 + 1.42 + PerfTest.declareTest("FBD7A532-D63A-44B5-9744-5CB07CFD131A", 1.43 + "tab open", "browser", "ux", 1.44 + "Open twenty tabs in succession, closing each before the next is opened. " + 1.45 + "Gives the browser time to settle in between. Lets the ui react however it " + 1.46 + "is designed to. Strips outliers."); 1.47 + let result = PerfTest.computeAverage(openDataSet, { stripOutliers: true }); 1.48 + PerfTest.declareNumericalResult(result, "msec"); 1.49 + } 1.50 +}); 1.51 +