Bug 1079303 - part 2: fix tests to not expect sync behaviour from notification.reshow, r=dolske

This commit is contained in:
Gijs Kruitbosch
2014-11-25 01:06:36 +00:00
parent 4dd13c571f
commit a432cee88a
10 changed files with 253 additions and 180 deletions

View File

@@ -153,6 +153,26 @@ function waitForNotificationBar(notificationID, browser, callback) {
});
}
/**
* Reshow a notification and call a callback when it is reshown.
* @param notification
* The notification to reshow
* @param callback
* A function to be called when the notification has been reshown
*/
function waitForNotificationShown(notification, callback)
{
if (PopupNotifications.panel.state == "open") {
executeSoon(callback);
return;
}
PopupNotifications.panel.addEventListener("popupshown", function onShown(e) {
PopupNotifications.panel.removeEventListener("popupshown", onShown);
callback();
}, false);
notification.reshow();
}
/**
* Due to layout being async, "PluginBindAttached" may trigger later.
* This returns a Promise that resolves once we've forced a layout