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