Modified test for bug 396024, this should not cause problems anymore now that bug 407080 is fixed

This commit is contained in:
martijn.martijn@gmail.com 2008-03-14 08:12:20 -07:00
parent 7c4c877c83
commit e8ea49f32b
2 changed files with 18 additions and 5 deletions

View File

@ -85,6 +85,7 @@ _TEST_FILES = \
test_bug386575.xhtml \
test_bug388019.html \
test_bug394057.html \
test_bug396024.html \
test_bug399284.html \
test_bug399951.html \
test_bug404209.xhtml \

View File

@ -55,7 +55,6 @@ function run()
netscape.security.PrivilegeManager.enablePrivilege('UniversalPreferencesRead UniversalPreferencesWrite UniversalXPConnect');
var printService = Components.classes["@mozilla.org/gfx/printsettings-service;1"]
.getService(Components.interfaces.nsIPrintSettingsService);
SimpleTest.waitForExplicitFinish();
try {
var printerEnumerator = Components.classes["@mozilla.org/gfx/printerenumerator;1"]
@ -67,13 +66,13 @@ function run()
}
if (printService.defaultPrinterName != '') {
window.frames[0].frameElement.setAttribute('onload', 'run2()');
window.frames[0].frameElement.removeAttribute('onload');
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();
setTimeout(run2, 0)
} else {
todo(false, "No printer seems installed on this machine, that is necessary for this test");
SimpleTest.finish();
@ -81,26 +80,39 @@ function run()
}
function run2() {
window.frames[0].frameElement.setAttribute('onload', 'setTimeout(run3, 0)');
window.frames[0].location.reload();
}
function run3() {
netscape.security.PrivilegeManager.enablePrivilege('UniversalPreferencesRead UniversalPreferencesWrite UniversalXPConnect');
gWbp = window.frames[0].QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebBrowserPrint);
ok(!gWbp.doingPrintPreview, "Should not be doing print preview anymore2");
window.frames[0].frameElement.removeAttribute('onload');
window.frames[0].frameElement.removeAttribute('onload');
printpreview();
setTimeout(run4, 0);
}
function run4() {
netscape.security.PrivilegeManager.enablePrivilege('UniversalPreferencesRead UniversalPreferencesWrite UniversalXPConnect');
var x = window.frames[0].frameElement.parentNode.removeChild(window.frames[0].frameElement);
x.setAttribute('onload', 'setTimeout(run5, 0)');
document.body.offsetHeight;
document.body.appendChild(x);
gWbp = window.frames[0].QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebBrowserPrint);
ok(!gWbp.doingPrintPreview, "Should not be doing print preview anymore3");
}
function run5() {
//XXX this shouldn't be necessary, see bug 405555
printpreview();
exitprintpreview();
SimpleTest.finish(); //should not have crashed after all of this
}
</script>
<iframe onload="run()" src="data:text/html;charset=utf-8,"></iframe>
<iframe onload="SimpleTest.waitForExplicitFinish(); setTimeout(run, 0)" src="data:text/html;charset=utf-8,"></iframe>
</pre>
</body>
</html>