From 39866a29b94d7ceccea7bf75f7fa58bc82d6bac8 Mon Sep 17 00:00:00 2001 From: Michael Ratcliffe Date: Wed, 14 Feb 2018 15:59:35 +0000 Subject: [PATCH] Bug 1437852 - Enable browser_console_restore.js in new frontend r=bgrins MozReview-Commit-ID: Fk7yT1gXKI9 --HG-- extra : rebase_source : ea793d4085e67b969d8b6ec132332bd86091b30b --- .../new-console-output/test/mochitest/browser.ini | 1 - .../test/mochitest/browser_console_restore.js | 8 +++++--- .../new-console-output/test/mochitest/head.js | 15 +++++++++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser.ini b/devtools/client/webconsole/new-console-output/test/mochitest/browser.ini index aa0e090c1dd8..51cdd556c9ca 100644 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser.ini +++ b/devtools/client/webconsole/new-console-output/test/mochitest/browser.ini @@ -185,7 +185,6 @@ skip-if = true # Bug 1437850 [browser_console_open_or_focus.js] skip-if = true # Bug 1437851 [browser_console_restore.js] -skip-if = true # Bug 1437852 [browser_console_webconsole_ctrlw_close_tab.js] skip-if = true # Bug 1437854 [browser_console_webconsole_iframe_messages.js] diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_restore.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_restore.js index 161fb786a476..bf288e7c2890 100644 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_restore.js +++ b/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_restore.js @@ -3,12 +3,14 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ +/* import-globals-from head.js */ + // Check that the browser console gets session state is set correctly, and that // it re-opens when restore is requested. "use strict"; -add_task(async function() { +add_task(async function () { is(HUDService.getBrowserConsoleSessionState(), false, "Session state false by default"); HUDService.storeBrowserConsoleSessionState(); is(HUDService.getBrowserConsoleSessionState(), false, @@ -19,7 +21,7 @@ add_task(async function() { is(HUDService.getBrowserConsoleSessionState(), true, "Session state true (since Browser Console is opened)"); - info("Closing the browser console and waiting for the session restore to reopen it") + info("Closing the browser console and waiting for the session restore to reopen it"); await HUDService.toggleBrowserConsole(); let opened = waitForBrowserConsole(); @@ -27,6 +29,6 @@ add_task(async function() { browserConsole: true }); - info("Waiting for the console to open after session restore") + info("Waiting for the console to open after session restore"); await opened; }); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/head.js b/devtools/client/webconsole/new-console-output/test/mochitest/head.js index fd8fcd50bed9..7642b78205dc 100644 --- a/devtools/client/webconsole/new-console-output/test/mochitest/head.js +++ b/devtools/client/webconsole/new-console-output/test/mochitest/head.js @@ -591,3 +591,18 @@ function selectNode(hud, node) { return selection; } + +async function waitForBrowserConsole() { + return new Promise(resolve => { + Services.obs.addObserver(function observer(subject) { + Services.obs.removeObserver(observer, "web-console-created"); + subject.QueryInterface(Ci.nsISupportsString); + + let hud = HUDService.getBrowserConsole(); + ok(hud, "browser console is open"); + is(subject.data, hud.hudId, "notification hudId is correct"); + + executeSoon(() => resolve(hud)); + }, "web-console-created"); + }); +}