summaryrefslogtreecommitdiffstats
path: root/devtools/server/tests/chrome/test_framerate_03.html
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/server/tests/chrome/test_framerate_03.html')
-rw-r--r--devtools/server/tests/chrome/test_framerate_03.html51
1 files changed, 51 insertions, 0 deletions
diff --git a/devtools/server/tests/chrome/test_framerate_03.html b/devtools/server/tests/chrome/test_framerate_03.html
new file mode 100644
index 0000000000..b8eca6c428
--- /dev/null
+++ b/devtools/server/tests/chrome/test_framerate_03.html
@@ -0,0 +1,51 @@
+<!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 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript" src="framerate-helpers.js"></script>
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
+</head>
+<body>
+<pre id="test">
+<script>
+"use strict";
+
+const START_TICK = 2000;
+const STOP_TICK = 3000;
+const TOTAL_TIME = 5000;
+
+window.onload = async function() {
+ const target = await getTargetForSelectedTab();
+ const front = await target.getFront("framerate");
+
+ await front.startRecording();
+ await waitFor(TOTAL_TIME);
+ const rawData = await front.stopRecording(START_TICK, STOP_TICK);
+ await onRecordingStopped(front, rawData);
+ await target.destroy();
+ SimpleTest.finish();
+};
+
+// Local Helper Functions
+async 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 (const tick of rawData) {
+ info("Testing tick: " + tick);
+ is(typeof tick, "number", "All values should be numbers.");
+ }
+}
+</script>
+</pre>
+</body>
+</html>