gecko-dev/devtools/server/tests/browser/browser_perf-profiler-01.js
yulia 1174ad2f82 Bug 1495389 - adjust test to use new performance front initialization; r=ochameau
Depends on D10564

Differential Revision: https://phabricator.services.mozilla.com/D11293

--HG--
extra : moz-landing-system : lando
2018-12-17 11:54:45 +00:00

40 lines
1.2 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests if the profiler connection front does not activate the built-in
* profiler module if not necessary, and doesn't deactivate it when
* a recording is stopped.
*/
"use strict";
const { pmmIsProfilerActive, pmmLoadFrameScripts } = require("devtools/client/performance/test/helpers/profiler-mm-utils");
add_task(async function() {
const target = await addTabTarget(MAIN_DOMAIN + "doc_perf.html");
const front = await target.getFront("performance");
pmmLoadFrameScripts(gBrowser);
ok(!(await pmmIsProfilerActive()),
"The built-in profiler module should not have been automatically started.");
let rec = await front.startRecording();
await front.stopRecording(rec);
ok((await pmmIsProfilerActive()),
"The built-in profiler module should still be active (1).");
rec = await front.startRecording();
await front.stopRecording(rec);
ok((await pmmIsProfilerActive()),
"The built-in profiler module should still be active (2).");
await target.destroy();
ok(!(await pmmIsProfilerActive()),
"The built-in profiler module should no longer be active.");
gBrowser.removeCurrentTab();
});