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.

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 function done() {
michael@0 16 tearDown(gTab, () => { gPanel = null; gTab = null; });
michael@0 17 }
michael@0 18
michael@0 19 Services.prefs.setBoolPref(SHOW_PLATFORM_DATA, false);
michael@0 20 recordProfile()
michael@0 21 .then(toggleGeckoDataOption)
michael@0 22 .then(recordProfile)
michael@0 23 .then(done);
michael@0 24 });
michael@0 25 }
michael@0 26
michael@0 27 function recordProfile() {
michael@0 28 let deferred = promise.defer();
michael@0 29 let record = gPanel.controls.record;
michael@0 30
michael@0 31 gPanel.once("started", () => {
michael@0 32 gPanel.once("parsed", () => {
michael@0 33 // We cannot be sure which data is returned by
michael@0 34 // the profiler within a test. Until we get rid
michael@0 35 // of Cleopatra, at least.
michael@0 36 deferred.resolve();
michael@0 37 });
michael@0 38
michael@0 39 record.click();
michael@0 40 });
michael@0 41
michael@0 42 record.click();
michael@0 43 return deferred.promise;
michael@0 44 }
michael@0 45
michael@0 46 function toggleGeckoDataOption() {
michael@0 47 ok(!gPanel.showPlatformData, "showPlatformData is not set");
michael@0 48
michael@0 49 Services.prefs.setBoolPref(SHOW_PLATFORM_DATA, true);
michael@0 50
michael@0 51 ok(gPanel.showPlatformData, "showPlatformData is set");
michael@0 52 }

mercurial