Bug 1055151 - Add tests to cap devtools memory footprint. r=ochameau

This commit is contained in:
Jan Keromnes 2014-08-29 02:33:00 +02:00
parent a09c8d8408
commit e6d3b78d29
2 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,54 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
var gClient;
var gMgr;
var gRefMemory;
function run_test() {
gMgr = Cc["@mozilla.org/memory-reporter-manager;1"].getService(Ci.nsIMemoryReporterManager);
Cu.forceGC();
gRefMemory = gMgr.residentUnique;
add_test(init_server);
add_test(add_browser_actors);
add_test(connect_client);
add_test(list_tabs);
add_test(close_client);
run_next_test();
}
function check_footprint(step, max) {
var footprint = (gMgr.residentUnique - gRefMemory) / 1024;
ok(footprint < max, "Footprint after " + step + " is " + footprint + " kB (should be less than " + max + " kB).");
run_next_test();
}
function init_server() {
DebuggerServer.init(function () { return true; });
check_footprint("DebuggerServer.init()", 500);
}
function add_browser_actors() {
DebuggerServer.addBrowserActors();
check_footprint("DebuggerServer.addBrowserActors()", 10500);
}
function connect_client() {
gClient = new DebuggerClient(DebuggerServer.connectPipe());
gClient.connect(function onConnect() {
check_footprint("DebuggerClient.connect()", 11000);
});
}
function list_tabs() {
gClient.listTabs(function onListTabs(aResponse) {
check_footprint("DebuggerClient.listTabs()", 11500);
});
}
function close_client() {
gClient.close(run_next_test);
}

View File

@ -209,3 +209,7 @@ reason = bug 937197
[test_monitor_actor.js]
[test_symbols-01.js]
[test_symbols-02.js]
[test_memory_footprint.js]
run-sequentially = measure memory, has to be run solo
skip-if = os != 'linux' || debug || asan
reason = bug 1014071