diff --git a/testing/talos/talos/tests/devtools/addon/content/damp.html b/testing/talos/talos/tests/devtools/addon/content/damp.html index 348c4b20cf8c..5157dcbbb302 100644 --- a/testing/talos/talos/tests/devtools/addon/content/damp.html +++ b/testing/talos/talos/tests/devtools/addon/content/damp.html @@ -35,6 +35,7 @@ var defaultConfig = { "console.objectexpand": true, "console.openwithcache": true, "inspector.mutations": true, + "inspector.layout": true, "panelsInBackground.reload": true, } @@ -64,6 +65,7 @@ var testsInfo = { "console.objectexpand": "Measure time to expand a large object and close the console", "console.openwithcache": "Measure time to render last logged messages in console for a page with 100 logged messages", "inspector.mutations": "Measure the time to perform childList mutations when inspector is enabled", + "inspector.layout": "Measure the time to open/close toolbox on inspector with layout tab against big document with grid containers", "panelsInBackground.reload": "Measure page reload time when all panels are in background", }; diff --git a/testing/talos/talos/tests/devtools/addon/content/damp.js b/testing/talos/talos/tests/devtools/addon/content/damp.js index 7d8c90d11af1..42d407d15fe4 100644 --- a/testing/talos/talos/tests/devtools/addon/content/damp.js +++ b/testing/talos/talos/tests/devtools/addon/content/damp.js @@ -338,7 +338,7 @@ async _consoleOpenWithCachedMessagesTest() { }, /** - * Measure the time necesssary to perform successive childList mutations in the content + * Measure the time necessary to perform successive childList mutations in the content * page and update the markup-view accordingly. */ async _inspectorMutationsTest() { @@ -394,6 +394,54 @@ async _consoleOpenWithCachedMessagesTest() { await this.testTeardown(); }, + /** + * Measure the time to open toolbox on the inspector with the layout tab selected. + */ + async _inspectorLayoutTest() { + let tab = await this.testSetup(SIMPLE_URL); + let messageManager = tab.linkedBrowser.messageManager; + + // Backup current sidebar tab preference + let sidebarTab = Services.prefs.getCharPref("devtools.inspector.activeSidebar"); + + // Set layoutview as the current inspector sidebar tab. + Services.prefs.setCharPref("devtools.inspector.activeSidebar", "layoutview"); + + // Setup test page. It is a simple page containing 5000 regular nodes and 10 grid + // containers. + await new Promise(resolve => { + messageManager.addMessageListener("setup-test-done", resolve); + + const NODES = 5000; + const GRID_NODES = 10; + messageManager.loadFrameScript("data:,(" + encodeURIComponent( + `function () { + let div = content.document.createElement("div"); + div.innerHTML = + new Array(${NODES}).join("
") + + new Array(${GRID_NODES}).join("
"); + content.document.body.appendChild(div); + sendSyncMessage("setup-test-done"); + }` + ) + ")()", false); + }); + + // Open the toolbox and record the time. + let start = performance.now(); + await this.openToolbox("inspector"); + this._results.push({ + name: "inspector.layout.open", + value: performance.now() - start + }); + + await this.closeToolbox(null); + + // Restore sidebar tab preference. + Services.prefs.setCharPref("devtools.inspector.activeSidebar", sidebarTab); + + await this.testTeardown(); + }, + takeCensus(label) { let start = performance.now(); @@ -796,6 +844,7 @@ async _consoleOpenWithCachedMessagesTest() { tests["console.objectexpand"] = this._consoleObjectExpansionTest; tests["console.openwithcache"] = this._consoleOpenWithCachedMessagesTest; tests["inspector.mutations"] = this._inspectorMutationsTest; + tests["inspector.layout"] = this._inspectorLayoutTest; // Filter tests via `./mach --subtests filter` command line argument let filter = Services.prefs.getCharPref("talos.subtests", "");