Bug 1171482 - add DAMP test for inspector mutations;r=ochameau

MozReview-Commit-ID: 7ItEe4O4jyB

--HG--
extra : rebase_source : c81257a23c3bdbfcbcc80738eab1653d9f08c90b
This commit is contained in:
Julian Descottes 2017-10-18 16:32:12 +02:00
Родитель effcd0b567
Коммит 31218f9d9a
2 изменённых файлов: 60 добавлений и 0 удалений

Просмотреть файл

@ -31,6 +31,7 @@ var defaultConfig = {
"console.bulklog": true,
"console.streamlog": true,
"console.objectexpand": true,
"inspector.mutations": true,
}
};
@ -56,6 +57,7 @@ var testsInfo = {
"console.bulklog": "Measure time for a bunch of sync console.log statements to appear",
"console.streamlog": "Measure rAF on page during a stream of console.log statements",
"console.objectexpand": "Measure time to expand a large object and close the console",
"inspector.mutations": "Measure the time to perform childList mutations when inspector is enabled",
};
function updateConfig() {

Просмотреть файл

@ -317,6 +317,63 @@ Damp.prototype = {
yield this.testTeardown();
}),
/**
* Measure the time necesssary to perform successive childList mutations in the content
* page and update the markup-view accordingly.
*/
_inspectorMutationsTest: Task.async(function* () {
let tab = yield this.testSetup(SIMPLE_URL);
let messageManager = tab.linkedBrowser.messageManager;
let {toolbox} = yield this.openToolbox("inspector");
let inspector = toolbox.getPanel("inspector");
// Test with n=LIMIT mutations, with t=DELAY ms between each one.
const LIMIT = 100;
const DELAY = 5;
messageManager.loadFrameScript("data:,(" + encodeURIComponent(
`function () {
const LIMIT = ${LIMIT};
addMessageListener("start-mutations-test", function () {
let addElement = function(index) {
if (index == LIMIT) {
// LIMIT was reached, stop adding elements.
return;
}
let div = content.document.createElement("div");
content.document.body.appendChild(div);
content.setTimeout(() => addElement(index + 1), ${DELAY});
};
addElement(0);
});
}`
) + ")()", false);
let start = performance.now();
yield new Promise(resolve => {
let childListMutationsCounter = 0;
inspector.on("markupmutation", (evt, mutations) => {
let childListMutations = mutations.filter(m => m.type === "childList");
childListMutationsCounter += childListMutations.length;
if (childListMutationsCounter === LIMIT) {
// Wait until we received exactly n=LIMIT mutations in the markup view.
resolve();
}
});
messageManager.sendAsyncMessage("start-mutations-test");
});
this._results.push({
name: "inspector.mutations",
value: performance.now() - start
});
yield this.closeToolbox(null);
yield this.testTeardown();
}),
takeCensus(label) {
let start = performance.now();
@ -674,6 +731,7 @@ Damp.prototype = {
tests["console.bulklog"] = this._consoleBulkLoggingTest;
tests["console.streamlog"] = this._consoleStreamLoggingTest;
tests["console.objectexpand"] = this._consoleObjectExpansionTest;
tests["inspector.mutations"] = this._inspectorMutationsTest;
// Filter tests via `./mach --subtests filter` command line argument
let filter = Services.prefs.getCharPref("talos.subtests", "");