From c4601413b4b1c8f8d8c2f2d295358b7d9105036e Mon Sep 17 00:00:00 2001 From: Alexandre Poirot Date: Fri, 17 Nov 2017 03:27:10 -0800 Subject: [PATCH] Bug 1419328 - Run DAMP test against a document specific to the webconsole. r=nchevobbe MozReview-Commit-ID: Dzyh733rgfG --HG-- extra : rebase_source : 8d082d26d46ca67f03a65d03115eebaa72105f89 --- .../tests/devtools/addon/content/damp.html | 1 + .../tests/devtools/addon/content/damp.js | 45 +++++++++++----- .../addon/content/pages/custom/console.html | 52 +++++++++++++++++++ 3 files changed, 84 insertions(+), 14 deletions(-) create mode 100644 testing/talos/talos/tests/devtools/addon/content/pages/custom/console.html diff --git a/testing/talos/talos/tests/devtools/addon/content/damp.html b/testing/talos/talos/tests/devtools/addon/content/damp.html index bc747092ae18..f4c33e62e7d9 100644 --- a/testing/talos/talos/tests/devtools/addon/content/damp.html +++ b/testing/talos/talos/tests/devtools/addon/content/damp.html @@ -28,6 +28,7 @@ var defaultConfig = { "complicated.netmonitor": true, "complicated.saveAndReadHeapSnapshot": true, + "custom.webconsole": true, "custom.inspector": true, "custom.debugger": true, diff --git a/testing/talos/talos/tests/devtools/addon/content/damp.js b/testing/talos/talos/tests/devtools/addon/content/damp.js index 101182200385..ae16514c5ca7 100644 --- a/testing/talos/talos/tests/devtools/addon/content/damp.js +++ b/testing/talos/talos/tests/devtools/addon/content/damp.js @@ -793,6 +793,35 @@ async _consoleOpenWithCachedMessagesTest() { await this.testTeardown(); }, + async reloadConsoleAndLog(label, toolbox, expectedMessages) { + let onReload = async function() { + let webconsole = toolbox.getPanel("webconsole"); + await new Promise(done => { + let messages = 0; + let receiveMessages = () => { + if (++messages == expectedMessages) { + webconsole.hud.ui.off("new-messages", receiveMessages); + done(); + } + }; + webconsole.hud.ui.on("new-messages", receiveMessages); + }); + }; + await this.reloadPageAndLog(label + ".webconsole", toolbox, onReload); + }, + + async customConsole() { + // These numbers controls the number of console api calls we do in the test + let sync = 250, stream = 250, async = 250; + let page = `console.html?sync=${sync}&stream=${stream}&async=${async}`; + let url = CUSTOM_URL.replace(/\$TOOL\.html/, page); + await this.testSetup(url); + let toolbox = await this.openToolboxAndLog("custom.webconsole", "webconsole"); + await this.reloadConsoleAndLog("custom", toolbox, sync + stream + async); + await this.closeToolboxAndLog("custom.webconsole", toolbox); + await this.testTeardown(); + }, + _getToolLoadingTests(url, label, { expectedMessages, expectedRequests, @@ -812,20 +841,7 @@ async _consoleOpenWithCachedMessagesTest() { async webconsole() { await this.testSetup(url); let toolbox = await this.openToolboxAndLog(label + ".webconsole", "webconsole"); - let onReload = async function() { - let webconsole = toolbox.getPanel("webconsole"); - await new Promise(done => { - let messages = 0; - let receiveMessages = () => { - if (++messages == expectedMessages) { - webconsole.hud.ui.off("new-messages", receiveMessages); - done(); - } - }; - webconsole.hud.ui.on("new-messages", receiveMessages); - }); - }; - await this.reloadPageAndLog(label + ".webconsole", toolbox, onReload); + await this.reloadConsoleAndLog(label, toolbox, expectedMessages); await this.closeToolboxAndLog(label + ".webconsole", toolbox); await this.testTeardown(); }, @@ -1081,6 +1097,7 @@ async _consoleOpenWithCachedMessagesTest() { // Run all tests against a document specific to each tool tests["custom.inspector"] = this.customInspector; tests["custom.debugger"] = this.customDebugger; + tests["custom.webconsole"] = this.customConsole; // Run individual tests covering a very precise tool feature tests["console.bulklog"] = this._consoleBulkLoggingTest; diff --git a/testing/talos/talos/tests/devtools/addon/content/pages/custom/console.html b/testing/talos/talos/tests/devtools/addon/content/pages/custom/console.html new file mode 100644 index 000000000000..9809c04e3085 --- /dev/null +++ b/testing/talos/talos/tests/devtools/addon/content/pages/custom/console.html @@ -0,0 +1,52 @@ + + + + + Custom page for the Console + + + + +