summaryrefslogtreecommitdiffstats
path: root/devtools/server/tests/mochitest/test_framerate_03.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /devtools/server/tests/mochitest/test_framerate_03.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'devtools/server/tests/mochitest/test_framerate_03.html')
-rw-r--r--devtools/server/tests/mochitest/test_framerate_03.html82
1 files changed, 82 insertions, 0 deletions
diff --git a/devtools/server/tests/mochitest/test_framerate_03.html b/devtools/server/tests/mochitest/test_framerate_03.html
new file mode 100644
index 000000000..da76ebc20
--- /dev/null
+++ b/devtools/server/tests/mochitest/test_framerate_03.html
@@ -0,0 +1,82 @@
+<!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>
+
+window.onload = function() {
+ var Cu = Components.utils;
+ var Cc = Components.classes;
+ var Ci = Components.interfaces;
+
+ var {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
+ var {DebuggerClient} = require("devtools/shared/client/main");
+ var {DebuggerServer} = require("devtools/server/main");
+ var 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();
+
+ var {FramerateFront} = require("devtools/shared/fronts/framerate");
+ var START_TICK = 2000;
+ var STOP_TICK = 3000;
+ var TOTAL_TIME = 5000;
+
+ if (!DebuggerServer.initialized) {
+ DebuggerServer.init();
+ DebuggerServer.addBrowserActors();
+ }
+
+ var client = new DebuggerClient(DebuggerServer.connectPipe());
+ client.connect().then(function onConnect() {
+ client.listTabs(function onListTabs(aResponse) {
+ var form = aResponse.tabs[aResponse.selected];
+ var front = FramerateFront(client, form);
+
+ front.startRecording().then(() => {
+ window.setTimeout(() => {
+ front.stopRecording(START_TICK, STOP_TICK).then(rawData => {
+ onRecordingStopped(front, rawData);
+ });
+ }, TOTAL_TIME);
+ });
+ });
+ });
+
+ 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 (var 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>