browser/devtools/profiler/test/browser_profiler_controller.js

Thu, 15 Jan 2015 21:13:52 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:13:52 +0100
branch
TOR_BUG_9701
changeset 12
7540298fafa1
permissions
-rw-r--r--

Remove forgotten relic of ABI crash risk averse overloaded method change.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 const URL = "data:text/html;charset=utf8,<p>JavaScript Profiler test</p>";
michael@0 5
michael@0 6 let gTab, gPanel;
michael@0 7
michael@0 8 function test() {
michael@0 9 waitForExplicitFinish();
michael@0 10
michael@0 11 setUp(URL, function onSetUp(tab, browser, panel) {
michael@0 12 gTab = tab;
michael@0 13 gPanel = panel;
michael@0 14
michael@0 15 testInactive(startFirstProfile);
michael@0 16 });
michael@0 17 }
michael@0 18
michael@0 19 function testInactive(next=function(){}) {
michael@0 20 gPanel.controller.isActive(function (err, isActive) {
michael@0 21 ok(!err, "isActive didn't return any errors");
michael@0 22 ok(!isActive, "Profiler is not active");
michael@0 23 next();
michael@0 24 });
michael@0 25 }
michael@0 26
michael@0 27 function testActive(next=function(){}) {
michael@0 28 gPanel.controller.isActive(function (err, isActive) {
michael@0 29 ok(!err, "isActive didn't return any errors");
michael@0 30 ok(isActive, "Profiler is active");
michael@0 31 next();
michael@0 32 });
michael@0 33 }
michael@0 34
michael@0 35 function startFirstProfile() {
michael@0 36 gPanel.controller.start("Profile 1", function (err) {
michael@0 37 ok(!err, "Profile 1 started without errors");
michael@0 38 testActive(startSecondProfile);
michael@0 39 });
michael@0 40 }
michael@0 41
michael@0 42 function startSecondProfile() {
michael@0 43 gPanel.controller.start("Profile 2", function (err) {
michael@0 44 ok(!err, "Profile 2 started without errors");
michael@0 45 testActive(stopFirstProfile);
michael@0 46 });
michael@0 47 }
michael@0 48
michael@0 49 function stopFirstProfile() {
michael@0 50 gPanel.controller.stop("Profile 1", function (err, data) {
michael@0 51 ok(!err, "Profile 1 stopped without errors");
michael@0 52 ok(data, "Profiler returned some data");
michael@0 53
michael@0 54 testActive(stopSecondProfile);
michael@0 55 });
michael@0 56 }
michael@0 57
michael@0 58 function stopSecondProfile() {
michael@0 59 gPanel.controller.stop("Profile 2", function (err, data) {
michael@0 60 ok(!err, "Profile 2 stopped without errors");
michael@0 61 ok(data, "Profiler returned some data");
michael@0 62 testInactive(tearDown.call(null, gTab, function () gTab = gPanel = null));
michael@0 63 });
michael@0 64 }

mercurial