michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: const URL = "data:text/html;charset=utf8,
JavaScript Profiler test
"; michael@0: michael@0: let gTab, gPanel; michael@0: michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: michael@0: setUp(URL, function onSetUp(tab, browser, panel) { michael@0: gTab = tab; michael@0: gPanel = panel; michael@0: michael@0: testInactive(startFirstProfile); michael@0: }); michael@0: } michael@0: michael@0: function testInactive(next=function(){}) { michael@0: gPanel.controller.isActive(function (err, isActive) { michael@0: ok(!err, "isActive didn't return any errors"); michael@0: ok(!isActive, "Profiler is not active"); michael@0: next(); michael@0: }); michael@0: } michael@0: michael@0: function testActive(next=function(){}) { michael@0: gPanel.controller.isActive(function (err, isActive) { michael@0: ok(!err, "isActive didn't return any errors"); michael@0: ok(isActive, "Profiler is active"); michael@0: next(); michael@0: }); michael@0: } michael@0: michael@0: function startFirstProfile() { michael@0: gPanel.controller.start("Profile 1", function (err) { michael@0: ok(!err, "Profile 1 started without errors"); michael@0: testActive(startSecondProfile); michael@0: }); michael@0: } michael@0: michael@0: function startSecondProfile() { michael@0: gPanel.controller.start("Profile 2", function (err) { michael@0: ok(!err, "Profile 2 started without errors"); michael@0: testActive(stopFirstProfile); michael@0: }); michael@0: } michael@0: michael@0: function stopFirstProfile() { michael@0: gPanel.controller.stop("Profile 1", function (err, data) { michael@0: ok(!err, "Profile 1 stopped without errors"); michael@0: ok(data, "Profiler returned some data"); michael@0: michael@0: testActive(stopSecondProfile); michael@0: }); michael@0: } michael@0: michael@0: function stopSecondProfile() { michael@0: gPanel.controller.stop("Profile 2", function (err, data) { michael@0: ok(!err, "Profile 2 stopped without errors"); michael@0: ok(data, "Profiler returned some data"); michael@0: testInactive(tearDown.call(null, gTab, function () gTab = gPanel = null)); michael@0: }); michael@0: }