michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: "use strict"; michael@0: michael@0: function test() { michael@0: requestLongerTimeout(2); michael@0: runTests(); michael@0: } michael@0: michael@0: function tapRadius() { michael@0: let dpi = Util.displayDPI; michael@0: return Services.prefs.getIntPref("ui.dragThresholdX") / 240 * dpi; // 27.999998728434246 michael@0: } michael@0: michael@0: gTests.push({ michael@0: desc: "scrollBy", michael@0: run: function run() { michael@0: yield addTab(chromeRoot + "res/scroll_test.html"); michael@0: yield hideContextUI(); michael@0: yield hideNavBar(); michael@0: michael@0: let stopwatch = new StopWatch(); michael@0: let win = Browser.selectedTab.browser.contentWindow; michael@0: let domUtils = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils); michael@0: let deferExit = Promise.defer(); michael@0: let recordingHandle = domUtils.startFrameTimeRecording(); michael@0: michael@0: function step() { michael@0: if (stopwatch.time() < 5000) { michael@0: win.scrollBy(0, 2); michael@0: win.mozRequestAnimationFrame(step); michael@0: return; michael@0: } michael@0: michael@0: let intervals = domUtils.stopFrameTimeRecording(recordingHandle); michael@0: let msec = stopwatch.stop(); michael@0: PerfTest.declareTest("79235F74-037C-4F6B-AE47-FDCCC13458C3", michael@0: "scrollBy scroll", "graphics", "content", michael@0: "Measures performance of single line scrolls for a large page of text using FTR."); michael@0: PerfTest.declareFrameRateResult(intervals.length, msec, "fps"); michael@0: deferExit.resolve(); michael@0: } michael@0: michael@0: stopwatch.start(); michael@0: win.mozRequestAnimationFrame(step); michael@0: yield deferExit.promise; michael@0: } michael@0: }); michael@0: michael@0: gTests.push({ michael@0: desc: "canvas perf test", michael@0: run: function run() { michael@0: yield addTab(chromeRoot + "res/ripples.html"); michael@0: yield hideContextUI(); michael@0: yield hideNavBar(); michael@0: michael@0: let win = Browser.selectedTab.browser.contentWindow; michael@0: let domUtils = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils); michael@0: let recordingHandle = domUtils.startFrameTimeRecording(); michael@0: PerfTest.declareTest("6A455F96-2B2C-4B3C-B387-1AF2F1747CCF", michael@0: "ripples", "graphics", "canvas", michael@0: "Measures animation frames during a computationally " + michael@0: "heavy graphics demo using canvas using FTR."); michael@0: let stopwatch = new StopWatch(true); michael@0: // test page runs for 5 seconds michael@0: let event = yield waitForEvent(win, "test", 10000); michael@0: let intervals = domUtils.stopFrameTimeRecording(recordingHandle); michael@0: let msec = stopwatch.stop(); michael@0: PerfTest.declareFrameRateResult(intervals.length, msec, "fps"); michael@0: } michael@0: }); michael@0: michael@0: gTests.push({ michael@0: desc: "video perf test", michael@0: run: function run() { michael@0: yield addTab(chromeRoot + "res/tidevideo.html"); michael@0: let win = Browser.selectedTab.browser.contentWindow; michael@0: let domUtils = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils); michael@0: let video = win.document.getElementById("videoelement"); michael@0: video.pause(); michael@0: yield hideContextUI(); michael@0: yield hideNavBar(); michael@0: yield waitForMs(1000); michael@0: PerfTest.declareTest("7F55F9C4-0ECF-4A13-9A9C-A38D46922C0B", michael@0: "video playback (moz paints)", "graphics", "video", michael@0: "Measures frames per second during five seconds of playback of an mp4."); michael@0: michael@0: let recordingHandle = domUtils.startFrameTimeRecording(); michael@0: let stopwatch = new StopWatch(true); michael@0: video.play(); michael@0: yield waitForMs(5000); michael@0: video.pause(); michael@0: let intervals = domUtils.stopFrameTimeRecording(recordingHandle); michael@0: let msec = stopwatch.stop(); michael@0: PerfTest.declareFrameRateResult(intervals.length, msec, "fps"); michael@0: michael@0: PerfTest.declareTest("E132D333-4642-4597-B1F0-1E74B625DBD7", michael@0: "video playback (moz stats)", "graphics", "video", michael@0: "Report moz* related video performance stats during five seconds of playback of an mp4."); michael@0: let results = []; michael@0: results.push({ value: (video.mozDecodedFrames / msec) * 1000.0, desc: "mozDecodedFrames" }); michael@0: results.push({ value: (video.mozParsedFrames / msec) * 1000.0, desc: "mozParsedFrames", shareAxis: 0 }); michael@0: results.push({ value: (video.mozPresentedFrames / msec) * 1000.0, desc: "mozPresentedFrames", shareAxis: 0 }); michael@0: results.push({ value: (video.mozPaintedFrames / msec) * 1000.0, desc: "mozPaintedFrames", shareAxis: 0 }); michael@0: PerfTest.declareNumericalResults(results); michael@0: } michael@0: });