diff options
Diffstat (limited to 'devtools/server/tests/mochitest/test_framerate_05.html')
-rw-r--r-- | devtools/server/tests/mochitest/test_framerate_05.html | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/devtools/server/tests/mochitest/test_framerate_05.html b/devtools/server/tests/mochitest/test_framerate_05.html new file mode 100644 index 000000000..96f56a18f --- /dev/null +++ b/devtools/server/tests/mochitest/test_framerate_05.html @@ -0,0 +1,77 @@ +<!DOCTYPE HTML> +<html> +<!-- +Bug 1034648 - Tests whether a framerate recording can be cancelled. +--> +<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"); + + 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.cancelRecording().then(() => { + window.setTimeout(() => { + front.getPendingTicks().then(rawTicks => { + ok(rawTicks, + "The returned pending ticks should be empty (1)."); + is(rawTicks.length, 0, + "The returned pending ticks should be empty (2)."); + + front.stopRecording().then(rawData => { + ok(rawData, + "The returned raw data should be an empty array (1)."); + is(rawData.length, 0, + "The returned raw data should be an empty array (2)."); + + client.close().then(() => { + DebuggerServer.destroy(); + SimpleTest.finish() + }); + }); + }); + }, 1000); + }); + }, 1000); + }); + }); + }); +} +</script> +</pre> +</body> +</html> |