Bug 1235695, bug 1277270 - fix e10s test issues, r=jaws, a=test-only
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Mon, 20 Jun 2016 17:04:08 +0100
changeset 391544 20dfc217dbbca8148b7403b35459aa6be5dfc264
parent 391543 9f311d92805addcd093ba46dabfcf385a0f7fed3
child 391545 1c0fa79f1afdbba4a6488d887aa3a34a25af52a1
push id23905
push usermozilla@buttercookie.de
push dateFri, 22 Jul 2016 19:26:20 +0000
reviewersjaws, test-only
bugs1235695, 1277270
milestone49.0a2
Bug 1235695, bug 1277270 - fix e10s test issues, r=jaws, a=test-only MozReview-Commit-ID: ELDPpGub0TP
browser/components/customizableui/test/browser_940307_panel_click_closure_handling.js
browser/components/customizableui/test/browser_947914_button_print.js
--- a/browser/components/customizableui/test/browser_940307_panel_click_closure_handling.js
+++ b/browser/components/customizableui/test/browser_940307_panel_click_closure_handling.js
@@ -65,19 +65,17 @@ add_task(function*() {
   let placement = CustomizableUI.getPlacementOfWidget("search-container");
   is(placement.area, CustomizableUI.AREA_PANEL, "Should be in panel");
   yield PanelUI.show();
   yield waitForCondition(() => "value" in searchbar && searchbar.value === "");
 
   // Focusing a non-empty searchbox will cause us to open the
   // autocomplete panel and search for suggestions, which would
   // trigger network requests. Temporarily disable suggestions.
-  let suggestEnabled =
-    Services.prefs.getBoolPref("browser.search.suggest.enabled");
-  Services.prefs.setBoolPref("browser.search.suggest.enabled", false);
+  yield SpecialPowers.pushPrefEnv({set: [["browser.search.suggest.enabled", false]]});
 
   searchbar.value = "foo";
   searchbar.focus();
   // Reaching into this context menu is pretty evil, but hey... it's a test.
   let textbox = document.getAnonymousElementByAttribute(searchbar.textbox, "anonid", "textbox-input-box");
   let contextmenu = document.getAnonymousElementByAttribute(textbox, "anonid", "input-box-contextmenu");
   let contextMenuShown = promisePanelElementShown(window, contextmenu);
   EventUtils.synthesizeMouseAtCenter(searchbar, {type: "contextmenu", button: 2});
@@ -95,17 +93,19 @@ add_task(function*() {
 
   ok(isPanelUIOpen(), "Panel should still be open");
 
   let hiddenPanelPromise = promisePanelHidden(window);
   EventUtils.synthesizeKey("VK_ESCAPE", {});
   yield hiddenPanelPromise;
   ok(!isPanelUIOpen(), "Panel should no longer be open");
 
-  Services.prefs.setBoolPref("browser.search.suggest.enabled", suggestEnabled);
+  // We focused the search bar earlier - ensure we don't keep doing that.
+  gURLBar.select();
+
   CustomizableUI.reset();
 });
 
 add_task(function*() {
   button = document.createElement("toolbarbutton");
   button.id = "browser_946166_button_disabled";
   button.setAttribute("disabled", "true");
   button.setAttribute("label", "Button");
--- a/browser/components/customizableui/test/browser_947914_button_print.js
+++ b/browser/components/customizableui/test/browser_947914_button_print.js
@@ -2,40 +2,44 @@
   * License, v. 2.0. If a copy of the MPL was not distributed with this
   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const isOSX = (Services.appinfo.OS === "Darwin");
 
 add_task(function*() {
-  info("Check print button existence and functionality");
-
-  yield PanelUI.show();
-  info("Menu panel was opened");
+  yield BrowserTestUtils.withNewTab({
+    gBrowser,
+    url: "http://example.com/",
+  }, function* () {
+    info("Check print button existence and functionality");
 
-  yield waitForCondition(() => document.getElementById("print-button") != null);
+    yield PanelUI.show();
+    info("Menu panel was opened");
 
-  let printButton = document.getElementById("print-button");
-  ok(printButton, "Print button exists in Panel Menu");
+    yield waitForCondition(() => document.getElementById("print-button") != null);
+
+    let printButton = document.getElementById("print-button");
+    ok(printButton, "Print button exists in Panel Menu");
 
-  if (isOSX) {
-    let panelHiddenPromise = promisePanelHidden(window);
-    PanelUI.hide();
-    yield panelHiddenPromise;
-    info("Menu panel was closed");
-  }
-  else {
-    printButton.click();
-    yield waitForCondition(() => gInPrintPreviewMode);
+    if (isOSX) {
+      let panelHiddenPromise = promisePanelHidden(window);
+      PanelUI.hide();
+      yield panelHiddenPromise;
+      info("Menu panel was closed");
+    }
+    else {
+      printButton.click();
+      yield waitForCondition(() => gInPrintPreviewMode);
 
-    ok(gInPrintPreviewMode, "Entered print preview mode");
-  }
+      ok(gInPrintPreviewMode, "Entered print preview mode");
+
+      // close print preview
+      if (gInPrintPreviewMode) {
+        PrintUtils.exitPrintPreview();
+        yield waitForCondition(() => !window.gInPrintPreviewMode);
+        info("Exited print preview")
+      }
+    }
+  });
 });
 
-add_task(function* asyncCleanup() {
-    // close print preview
-    if (gInPrintPreviewMode) {
-      PrintUtils.exitPrintPreview();
-      yield waitForCondition(() => !window.gInPrintPreviewMode);
-      info("Exited print preview")
-    }
-});