Bug 634680: Fix intermittent failure in browser_bug553455.js test_check_security. r=gavin, a=tests

This commit is contained in:
Dave Townsend 2011-02-17 09:53:45 -08:00
Родитель 1c553bb236
Коммит a75b1da15d
1 изменённых файлов: 19 добавлений и 13 удалений

Просмотреть файл

@ -801,20 +801,26 @@ function test_failed_security() {
Services.obs.addObserver(function() { Services.obs.addObserver(function() {
Services.obs.removeObserver(arguments.callee, "addon-install-failed"); Services.obs.removeObserver(arguments.callee, "addon-install-failed");
// Wait for the browser code to add the failure notification function waitForSingleNotification() {
executeSoon(function() { // Notification should never close while we wait
// Wait for the progress notification to dismiss itself ok(PopupNotifications.isPanelOpen, "Notification should still be open");
executeSoon(function() { if (PopupNotifications.panel.childNodes.length == 2) {
ok(PopupNotifications.isPanelOpen, "Notification should still be open"); executeSoon(waitForSingleNotification);
is(PopupNotifications.panel.childNodes.length, 1, "Should be only one notification"); return;
notification = aPanel.childNodes[0]; }
is(notification.id, "addon-install-failed-notification", "Should have seen the install fail");
Services.prefs.setBoolPref(PREF_INSTALL_REQUIREBUILTINCERTS, true); is(PopupNotifications.panel.childNodes.length, 1, "Should be only one notification");
wait_for_notification_close(runNextTest); notification = aPanel.childNodes[0];
gBrowser.removeTab(gBrowser.selectedTab); is(notification.id, "addon-install-failed-notification", "Should have seen the install fail");
});
}); Services.prefs.setBoolPref(PREF_INSTALL_REQUIREBUILTINCERTS, true);
wait_for_notification_close(runNextTest);
gBrowser.removeTab(gBrowser.selectedTab);
}
// Allow the browser code to add the failure notification and then wait
// for the progress notification to dismiss itself
executeSoon(waitForSingleNotification);
}, "addon-install-failed", false); }, "addon-install-failed", false);
}); });