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

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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 gTests.push({
michael@0 11 desc: "deck offset",
michael@0 12 run: function run() {
michael@0 13 yield addTab("about:mozilla");
michael@0 14 yield hideContextUI();
michael@0 15 yield hideNavBar();
michael@0 16 yield waitForMs(3000);
michael@0 17
michael@0 18 let shiftDataSet = new Array();
michael@0 19 let paintDataSet = new Array();
michael@0 20 let stopwatch = new StopWatch();
michael@0 21 let win = Browser.selectedTab.browser.contentWindow;
michael@0 22 let domUtils = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
michael@0 23
michael@0 24 for (let idx = 0; idx < 10; idx++) {
michael@0 25 let recordingHandle = domUtils.startFrameTimeRecording();
michael@0 26 stopwatch.start();
michael@0 27 let promise = waitForEvent(window, "MozDeckOffsetChanged");
michael@0 28 ContentAreaObserver.shiftBrowserDeck(300);
michael@0 29 yield promise;
michael@0 30 promise = waitForEvent(window, "MozDeckOffsetChanged");
michael@0 31 ContentAreaObserver.shiftBrowserDeck(0);
michael@0 32 yield promise;
michael@0 33 stopwatch.stop();
michael@0 34 yield waitForMs(500);
michael@0 35 let intervals = domUtils.stopFrameTimeRecording(recordingHandle);
michael@0 36 shiftDataSet.push(stopwatch.time());
michael@0 37 paintDataSet.push(intervals.length);
michael@0 38 }
michael@0 39
michael@0 40 PerfTest.declareTest("ecb5fbec-0b3d-490f-8d4a-13fa8963e54a",
michael@0 41 "shift browser deck", "browser", "ux",
michael@0 42 "Triggers multiple SKB deck shifting operations using an offset " +
michael@0 43 "value of 300px. Measures total time in milliseconds for a up/down " +
michael@0 44 "shift operation plus the total number of frames. Strips outliers.");
michael@0 45 let shiftAverage = PerfTest.computeAverage(shiftDataSet, { stripOutliers: true });
michael@0 46 let paintAverage = PerfTest.computeAverage(paintDataSet, { stripOutliers: true });
michael@0 47 PerfTest.declareNumericalResults([
michael@0 48 { value: shiftAverage, desc: "msec" },
michael@0 49 { value: paintAverage, desc: "frame count" },
michael@0 50 ]);
michael@0 51 }
michael@0 52 });
michael@0 53

mercurial