Bug 1190759 - Increase waitForCondition retry times in registerProtocolHandler notification test. r=mrbkap
authorCJKu <cku@mozilla.com>
Tue, 01 Mar 2016 10:57:40 +0800
changeset 323086 bde14028c597bc3079a9ab23016a9ee27f5ae0ae
parent 323085 9e2e521cbd139851f9ca09ec7f0397cca22cae3d
child 323087 8606450976580d2c7aa74c3d48adcc7543a693c5
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap
bugs1190759
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1190759 - Increase waitForCondition retry times in registerProtocolHandler notification test. r=mrbkap MozReview-Commit-ID: 5rlBD4lmNZT
browser/base/content/test/general/browser_registerProtocolHandler_notification.js
browser/base/content/test/general/head.js
--- 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);