browser/devtools/profiler/test/browser_profiler_gecko_data.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 const URL = "data:text/html;charset=utf8,<p>JavaScript Profiler test</p>";
     6 let gTab, gPanel;
     8 function test() {
     9   waitForExplicitFinish();
    11   setUp(URL, function onSetUp(tab, browser, panel) {
    12     gTab = tab;
    13     gPanel = panel;
    15     function done() {
    16       tearDown(gTab, () => { gPanel = null; gTab = null; });
    17     }
    19     Services.prefs.setBoolPref(SHOW_PLATFORM_DATA, false);
    20     recordProfile()
    21       .then(toggleGeckoDataOption)
    22       .then(recordProfile)
    23       .then(done);
    24   });
    25 }
    27 function recordProfile() {
    28   let deferred = promise.defer();
    29   let record = gPanel.controls.record;
    31   gPanel.once("started", () => {
    32     gPanel.once("parsed", () => {
    33       // We cannot be sure which data is returned by
    34       // the profiler within a test. Until we get rid
    35       // of Cleopatra, at least.
    36       deferred.resolve();
    37     });
    39     record.click();
    40   });
    42   record.click();
    43   return deferred.promise;
    44 }
    46 function toggleGeckoDataOption() {
    47   ok(!gPanel.showPlatformData, "showPlatformData is not set");
    49   Services.prefs.setBoolPref(SHOW_PLATFORM_DATA, true);
    51   ok(gPanel.showPlatformData, "showPlatformData is set");
    52 }

mercurial