summaryrefslogtreecommitdiffstats
path: root/devtools/server/tests/chrome/test_framerate_02.html
blob: 346ba0b22c141a91152fd810a4528be857e9decb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!DOCTYPE HTML>
<html>
<!--
Bug 1007200 - Create a framerate actor
-->
<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";

window.onload = async function() {
  const target = await getTargetForSelectedTab();
  const front = await target.getFront("framerate");

  const rawData = await front.stopRecording();
  ok(rawData, "There should be a recording available.");
  is(rawData.length, 0, "...but it should be empty.");

  const timeline = plotFPS(rawData);
  is(timeline.length, 2,
    "There should be one measurement plotted, with two entries.");

  info("The framerate should be assumed to be 0 if the recording is empty.");

  is(timeline[0].delta, 0,
    "The first time delta should be 0.");
  is(timeline[0].value, 0,
    "The first framerate value should be 0.");

  is(timeline[1].delta, 100,
    "The last time delta should be 100 (the default interval value).");
  is(timeline[1].value, 0,
    "The last framerate value should be 0.");

  await target.destroy();
  SimpleTest.finish();
};
</script>
</pre>
</body>
</html>