Bug 1415532 - Run DAMP test against a document specific to the debugger. r=yulia draft
authorAlexandre Poirot <poirot.alex@gmail.com>
Fri, 17 Nov 2017 03:28:26 -0800
changeset 700533 c320763f6701a66254d7a1175b3482909c340e7b
parent 700532 4d3d73d9fb46def0281055c8447210b06387cb92
child 700534 9938d26d5406874b8131d18dae23133f00b3fef4
child 701261 5b654ddf26e6c414230bfe21a324037e216ba34c
child 701947 f17372b6a6ace659b732ca7bcad31b481475c9f8
child 701948 6a990fd557090cb28a9be7afd6db7f612784720c
push id89883
push userbmo:poirot.alex@gmail.com
push dateMon, 20 Nov 2017 09:57:47 +0000
reviewersyulia
bugs1415532
milestone59.0a1
Bug 1415532 - Run DAMP test against a document specific to the debugger. r=yulia MozReview-Commit-ID: Di9a6Mlu3N
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
@@ -25,16 +25,17 @@ var defaultConfig = {
     "complicated.debugger": true,
     "complicated.styleeditor": true,
     "complicated.performance": true,
     "complicated.netmonitor": true,
     "complicated.saveAndReadHeapSnapshot": true,
 
     "custom.webconsole": true,
     "custom.inspector": true,
+    "custom.debugger": true,
 
     "console.bulklog": true,
     "console.streamlog": true,
     "console.objectexpand": true,
     "console.openwithcache": true,
     "inspector.mutations": true,
   }
 };
--- a/testing/talos/talos/tests/devtools/addon/content/damp.js
+++ b/testing/talos/talos/tests/devtools/addon/content/damp.js
@@ -497,16 +497,62 @@ async _consoleOpenWithCachedMessagesTest
     let url = CUSTOM_URL.replace(/\$TOOL/, "console");
     await this.testSetup(url);
     let toolbox = await this.openToolboxAndLog("custom.webconsole", "webconsole");
     await this.reloadConsoleAndLog("custom", toolbox, 500);
     await this.closeToolboxAndLog("custom.webconsole");
     await this.testTeardown();
   },
 
+  async openDebuggerAndLog(label, expectedSources) {
+    let onLoad = async function(toolbox, dbg) {
+      await new Promise(done => {
+        let { selectors, store } = dbg.panelWin.getGlobalsForTesting();
+        let unsubscribe;
+        function countSources() {
+          const sources = selectors.getSources(store.getState());
+          if (sources.size >= expectedSources) {
+            unsubscribe();
+            done();
+          }
+        }
+        unsubscribe = store.subscribe(countSources);
+        countSources();
+      });
+    };
+    let toolbox = await this.openToolboxAndLog(label + ".jsdebugger", "jsdebugger", onLoad);
+    return toolbox;
+  },
+
+  async reloadDebuggerAndLog(label, toolbox, expectedSources) {
+    let onReload = async function() {
+      await new Promise(done => {
+        let count = 0;
+        let { client } = toolbox.target;
+        let onSource = async (_, actor) => {
+          if (++count >= expectedSources) {
+            client.removeListener("newSource", onSource);
+            done();
+          }
+        };
+        client.addListener("newSource", onSource);
+      });
+    };
+    await this.reloadPageAndLog(label + ".jsdebugger", onReload);
+  },
+
+  async customDebugger() {
+    let url = CUSTOM_URL.replace(/\$TOOL/, "debugger");
+    await this.testSetup(url);
+    let toolbox = await this.openDebuggerAndLog(label);
+    await this.reloadDebuggerAndLog(label, toolbox);
+    await this.closeToolboxAndLog(label + ".jsdebugger");
+    await this.testTeardown();
+  },
+
   _getToolLoadingTests(url, label, { expectedMessages, expectedSources }) {
     let tests = {
       async inspector() {
         await this.testSetup(url);
         let toolbox = await this.openToolboxAndLog(label + ".inspector", "inspector");
         await this.reloadInspectorAndLog(label, toolbox);
         await this.closeToolboxAndLog(label + ".inspector");
         await this.testTeardown();
@@ -517,46 +563,18 @@ async _consoleOpenWithCachedMessagesTest
         let toolbox = await this.openToolboxAndLog(label + ".webconsole", "webconsole");
         await this.reloadConsoleAndLog(label, "webconsole", expectedMessages);
         await this.closeToolboxAndLog(label + ".webconsole");
         await this.testTeardown();
       },
 
       async debugger() {
         await this.testSetup(url);
-        let onLoad = async function(toolbox, dbg) {
-          await new Promise(done => {
-            let { selectors, store } = dbg.panelWin.getGlobalsForTesting();
-            let unsubscribe;
-            function countSources() {
-              const sources = selectors.getSources(store.getState());
-              if (sources.size >= expectedSources) {
-                unsubscribe();
-                done();
-              }
-            }
-            unsubscribe = store.subscribe(countSources);
-            countSources();
-          });
-        };
-        let toolbox = await this.openToolboxAndLog(label + ".jsdebugger", "jsdebugger", onLoad);
-        let onReload = async function() {
-          await new Promise(done => {
-            let count = 0;
-            let { client } = toolbox.target;
-            let onSource = async (_, actor) => {
-              if (++count >= expectedSources) {
-                client.removeListener("newSource", onSource);
-                done();
-              }
-            };
-            client.addListener("newSource", onSource);
-          });
-        };
-        await this.reloadPageAndLog(label + ".jsdebugger", onReload);
+        let toolbox = await this.openDebuggerAndLog(label, expectedSources);
+        await this.reloadDebuggerAndLog(label, toolbox, expectedSources);
         await this.closeToolboxAndLog(label + ".jsdebugger");
         await this.testTeardown();
       },
 
       async styleeditor() {
         await this.testSetup(url);
         await this.openToolboxAndLog(label + ".styleeditor", "styleeditor");
         await this.reloadPageAndLog(label + ".styleeditor");
@@ -774,16 +792,17 @@ async _consoleOpenWithCachedMessagesTest
     Object.assign(tests, this._getToolLoadingTests(COMPLICATED_URL, "complicated", {
       expectedMessages: 7,
       expectedSources: 14,
     }));
 
     // Run all tests against a document specific to each tool
     tests["custom.inspector"] = this.customInspector;
     tests["custom.webconsole"] = this.customConsole;
+    tests["custom.debugger"] = this.customDebugger;
 
     // Run individual tests covering a very precise tool feature
     tests["console.bulklog"] = this._consoleBulkLoggingTest;
     tests["console.streamlog"] = this._consoleStreamLoggingTest;
     tests["console.objectexpand"] = this._consoleObjectExpansionTest;
     tests["console.openwithcache"] = this._consoleOpenWithCachedMessagesTest;
     tests["inspector.mutations"] = this._inspectorMutationsTest;