зеркало из https://github.com/mozilla/gecko-dev.git
Bug 702300 (part 3) - Tweak the about:memory tests. r=jlebar.
--HG-- extra : rebase_source : f09a6566dcf56a1ac326044b6a8df17dc4cb2502
This commit is contained in:
Родитель
c7668b22ba
Коммит
0c9ace411b
|
@ -93,8 +93,10 @@
|
|||
];
|
||||
let fakeMultiReporters = [
|
||||
{ name: "fake1",
|
||||
collectReports: function(cbObj, closure) {
|
||||
function f(p, k, u, a) { cbObj.callback("", p, k, u, a, "(desc)", closure); }
|
||||
collectReports: function(aCbObj, aClosure) {
|
||||
function f(aP, aK, aU, aA) {
|
||||
aCbObj.callback("", aP, aK, aU, aA, "(desc)", aClosure);
|
||||
}
|
||||
f("explicit/c/d", NONHEAP, BYTES, 13 * MB),
|
||||
f("explicit/c/d", NONHEAP, BYTES, 10 * MB), // dup
|
||||
f("explicit/c/other", NONHEAP, BYTES, 77 * MB),
|
||||
|
@ -107,8 +109,10 @@
|
|||
explicitNonHeap: (100 + 13 + 10)*MB + (499 + 100)*KB
|
||||
},
|
||||
{ name: "fake2",
|
||||
collectReports: function(cbObj, closure) {
|
||||
function f(p, k, u, a) { cbObj.callback("", p, k, u, a, "(desc)", closure); }
|
||||
collectReports: function(aCbObj, aClosure) {
|
||||
function f(aP, aK, aU, aA) {
|
||||
aCbObj.callback("", aP, aK, aU, aA, "(desc)", aClosure);
|
||||
}
|
||||
f("other3", OTHER, COUNT, 777);
|
||||
f("other2", OTHER, BYTES, 222 * MB);
|
||||
f("perc2", OTHER, PERCENTAGE, 10000);
|
||||
|
@ -117,9 +121,11 @@
|
|||
explicitNonHeap: 0
|
||||
},
|
||||
{ name: "smaps",
|
||||
collectReports: function(cbObj, closure) {
|
||||
collectReports: function(aCbObj, aClosure) {
|
||||
// The amounts are given in pages, so multiply here by 4kb.
|
||||
function f(p, a) { cbObj.callback("", p, NONHEAP, BYTES, a * 4 * KB, "(desc)", closure); }
|
||||
function f(aP, aA) {
|
||||
aCbObj.callback("", aP, NONHEAP, BYTES, aA * 4 * KB, "(desc)", aClosure);
|
||||
}
|
||||
f("smaps/vsize/a", 24);
|
||||
f("smaps/swap/a", 1);
|
||||
f("smaps/swap/a", 2);
|
||||
|
@ -210,11 +216,13 @@
|
|||
// skip the "smaps" multi-reporter in the parent process won't cause
|
||||
// these to be skipped; the fall-back skipping will be hit instead.
|
||||
{ name: "smaps",
|
||||
collectReports: function(cbObj, closure) {
|
||||
collectReports: function(aCbObj, aClosure) {
|
||||
// The amounts are given in pages, so multiply here by 4kb.
|
||||
function f(p, a) { cbObj.callback("2nd", p, NONHEAP, BYTES, a * 4 * KB, "(desc)", closure); }
|
||||
f("smaps/vsize/a", 24);
|
||||
f("smaps/vsize/b", 24);
|
||||
function f(aP, aA) {
|
||||
aCbObj.callback("2nd", aP, NONHEAP, BYTES, aA * 4 * KB, "(desc)", aClosure);
|
||||
}
|
||||
f("smaps/vsize/a", 24);
|
||||
f("smaps/vsize/b", 24);
|
||||
},
|
||||
explicitNonHeap: 0
|
||||
}
|
||||
|
@ -554,31 +562,18 @@ Other Measurements\n\
|
|||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
let gHaveDumped = false;
|
||||
|
||||
function checkClipboard(actual, expected) {
|
||||
if (actual != expected) {
|
||||
if (!gHaveDumped) {
|
||||
dump("******EXPECTED******\n");
|
||||
dump(expected);
|
||||
dump("*******ACTUAL*******\n");
|
||||
dump(actual);
|
||||
dump("********************\n");
|
||||
gHaveDumped = true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Cut+paste the entire page and check that the cut text matches what we
|
||||
// expect. This tests the output in general and also that the cutting and
|
||||
// pasting works as expected.
|
||||
function test(aFrame, aExpectedText, aNext) {
|
||||
function test(aFrame, aExpected, aNext) {
|
||||
SimpleTest.executeSoon(function() {
|
||||
let mostRecentActual;
|
||||
document.getElementById(aFrame).focus();
|
||||
SimpleTest.waitForClipboard(
|
||||
function(actual) { return checkClipboard(actual, aExpectedText) },
|
||||
function(aActual) {
|
||||
mostRecentActual = aActual;
|
||||
return aActual === aExpected;
|
||||
},
|
||||
function() {
|
||||
synthesizeKey("A", {accelKey: true});
|
||||
synthesizeKey("C", {accelKey: true});
|
||||
|
@ -586,13 +581,18 @@ Other Measurements\n\
|
|||
aNext,
|
||||
function() {
|
||||
ok(false, "pasted text doesn't match for " + aFrame);
|
||||
dump("******EXPECTED******\n");
|
||||
dump(aExpected);
|
||||
dump("*******ACTUAL*******\n");
|
||||
dump(mostRecentActual);
|
||||
dump("********************\n");
|
||||
finish();
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
addLoadEvent(function() {
|
||||
SimpleTest.waitForFocus(function() {
|
||||
test(
|
||||
"amFrame",
|
||||
amExpectedText,
|
||||
|
|
|
@ -92,26 +92,9 @@
|
|||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
let gHaveDumped = false;
|
||||
|
||||
function checkClipboard(actual, expected) {
|
||||
if (actual != expected) {
|
||||
if (!gHaveDumped) {
|
||||
dump("******EXPECTED******\n");
|
||||
dump(expected);
|
||||
dump("*******ACTUAL*******\n");
|
||||
dump(actual);
|
||||
dump("********************\n");
|
||||
gHaveDumped = true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Click on the identified element, then cut+paste the entire page and
|
||||
// check that the cut text matches what we expect.
|
||||
function test(aId, aExpectedText, aNext) {
|
||||
function test(aId, aExpected, aNext) {
|
||||
let win = document.getElementById("amFrame").contentWindow;
|
||||
let node = win.document.getElementById(aId);
|
||||
|
||||
|
@ -124,9 +107,13 @@
|
|||
}
|
||||
|
||||
SimpleTest.executeSoon(function() {
|
||||
let mostRecentActual;
|
||||
document.getElementById("amFrame").focus();
|
||||
SimpleTest.waitForClipboard(
|
||||
function(actual) { return checkClipboard(actual, aExpectedText) },
|
||||
function(aActual) {
|
||||
mostRecentActual = aActual;
|
||||
return aActual === aExpected;
|
||||
},
|
||||
function() {
|
||||
synthesizeKey("A", {accelKey: true});
|
||||
synthesizeKey("C", {accelKey: true});
|
||||
|
@ -134,6 +121,11 @@
|
|||
aNext,
|
||||
function() {
|
||||
ok(false, "pasted text doesn't match");
|
||||
dump("******EXPECTED******\n");
|
||||
dump(aExpected);
|
||||
dump("*******ACTUAL*******\n");
|
||||
dump(mostRecentActual);
|
||||
dump("********************\n");
|
||||
finish();
|
||||
}
|
||||
);
|
||||
|
@ -141,10 +133,10 @@
|
|||
}
|
||||
|
||||
// Returns a function that chains together one test() call per id.
|
||||
function chain(ids) {
|
||||
let x = ids.shift();
|
||||
function chain(aIds) {
|
||||
let x = aIds.shift();
|
||||
if (x) {
|
||||
return function() { test(x.id, x.expected, chain(ids)); }
|
||||
return function() { test(x.id, x.expected, chain(aIds)); }
|
||||
} else {
|
||||
return function() { finish(); };
|
||||
}
|
||||
|
@ -213,7 +205,7 @@ Other Measurements\n\
|
|||
{ id: "Main:explicit/a/c", expected: openExpected }
|
||||
];
|
||||
|
||||
addLoadEvent(chain(idsToClick));
|
||||
SimpleTest.waitForFocus(chain(idsToClick));
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
]]>
|
||||
|
|
Загрузка…
Ссылка в новой задаче