mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-06 15:58:39 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
69
devtools/server/tests/unit/test_profiler_close.js
Normal file
69
devtools/server/tests/unit/test_profiler_close.js
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Tests whether the profiler module is kept active when there are multiple
|
||||
* client consumers and one requests deactivation.
|
||||
*/
|
||||
|
||||
const Profiler = Cc["@mozilla.org/tools/profiler;1"].getService(Ci.nsIProfiler);
|
||||
|
||||
function run_test()
|
||||
{
|
||||
get_chrome_actors((client1, form1) => {
|
||||
let actor1 = form1.profilerActor;
|
||||
get_chrome_actors((client2, form2) => {
|
||||
let actor2 = form2.profilerActor;
|
||||
test_close(client1, actor1, client2, actor2, () => {
|
||||
client1.close(() => {
|
||||
client2.close(() => {
|
||||
do_test_finished();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
do_test_pending();
|
||||
}
|
||||
|
||||
function activate_profiler(client, actor, callback)
|
||||
{
|
||||
client.request({ to: actor, type: "startProfiler" }, response => {
|
||||
do_check_true(response.started);
|
||||
do_check_true(Profiler.IsActive());
|
||||
|
||||
client.request({ to: actor, type: "isActive" }, response => {
|
||||
do_check_true(response.isActive);
|
||||
callback();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function deactivate_profiler(client, actor, callback)
|
||||
{
|
||||
client.request({ to: actor, type: "stopProfiler" }, response => {
|
||||
do_check_false(response.started);
|
||||
do_check_true(Profiler.IsActive());
|
||||
|
||||
client.request({ to: actor, type: "isActive" }, response => {
|
||||
do_check_true(response.isActive);
|
||||
callback();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function test_close(client1, actor1, client2, actor2, callback)
|
||||
{
|
||||
activate_profiler(client1, actor1, () => {
|
||||
activate_profiler(client2, actor2, () => {
|
||||
deactivate_profiler(client1, actor1, () => {
|
||||
deactivate_profiler(client2, actor2, () => {
|
||||
callback();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue