Bug 668267 - Make sure that the print preview tests close the window they open on Mac; r=roc

--HG--
extra : rebase_source : fc54922908a848265d7fae6597c4fb2b0014daf0
This commit is contained in:
Ehsan Akhgari 2011-06-29 21:02:09 -04:00
parent beba2dbb1d
commit 8eb45f129e
3 changed files with 23 additions and 12 deletions

View File

@ -48,6 +48,11 @@ function exitprintpreview() {
.getInterface(Components.interfaces.nsIWebBrowserPrint).exitPrintPreview();
}
function finish() {
SimpleTest.finish();
window.close();
}
function run()
{
/** Test for Bug 396024 **/
@ -59,7 +64,7 @@ function run()
.getService(Components.interfaces.nsIPrinterEnumerator);
} catch(e) {
todo(false, "Test skipped on MacOSX, as the print preview code doesn't work there");
SimpleTest.finish();
finish();
return;
}
@ -72,7 +77,7 @@ function run()
setTimeout(run2, 0)
} else {
todo(false, "No printer seems installed on this machine, that is necessary for this test");
SimpleTest.finish();
finish();
}
}
@ -112,8 +117,7 @@ function run5() {
//XXX this shouldn't be necessary, see bug 405555
printpreview();
exitprintpreview();
SimpleTest.finish(); //should not have crashed after all of this
window.close();
finish(); //should not have crashed after all of this
}
]]></script>
</window>

View File

@ -48,6 +48,11 @@ function exitprintpreview() {
.getInterface(Components.interfaces.nsIWebBrowserPrint).exitPrintPreview();
}
function finish() {
SimpleTest.finish();
window.close();
}
function run1()
{
/** Test for Bug 482976 **/
@ -59,7 +64,7 @@ function run1()
.getService(Components.interfaces.nsIPrinterEnumerator);
} catch(e) {
todo(false, "Test skipped on MacOSX, as the print preview code doesn't work there");
SimpleTest.finish();
finish();
return;
}
@ -68,12 +73,10 @@ function run1()
ok(gWbp.doingPrintPreview, "Should be doing print preview");
exitprintpreview();
ok(!gWbp.doingPrintPreview, "Should not be doing print preview anymore");
SimpleTest.finish();
} else {
todo(false, "No printer seems installed on this machine, that is necessary for this test");
SimpleTest.finish();
}
window.close();
finish();
}
]]></script>
</window>

View File

@ -65,6 +65,11 @@ function exitprintpreview() {
.getInterface(Components.interfaces.nsIWebBrowserPrint).exitPrintPreview();
}
function finish() {
SimpleTest.finish();
window.close();
}
function runTests()
{
var printService = Components.classes["@mozilla.org/gfx/printsettings-service;1"]
@ -75,7 +80,7 @@ function runTests()
.getService(Components.interfaces.nsIPrinterEnumerator);
} catch(e) {
todo(false, "Test skipped on MacOSX, as the print preview code doesn't work there");
SimpleTest.finish();
finish();
return;
}
@ -83,7 +88,7 @@ function runTests()
startTest1();
} else {
todo(false, "No printer seems installed on this machine, that is necessary for this test");
SimpleTest.finish();
finish();
}
}
@ -239,8 +244,7 @@ function runTest5() {
'<input contenteditable="true" style="display: table; page-break-before: left; width: 10000px;">';
printpreview();
exitprintpreview();
SimpleTest.finish();
window.close();
finish();
}
]]></script>