Bug 1437854 - Enable browser_console_webconsole_ctrlw_close_tab.js in new frontend r?honza draft
authorMichael Ratcliffe <mratcliffe@mozilla.com>
Wed, 14 Feb 2018 15:45:28 +0000
changeset 754909 5578f2536a37e6e86b60a17297b70f4cf2731435
parent 754870 e293877d13a5236119adb706c97c55ea9e11868b
push id99043
push userbmo:mratcliffe@mozilla.com
push dateWed, 14 Feb 2018 15:45:48 +0000
reviewershonza
bugs1437854
milestone60.0a1
Bug 1437854 - Enable browser_console_webconsole_ctrlw_close_tab.js in new frontend r?honza MozReview-Commit-ID: Ez3Qbs9FSwD
devtools/client/webconsole/new-console-output/test/mochitest/browser.ini
devtools/client/webconsole/new-console-output/test/mochitest/browser_console_webconsole_ctrlw_close_tab.js
--- a/devtools/client/webconsole/new-console-output/test/mochitest/browser.ini
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/browser.ini
@@ -183,17 +183,16 @@ skip-if = true # Bug 1406060
 skip-if = true # Bug 1406060
 [browser_console_nsiconsolemessage.js]
 skip-if = true # Bug 1406060
 [browser_console_open_or_focus.js]
 skip-if = true # Bug 1406060
 [browser_console_restore.js]
 skip-if = true # Bug 1406060
 [browser_console_webconsole_ctrlw_close_tab.js]
-skip-if = true # Bug 1406060
 [browser_console_webconsole_iframe_messages.js]
 skip-if = true # Bug 1406060
 [browser_console_webconsole_private_browsing.js]
 skip-if = true #	Bug 1403188
 # old console skip-if = e10s # Bug 1042253 - webconsole e10s tests
 [browser_jsterm_accessibility.js]
 [browser_jsterm_add_edited_input_to_history.js]
 [browser_jsterm_autocomplete_array_no_index.js]
--- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_webconsole_ctrlw_close_tab.js
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_webconsole_ctrlw_close_tab.js
@@ -1,32 +1,28 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set ft=javascript ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
+/* import-globals-from head.js */
+
 // Check that Ctrl-W closes the Browser Console and that Ctrl-W closes the
 // current tab when using the Web Console - bug 871156.
 
 "use strict";
 
-add_task(function* () {
+add_task(async function () {
   const TEST_URI = "data:text/html;charset=utf8,<title>bug871156</title>\n" +
                    "<p>hello world";
   let firstTab = gBrowser.selectedTab;
 
-  Services.prefs.setBoolPref("toolkit.cosmeticAnimations.enabled", false);
-  registerCleanupFunction(() => {
-    Services.prefs.clearUserPref("toolkit.cosmeticAnimations.enabled");
-  });
+  await pushPref("toolkit.cosmeticAnimations.enabled", false);
 
-  yield loadTab(TEST_URI);
-
-  let hud = yield openConsole();
-  ok(hud, "Web Console opened");
+  let hud = await openNewTabAndConsole(TEST_URI);
 
   let tabClosed = defer();
   let toolboxDestroyed = defer();
   let tabSelected = defer();
 
   let target = TargetFactory.forTab(gBrowser.selectedTab);
   let toolbox = gDevTools.getToolbox(target);
 
@@ -47,30 +43,30 @@ add_task(function* () {
     toolboxDestroyed.resolve(null);
   });
 
   // Get out of the web console initialization.
   executeSoon(() => {
     EventUtils.synthesizeKey("w", { accelKey: true });
   });
 
-  yield promise.all([tabClosed.promise, toolboxDestroyed.promise,
+  await promise.all([tabClosed.promise, toolboxDestroyed.promise,
                      tabSelected.promise]);
   info("promise.all resolved. start testing the Browser Console");
 
-  hud = yield HUDService.toggleBrowserConsole();
+  hud = await HUDService.toggleBrowserConsole();
   ok(hud, "Browser Console opened");
 
   let deferred = defer();
 
   Services.obs.addObserver(function onDestroy() {
     Services.obs.removeObserver(onDestroy, "web-console-destroyed");
     ok(true, "the Browser Console closed");
 
     deferred.resolve(null);
   }, "web-console-destroyed");
 
   waitForFocus(() => {
     EventUtils.synthesizeKey("w", { accelKey: true }, hud.iframeWindow);
   }, hud.iframeWindow);
 
-  yield deferred.promise;
+  await deferred.promise;
 });