browser/devtools/profiler/test/browser_profiler_gecko_data.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/profiler/test/browser_profiler_gecko_data.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,52 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +const URL = "data:text/html;charset=utf8,<p>JavaScript Profiler test</p>";
     1.8 +
     1.9 +let gTab, gPanel;
    1.10 +
    1.11 +function test() {
    1.12 +  waitForExplicitFinish();
    1.13 +
    1.14 +  setUp(URL, function onSetUp(tab, browser, panel) {
    1.15 +    gTab = tab;
    1.16 +    gPanel = panel;
    1.17 +
    1.18 +    function done() {
    1.19 +      tearDown(gTab, () => { gPanel = null; gTab = null; });
    1.20 +    }
    1.21 +
    1.22 +    Services.prefs.setBoolPref(SHOW_PLATFORM_DATA, false);
    1.23 +    recordProfile()
    1.24 +      .then(toggleGeckoDataOption)
    1.25 +      .then(recordProfile)
    1.26 +      .then(done);
    1.27 +  });
    1.28 +}
    1.29 +
    1.30 +function recordProfile() {
    1.31 +  let deferred = promise.defer();
    1.32 +  let record = gPanel.controls.record;
    1.33 +
    1.34 +  gPanel.once("started", () => {
    1.35 +    gPanel.once("parsed", () => {
    1.36 +      // We cannot be sure which data is returned by
    1.37 +      // the profiler within a test. Until we get rid
    1.38 +      // of Cleopatra, at least.
    1.39 +      deferred.resolve();
    1.40 +    });
    1.41 +
    1.42 +    record.click();
    1.43 +  });
    1.44 +
    1.45 +  record.click();
    1.46 +  return deferred.promise;
    1.47 +}
    1.48 +
    1.49 +function toggleGeckoDataOption() {
    1.50 +  ok(!gPanel.showPlatformData, "showPlatformData is not set");
    1.51 +
    1.52 +  Services.prefs.setBoolPref(SHOW_PLATFORM_DATA, true);
    1.53 +
    1.54 +  ok(gPanel.showPlatformData, "showPlatformData is set");
    1.55 +}

mercurial