1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/metro/base/tests/mochiperf/browser_deck_01.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,53 @@ 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 +gTests.push({ 1.14 + desc: "deck offset", 1.15 + run: function run() { 1.16 + yield addTab("about:mozilla"); 1.17 + yield hideContextUI(); 1.18 + yield hideNavBar(); 1.19 + yield waitForMs(3000); 1.20 + 1.21 + let shiftDataSet = new Array(); 1.22 + let paintDataSet = new Array(); 1.23 + let stopwatch = new StopWatch(); 1.24 + let win = Browser.selectedTab.browser.contentWindow; 1.25 + let domUtils = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils); 1.26 + 1.27 + for (let idx = 0; idx < 10; idx++) { 1.28 + let recordingHandle = domUtils.startFrameTimeRecording(); 1.29 + stopwatch.start(); 1.30 + let promise = waitForEvent(window, "MozDeckOffsetChanged"); 1.31 + ContentAreaObserver.shiftBrowserDeck(300); 1.32 + yield promise; 1.33 + promise = waitForEvent(window, "MozDeckOffsetChanged"); 1.34 + ContentAreaObserver.shiftBrowserDeck(0); 1.35 + yield promise; 1.36 + stopwatch.stop(); 1.37 + yield waitForMs(500); 1.38 + let intervals = domUtils.stopFrameTimeRecording(recordingHandle); 1.39 + shiftDataSet.push(stopwatch.time()); 1.40 + paintDataSet.push(intervals.length); 1.41 + } 1.42 + 1.43 + PerfTest.declareTest("ecb5fbec-0b3d-490f-8d4a-13fa8963e54a", 1.44 + "shift browser deck", "browser", "ux", 1.45 + "Triggers multiple SKB deck shifting operations using an offset " + 1.46 + "value of 300px. Measures total time in milliseconds for a up/down " + 1.47 + "shift operation plus the total number of frames. Strips outliers."); 1.48 + let shiftAverage = PerfTest.computeAverage(shiftDataSet, { stripOutliers: true }); 1.49 + let paintAverage = PerfTest.computeAverage(paintDataSet, { stripOutliers: true }); 1.50 + PerfTest.declareNumericalResults([ 1.51 + { value: shiftAverage, desc: "msec" }, 1.52 + { value: paintAverage, desc: "frame count" }, 1.53 + ]); 1.54 + } 1.55 +}); 1.56 +