mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-29 20:57:43 -10:00
Remove the main file that we don't need anymore and modify all the imports to target the specific file they now need. MozReview-Commit-ID: 2uWjTnAMAU0
84 lines
2.4 KiB
HTML
84 lines
2.4 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<!--
|
|
Bug 1023018 - Tests whether or not the framerate actor can handle time ranges.
|
|
-->
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Framerate actor test</title>
|
|
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
|
</head>
|
|
<body>
|
|
<pre id="test">
|
|
<script>
|
|
"use strict";
|
|
|
|
window.onload = function () {
|
|
const Cu = Components.utils;
|
|
|
|
const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
|
const {DebuggerClient} = require("devtools/shared/client/debugger-client");
|
|
const {DebuggerServer} = require("devtools/server/main");
|
|
const Services = require("Services");
|
|
|
|
// Always log packets when running tests.
|
|
Services.prefs.setBoolPref("devtools.debugger.log", true);
|
|
SimpleTest.registerCleanupFunction(function () {
|
|
Services.prefs.clearUserPref("devtools.debugger.log");
|
|
});
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
const {FramerateFront} = require("devtools/shared/fronts/framerate");
|
|
const START_TICK = 2000;
|
|
const STOP_TICK = 3000;
|
|
const TOTAL_TIME = 5000;
|
|
|
|
if (!DebuggerServer.initialized) {
|
|
DebuggerServer.init();
|
|
DebuggerServer.addBrowserActors();
|
|
}
|
|
|
|
let client = new DebuggerClient(DebuggerServer.connectPipe());
|
|
client.connect().then(function onConnect() {
|
|
client.listTabs(function onListTabs(response) {
|
|
let form = response.tabs[response.selected];
|
|
let front = FramerateFront(client, form);
|
|
|
|
front.startRecording().then(() => {
|
|
/* eslint-disable max-nested-callbacks */
|
|
window.setTimeout(() => {
|
|
front.stopRecording(START_TICK, STOP_TICK).then(rawData => {
|
|
onRecordingStopped(front, rawData);
|
|
});
|
|
}, TOTAL_TIME);
|
|
/* eslint-enable max-nested-callbacks */
|
|
});
|
|
});
|
|
});
|
|
|
|
function onRecordingStopped(front, rawData) {
|
|
ok(rawData, "There should be a recording available.");
|
|
|
|
ok(!rawData.find(e => e < START_TICK),
|
|
"There should be no tick before 2000ms.");
|
|
ok(!rawData.find(e => e > STOP_TICK),
|
|
"There should be no tick after 3000ms.");
|
|
|
|
for (let tick of rawData) {
|
|
info("Testing tick: " + tick);
|
|
is(typeof tick, "number", "All values should be numbers.");
|
|
}
|
|
|
|
client.close().then(() => {
|
|
DebuggerServer.destroy();
|
|
SimpleTest.finish();
|
|
});
|
|
}
|
|
};
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|