Modified test for bug 396024, this should not cause test failures when no printer is installed

This commit is contained in:
martijn.martijn@gmail.com 2007-12-05 14:07:12 -08:00
parent 720992b3c1
commit 7625e6aa63
2 changed files with 15 additions and 10 deletions

View File

@ -83,6 +83,7 @@ ifdef MOZ_MOCHITEST
_TEST_FILES = \
test_bug66619.html \
test_bug388019.html \
test_bug396024.html \
test_bug399284.html \
test_bug399951.html \
test_bug404209.xhtml \

View File

@ -38,7 +38,6 @@ function printpreview() {
.getService(Components.interfaces.nsIPrefBranch);
prefs.setBoolPref('print.show_print_progress', false);
//XXX I would have thought this would work, instead I'm forced to use prefs service
// I'm disabling showPrintProgress dialog, because it stays as a zombie dialog, see bug 405588
gWbp.globalPrintSettings.showPrintProgress = false;
gWbp.printPreview(gWbp.globalPrintSettings, null, listener);
prefs.clearUserPref('print.show_print_progress');
@ -53,15 +52,21 @@ function exitprintpreview() {
function run()
{
/** Test for Bug 396024 **/
window.frames[0].frameElement.setAttribute('onload', 'run2()');
netscape.security.PrivilegeManager.enablePrivilege('UniversalPreferencesRead UniversalPreferencesWrite UniversalXPConnect');
SimpleTest.waitForExplicitFinish();
printpreview();
ok(gWbp.doingPrintPreview, "Should be doing print preview");
exitprintpreview();
ok(!gWbp.doingPrintPreview, "Should not be doing print preview anymore1");
printpreview();
window.frames[0].location.reload();
var printService = Components.classes["@mozilla.org/gfx/printsettings-service;1"]
.getService(Components.interfaces.nsIPrintSettingsService);
if (printService.defaultPrinterName != '') {
window.frames[0].frameElement.setAttribute('onload', 'run2()');
SimpleTest.waitForExplicitFinish();
printpreview();
ok(gWbp.doingPrintPreview, "Should be doing print preview");
exitprintpreview();
ok(!gWbp.doingPrintPreview, "Should not be doing print preview anymore1");
printpreview();
window.frames[0].location.reload();
} else {
todo(false, "No printer seems installed on this machine, that is necessary for this test")
}
}
function run2() {
@ -88,4 +93,3 @@ function run2() {
</pre>
</body>
</html>