Bug 1101973 - fix browser_printpreview.js to work in e10s mode, r?mconley
MozReview-Commit-ID: HG5yGatBdj2
--- 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);