Bug 1399242 - Add DAMP test to track performance of background panels. r=nchevobbe draft
authorAlexandre Poirot <poirot.alex@gmail.com>
Tue, 24 Oct 2017 02:38:21 -0700
changeset 700620 a77b600a6f1a2b8dc3475db0b8a3833e315dc2fb
parent 700338 dd08f8b19cc32da161811abb2f7093e0f5392e69
child 700621 d4cf1e8376870d90d9b0ed0fc02038bd2e796a03
push id89914
push userbmo:poirot.alex@gmail.com
push dateMon, 20 Nov 2017 16:31:08 +0000
reviewersnchevobbe
bugs1399242
milestone59.0a1
Bug 1399242 - Add DAMP test to track performance of background panels. r=nchevobbe MozReview-Commit-ID: JwZaa3AA0iN
testing/talos/talos/tests/devtools/addon/content/damp.html
testing/talos/talos/tests/devtools/addon/content/damp.js
--- a/testing/talos/talos/tests/devtools/addon/content/damp.html
+++ b/testing/talos/talos/tests/devtools/addon/content/damp.html
@@ -28,16 +28,18 @@ var defaultConfig = {
     "complicated.netmonitor": true,
     "complicated.saveAndReadHeapSnapshot": true,
 
     "console.bulklog": true,
     "console.streamlog": true,
     "console.objectexpand": true,
     "console.openwithcache": true,
     "inspector.mutations": true,
+
+    "panelsInBackground.reload": true,
   }
 };
 
 var testsInfo = {
   "cold.inspector": "Measure first open toolbox on inspector panel",
 
   "simple.webconsole": "Measure open/close toolbox on webconsole panel against simple document",
   "simple.inspector": "Measure open/close toolbox on inspector panel against simple document",
@@ -55,16 +57,18 @@ var testsInfo = {
   "complicated.netmonitor": "Measure open/close toolbox on network monitor panel against complicated document",
   "complicated.saveAndReadHeapSnapshot": "Measure open/close toolbox on memory panel and save/read heap snapshot against complicated document",
 
   "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",
   "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",
+
+  "panelsInBackground.reload": "Measure page reload time when all panels are in background",
 };
 
 function updateConfig() {
   config = {subtests: []};
   for (var test in defaultConfig.subtests) {
     if ($("subtest-" + test).checked) { // eslint-disable-line no-undef
       config.subtests.push(test);
     }
--- a/testing/talos/talos/tests/devtools/addon/content/damp.js
+++ b/testing/talos/talos/tests/devtools/addon/content/damp.js
@@ -451,16 +451,38 @@ async _consoleOpenWithCachedMessagesTest
 
   async _coldInspectorOpen() {
     await this.testSetup(SIMPLE_URL);
     await this.openToolboxAndLog("cold.inspector", "inspector");
     await this.closeToolbox();
     await this.testTeardown();
   },
 
+  async _panelsInBackgroundReload() {
+    let url = "data:text/html;charset=UTF-8," + encodeURIComponent(`
+      <script>
+      // Log a significant amount of messages
+      for(let i = 0; i < 2000; i++) {
+        console.log("log in background", i);
+      }
+      </script>
+    `);
+    await this.testSetup(url);
+    let {toolbox} = await this.openToolbox("webconsole");
+
+    // Select the options panel to make the console be in background.
+    // Options panel should not do anything on page reload.
+    await toolbox.selectTool("options");
+
+    await this.reloadPageAndLog("panelsInBackground");
+
+    await this.closeToolbox();
+    await this.testTeardown();
+  },
+
   _getToolLoadingTests(url, label, { expectedMessages, expectedSources }) {
     let tests = {
       inspector: Task.async(function* () {
         yield this.testSetup(url);
         let toolbox = yield this.openToolboxAndLog(label + ".inspector", "inspector");
         let onReload = async function() {
           let inspector = toolbox.getPanel("inspector");
           // First wait for markup view to be loaded against the new root node
@@ -733,16 +755,18 @@ async _consoleOpenWithCachedMessagesTest
 
     // Run cold test only once
     let topWindow = getMostRecentBrowserWindow();
     if (!topWindow.coldRunDAMP) {
       topWindow.coldRunDAMP = true;
       tests["cold.inspector"] = this._coldInspectorOpen;
     }
 
+    tests["panelsInBackground.reload"] = this._panelsInBackgroundReload;
+
     Object.assign(tests, this._getToolLoadingTests(SIMPLE_URL, "simple", {
       expectedMessages: 1,
       expectedSources: 1,
     }));
 
     Object.assign(tests, this._getToolLoadingTests(COMPLICATED_URL, "complicated", {
       expectedMessages: 7,
       expectedSources: 14,