|
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 requestLongerTimeout(2); |
|
8 runTests(); |
|
9 } |
|
10 |
|
11 function tapRadius() { |
|
12 let dpi = Util.displayDPI; |
|
13 return Services.prefs.getIntPref("ui.dragThresholdX") / 240 * dpi; // 27.999998728434246 |
|
14 } |
|
15 |
|
16 gTests.push({ |
|
17 desc: "scrollBy", |
|
18 run: function run() { |
|
19 yield addTab(chromeRoot + "res/scroll_test.html"); |
|
20 yield hideContextUI(); |
|
21 yield hideNavBar(); |
|
22 |
|
23 let stopwatch = new StopWatch(); |
|
24 let win = Browser.selectedTab.browser.contentWindow; |
|
25 let domUtils = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils); |
|
26 let deferExit = Promise.defer(); |
|
27 let recordingHandle = domUtils.startFrameTimeRecording(); |
|
28 |
|
29 function step() { |
|
30 if (stopwatch.time() < 5000) { |
|
31 win.scrollBy(0, 2); |
|
32 win.mozRequestAnimationFrame(step); |
|
33 return; |
|
34 } |
|
35 |
|
36 let intervals = domUtils.stopFrameTimeRecording(recordingHandle); |
|
37 let msec = stopwatch.stop(); |
|
38 PerfTest.declareTest("79235F74-037C-4F6B-AE47-FDCCC13458C3", |
|
39 "scrollBy scroll", "graphics", "content", |
|
40 "Measures performance of single line scrolls for a large page of text using FTR."); |
|
41 PerfTest.declareFrameRateResult(intervals.length, msec, "fps"); |
|
42 deferExit.resolve(); |
|
43 } |
|
44 |
|
45 stopwatch.start(); |
|
46 win.mozRequestAnimationFrame(step); |
|
47 yield deferExit.promise; |
|
48 } |
|
49 }); |
|
50 |
|
51 gTests.push({ |
|
52 desc: "canvas perf test", |
|
53 run: function run() { |
|
54 yield addTab(chromeRoot + "res/ripples.html"); |
|
55 yield hideContextUI(); |
|
56 yield hideNavBar(); |
|
57 |
|
58 let win = Browser.selectedTab.browser.contentWindow; |
|
59 let domUtils = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils); |
|
60 let recordingHandle = domUtils.startFrameTimeRecording(); |
|
61 PerfTest.declareTest("6A455F96-2B2C-4B3C-B387-1AF2F1747CCF", |
|
62 "ripples", "graphics", "canvas", |
|
63 "Measures animation frames during a computationally " + |
|
64 "heavy graphics demo using canvas using FTR."); |
|
65 let stopwatch = new StopWatch(true); |
|
66 // test page runs for 5 seconds |
|
67 let event = yield waitForEvent(win, "test", 10000); |
|
68 let intervals = domUtils.stopFrameTimeRecording(recordingHandle); |
|
69 let msec = stopwatch.stop(); |
|
70 PerfTest.declareFrameRateResult(intervals.length, msec, "fps"); |
|
71 } |
|
72 }); |
|
73 |
|
74 gTests.push({ |
|
75 desc: "video perf test", |
|
76 run: function run() { |
|
77 yield addTab(chromeRoot + "res/tidevideo.html"); |
|
78 let win = Browser.selectedTab.browser.contentWindow; |
|
79 let domUtils = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils); |
|
80 let video = win.document.getElementById("videoelement"); |
|
81 video.pause(); |
|
82 yield hideContextUI(); |
|
83 yield hideNavBar(); |
|
84 yield waitForMs(1000); |
|
85 PerfTest.declareTest("7F55F9C4-0ECF-4A13-9A9C-A38D46922C0B", |
|
86 "video playback (moz paints)", "graphics", "video", |
|
87 "Measures frames per second during five seconds of playback of an mp4."); |
|
88 |
|
89 let recordingHandle = domUtils.startFrameTimeRecording(); |
|
90 let stopwatch = new StopWatch(true); |
|
91 video.play(); |
|
92 yield waitForMs(5000); |
|
93 video.pause(); |
|
94 let intervals = domUtils.stopFrameTimeRecording(recordingHandle); |
|
95 let msec = stopwatch.stop(); |
|
96 PerfTest.declareFrameRateResult(intervals.length, msec, "fps"); |
|
97 |
|
98 PerfTest.declareTest("E132D333-4642-4597-B1F0-1E74B625DBD7", |
|
99 "video playback (moz stats)", "graphics", "video", |
|
100 "Report moz* related video performance stats during five seconds of playback of an mp4."); |
|
101 let results = []; |
|
102 results.push({ value: (video.mozDecodedFrames / msec) * 1000.0, desc: "mozDecodedFrames" }); |
|
103 results.push({ value: (video.mozParsedFrames / msec) * 1000.0, desc: "mozParsedFrames", shareAxis: 0 }); |
|
104 results.push({ value: (video.mozPresentedFrames / msec) * 1000.0, desc: "mozPresentedFrames", shareAxis: 0 }); |
|
105 results.push({ value: (video.mozPaintedFrames / msec) * 1000.0, desc: "mozPaintedFrames", shareAxis: 0 }); |
|
106 PerfTest.declareNumericalResults(results); |
|
107 } |
|
108 }); |