diff -r 000000000000 -r 6474c204b198 browser/devtools/profiler/test/browser_profiler_gecko_data.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/devtools/profiler/test/browser_profiler_gecko_data.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,52 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +const URL = "data:text/html;charset=utf8,

JavaScript Profiler test

"; + +let gTab, gPanel; + +function test() { + waitForExplicitFinish(); + + setUp(URL, function onSetUp(tab, browser, panel) { + gTab = tab; + gPanel = panel; + + function done() { + tearDown(gTab, () => { gPanel = null; gTab = null; }); + } + + Services.prefs.setBoolPref(SHOW_PLATFORM_DATA, false); + recordProfile() + .then(toggleGeckoDataOption) + .then(recordProfile) + .then(done); + }); +} + +function recordProfile() { + let deferred = promise.defer(); + let record = gPanel.controls.record; + + gPanel.once("started", () => { + gPanel.once("parsed", () => { + // We cannot be sure which data is returned by + // the profiler within a test. Until we get rid + // of Cleopatra, at least. + deferred.resolve(); + }); + + record.click(); + }); + + record.click(); + return deferred.promise; +} + +function toggleGeckoDataOption() { + ok(!gPanel.showPlatformData, "showPlatformData is not set"); + + Services.prefs.setBoolPref(SHOW_PLATFORM_DATA, true); + + ok(gPanel.showPlatformData, "showPlatformData is set"); +}