A test-only change, a follow-up to bug 666075, adding some testing of multi-reporters. r=khuey.

This commit is contained in:
Nicholas Nethercote 2011-07-01 09:15:25 +10:00
parent 48268c83db
commit 6886521903

View File

@ -69,7 +69,7 @@
return f2(aProcess, aPath, aKind, BYTES, aAmount);
}
fakeReporters = [
var fakeReporters = [
f("", "heap-used", OTHER, 500 * MB),
f("", "heap-unused", OTHER, 100 * MB),
f("", "explicit/a", HEAP, 222 * MB),
@ -77,20 +77,38 @@
f("", "explicit/b/b", HEAP, 75 * MB),
f("", "explicit/b/c/a", HEAP, 70 * MB),
f("", "explicit/b/c/b", HEAP, 2 * MB), // omitted
f("", "explicit/c", MAPPED, 123 * MB),
f("", "explicit/d", MAPPED, 499 * KB), // omitted
f("", "explicit/e", MAPPED, 100 * KB), // omitted
f("", "explicit/f/g/h/i", HEAP, 20 * MB),
f("", "explicit/g", HEAP, 14 * MB), // internal
f("", "explicit/g", HEAP, 1 * MB), // internal, dup: merge
f("", "explicit/g/a", HEAP, 6 * MB),
f("", "explicit/g/b", HEAP, 5 * MB),
f("", "other1", OTHER, 111 * MB),
f("", "other2", OTHER, 222 * MB),
f2("", "other3", OTHER, COUNT, 777),
f2("", "other4", OTHER, COUNT, 888),
f2("", "unknown-unit", OTHER, /*bogus unit*/999, 999),
f2("", "unknown-unit", OTHER, /*bogus unit*/999, 999)
];
var fakeMultiReporters = [
{ collectReports: function(cbObj, closure) {
function f(p, k, u, a) { cbObj.callback("", p, k, u, a, "(desc)", closure); }
f("explicit/c", MAPPED, BYTES, 123 * MB);
f("explicit/d", MAPPED, BYTES, 499 * KB); // omitted
f("explicit/e", MAPPED, BYTES, 100 * KB); // omitted
f("explicit/f/g/h/i", HEAP, BYTES, 20 * MB);
}
},
{ collectReports: function(cbObj, closure) {
function f(p, k, u, a) { cbObj.callback("", p, k, u, a, "(desc)", closure); }
f("explicit/g", HEAP, BYTES, 14 * MB); // internal
f("other2", OTHER, BYTES, 222 * MB);
f("other3", OTHER, COUNT, 777);
}
}
];
for (var i = 0; i < fakeReporters.length; i++) {
mgr.registerReporter(fakeReporters[i]);
}
for (var i = 0; i < fakeMultiReporters.length; i++) {
mgr.registerMultiReporter(fakeMultiReporters[i]);
}
var fakeReporters2 = [
f("2nd", "heap-used", OTHER, 1000 * MB),
f("2nd", "heap-unused", OTHER, 100 * MB),
f("2nd", "explicit/a/b/c", HEAP, 498 * MB),
@ -114,9 +132,10 @@
f("3rd", "explicit/b", MAPPED,kUnknown),
f("3rd", "other1", OTHER, kUnknown)
];
for (var i = 0; i < fakeReporters.length; i++) {
mgr.registerReporter(fakeReporters[i]);
for (var i = 0; i < fakeReporters2.length; i++) {
mgr.registerReporter(fakeReporters2[i]);
}
fakeReporters = fakeReporters.concat(fakeReporters2);
]]>
</script>
@ -263,11 +282,15 @@ Other Measurements\n\
function finish()
{
// Unregister fake reporters, re-register the real reporters and
// multi-reporters, just in case subsequent tests rely on them.
// Unregister fake reporters and multi-reporters, re-register the real
// reporters and multi-reporters, just in case subsequent tests rely on
// them.
for (var i = 0; i < fakeReporters.length; i++) {
mgr.unregisterReporter(fakeReporters[i]);
}
for (var i = 0; i < fakeMultiReporters.length; i++) {
mgr.unregisterMultiReporter(fakeMultiReporters[i]);
}
for (var i = 0; i < realReporters.length; i++) {
mgr.registerReporter(realReporters[i]);
}