Bug 623242: Fix test_localfile to wait for failure rather than popup. r=gavin, a=tests

This commit is contained in:
Dave Townsend 2011-02-17 09:53:19 -08:00
parent a4901151d2
commit 687c00cce4

View File

@ -432,9 +432,13 @@ function test_url() {
}, },
function test_localfile() { function test_localfile() {
// Wait for the complete notification // Wait for the install to fail
wait_for_notification(function(aPanel) { Services.obs.addObserver(function() {
let notification = aPanel.childNodes[0]; Services.obs.removeObserver(arguments.callee, "addon-install-failed");
// Wait for the browser code to add the failure notification
executeSoon(function() {
let notification = PopupNotifications.panel.childNodes[0];
is(notification.id, "addon-install-failed-notification", "Should have seen the install fail"); is(notification.id, "addon-install-failed-notification", "Should have seen the install fail");
is(notification.getAttribute("label"), is(notification.getAttribute("label"),
"This add-on could not be installed because it appears to be corrupt.", "This add-on could not be installed because it appears to be corrupt.",
@ -443,6 +447,7 @@ function test_localfile() {
wait_for_notification_close(runNextTest); wait_for_notification_close(runNextTest);
gBrowser.removeTab(gBrowser.selectedTab); gBrowser.removeTab(gBrowser.selectedTab);
}); });
}, "addon-install-failed", false);
var cr = Components.classes["@mozilla.org/chrome/chrome-registry;1"] var cr = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
.getService(Components.interfaces.nsIChromeRegistry); .getService(Components.interfaces.nsIChromeRegistry);