Bug 1101973 - fix browser_printpreview.js to work in e10s mode, r?mconley draft
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Fri, 26 Feb 2016 16:34:40 +0000
changeset 334981 f65ba741948a32dc9b43f613a9d8be2ae2313248
parent 334930 daf17f7cf7f61da7e44ebd2814b01fb5eb4cf036
child 515042 3746a20462af82b05d94e909135edaa621952646
push id11687
push usergijskruitbosch@gmail.com
push dateFri, 26 Feb 2016 16:35:38 +0000
reviewersmconley
bugs1101973
milestone47.0a1
Bug 1101973 - fix browser_printpreview.js to work in e10s mode, r?mconley MozReview-Commit-ID: HG5yGatBdj2
browser/base/content/test/general/browser.ini
browser/base/content/test/general/browser_printpreview.js
--- a/browser/base/content/test/general/browser.ini
+++ b/browser/base/content/test/general/browser.ini
@@ -362,17 +362,17 @@ support-files =
   permissions.html
 [browser_pinnedTabs.js]
 [browser_plainTextLinks.js]
 [browser_popupUI.js]
 skip-if = buildapp == 'mulet'
 [browser_popup_blocker.js]
 skip-if = (os == 'linux') || (e10s && debug) # Frequent bug 1081925 and bug 1125520 failures
 [browser_printpreview.js]
-skip-if = buildapp == 'mulet' || e10s # Bug 1101973 - breaks the next test in e10s, and may be responsible for later timeout after logging "Error: Channel closing: too late to send/recv, messages will be lost"
+skip-if = buildapp == 'mulet'
 [browser_private_browsing_window.js]
 skip-if = buildapp == 'mulet'
 [browser_private_no_prompt.js]
 skip-if = buildapp == 'mulet'
 [browser_purgehistory_clears_sh.js]
 [browser_PageMetaData_pushstate.js]
 [browser_refreshBlocker.js]
 support-files =
--- a/browser/base/content/test/general/browser_printpreview.js
+++ b/browser/base/content/test/general/browser_printpreview.js
@@ -1,19 +1,28 @@
+let ourTab;
+
 function test() {
   waitForExplicitFinish();
 
-  ok(!gInPrintPreviewMode,
-     "Should NOT be in print preview mode at starting this tests");
-  // Skip access key test on platforms which don't support access key.
-  if (!/Win|Linux/.test(navigator.platform)) {
-    openPrintPreview(testClosePrintPreviewWithEscKey);
-  } else {
-    openPrintPreview(testClosePrintPreviewWithAccessKey);
-  }
+  BrowserTestUtils.openNewForegroundTab(gBrowser, "about:home", true).then(function(tab) {
+    ourTab = tab;
+    ok(!gInPrintPreviewMode,
+       "Should NOT be in print preview mode at starting this tests");
+    // Skip access key test on platforms which don't support access key.
+    if (!/Win|Linux/.test(navigator.platform)) {
+      openPrintPreview(testClosePrintPreviewWithEscKey);
+    } else {
+      openPrintPreview(testClosePrintPreviewWithAccessKey);
+    }
+  });
+}
+
+function tidyUp() {
+  BrowserTestUtils.removeTab(ourTab).then(finish);
 }
 
 function testClosePrintPreviewWithAccessKey() {
   EventUtils.synthesizeKey("c", { altKey: true });
   checkPrintPreviewClosed(function (aSucceeded) {
     ok(aSucceeded,
        "print preview mode should be finished by access key");
     openPrintPreview(testClosePrintPreviewWithEscKey);
@@ -29,17 +38,17 @@ function testClosePrintPreviewWithEscKey
   });
 }
 
 function testClosePrintPreviewWithClosingWindowShortcutKey() {
   EventUtils.synthesizeKey("w", { accelKey: true });
   checkPrintPreviewClosed(function (aSucceeded) {
     ok(aSucceeded,
        "print preview mode should be finished by closing window shortcut key");
-    finish();
+    tidyUp();
   });
 }
 
 function openPrintPreview(aCallback) {
   document.getElementById("cmd_printPreview").doCommand();
   executeSoon(function () {
     if (gInPrintPreviewMode) {
       executeSoon(aCallback);