Bug 1190759 - Increase waitForCondition retry times in registerProtocolHandler notification test.
MozReview-Commit-ID: 5rlBD4lmNZT
--- a/browser/base/content/test/general/browser_registerProtocolHandler_notification.js
+++ b/browser/base/content/test/general/browser_registerProtocolHandler_notification.js
@@ -14,26 +14,30 @@ function test() {
let notification = notificationBox.getNotificationWithValue(notificationValue);
return notification;
},
function() {
let notificationBox = window.gBrowser.getNotificationBox();
let notification = notificationBox.getNotificationWithValue(notificationValue);
ok(notification, "Notification box should be displayed");
+ if (notification == null) {
+ finish();
+ return;
+ }
is(notification.type, "info", "We expect this notification to have the type of 'info'.");
isnot(notification.image, null, "We expect this notification to have an icon.");
let buttons = notification.getElementsByClassName("notification-button-default");
is(buttons.length, 1, "We expect see one default button.");
buttons = notification.getElementsByClassName("notification-button");
is(buttons.length, 1, "We expect see one button.");
let button = buttons[0];
isnot(button.label, null, "We expect the add button to have a label.");
todo_isnot(button.accesskey, null, "We expect the add button to have a accesskey.");
finish();
- }, 100);
+ }, "Still can not get notification after retry 100 times.", 100);
window.gBrowser.selectedBrowser.loadURI(testURI);
}
--- a/browser/base/content/test/general/head.js
+++ b/browser/base/content/test/general/head.js
@@ -90,20 +90,21 @@ function closeToolbarCustomizationUI(aCa
aBrowserWin.gNavToolbox.addEventListener("aftercustomization", function unloaded() {
aBrowserWin.gNavToolbox.removeEventListener("aftercustomization", unloaded);
executeSoon(aCallback);
});
aBrowserWin.gCustomizeMode.exit();
}
-function waitForCondition(condition, nextTest, errorMsg) {
+function waitForCondition(condition, nextTest, errorMsg, retryTimes) {
+ retryTimes = typeof retryTimes !== 'undefined' ? retryTimes : 30;
var tries = 0;
var interval = setInterval(function() {
- if (tries >= 30) {
+ if (tries >= retryTimes) {
ok(false, errorMsg);
moveOn();
}
var conditionPassed;
try {
conditionPassed = condition();
} catch (e) {
ok(false, e + "\n" + e.stack);