diff options
Diffstat (limited to 'devtools/server/tests/browser/browser_perf-profiler-02.js')
-rw-r--r-- | devtools/server/tests/browser/browser_perf-profiler-02.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/devtools/server/tests/browser/browser_perf-profiler-02.js b/devtools/server/tests/browser/browser_perf-profiler-02.js new file mode 100644 index 0000000000..a4ab81c199 --- /dev/null +++ b/devtools/server/tests/browser/browser_perf-profiler-02.js @@ -0,0 +1,42 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +/** + * Tests if the built-in profiler module doesn't deactivate when the toolbox + * is destroyed if there are other consumers using it. + */ + +"use strict"; + +const { + pmmIsProfilerActive, +} = require("devtools/client/performance/test/helpers/profiler-mm-utils"); + +add_task(async function() { + const target1 = await addTabTarget(MAIN_DOMAIN + "doc_perf.html"); + const firstFront = await target1.getFront("performance"); + + await firstFront.startRecording(); + + const target2 = await addTabTarget(MAIN_DOMAIN + "doc_perf.html"); + const secondFront = await target2.getFront("performance"); + await secondFront.connect(); + + await secondFront.startRecording(); + + // Manually teardown the tabs so we can check profiler status + await target2.destroy(); + ok( + await pmmIsProfilerActive(), + "The built-in profiler module should still be active." + ); + + await target1.destroy(); + ok( + !(await pmmIsProfilerActive()), + "The built-in profiler module should no longer be active." + ); + + gBrowser.removeCurrentTab(); + gBrowser.removeCurrentTab(); +}); |