Bug 628679 - Add some dump to browser_addons.js for debugging random failure
authorVivien Nicolas <21@vingtetun.org>
Tue, 25 Jan 2011 18:57:02 +0100
changeset 67301 b5f90d6025119d76cc37ee7cf701a09eaadf5566
parent 67300 dc983f768b60039394ab918ef83e2e6c92eeca33
child 67302 83843c0b9d94f36fbf50ff85f99bc8bdcc0b8624
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs628679
Bug 628679 - Add some dump to browser_addons.js for debugging random failure
mobile/chrome/tests/browser_addons.js
--- a/mobile/chrome/tests/browser_addons.js
+++ b/mobile/chrome/tests/browser_addons.js
@@ -150,42 +150,46 @@ function isRestartShown(aShown, isUpdate
       done(notification);
     }, true);
   } else {
     done(notification);
   }
 }
 
 function checkInstallAlert(aShown, aCallback) {
+  info("checkInstallAlert " + aShown + "\n");
   checkAlert(null, "xpinstall", null, aShown, function(aNotifyBox, aNotification) {
     if (aShown) {
       let button = aNotification.childNodes[0];
       ok(!!button, "Notification has button");
       if (button)
         button.click();
     }
     aNotifyBox.removeAllNotifications(true);
     if (aCallback)
       aCallback();
   });
 }
 
 function checkDownloadNotification(aCallback) {
+  dump("checkDownloadNotification\n");
   let msg = /download/i;
   checkNotification(/Add-ons/, msg, ADDON_IMG, aCallback);
 }
 
 function checkInstallNotification(aRestart, aCallback) {
+  dump("checkInstallNotification " + aRestart + "\n");
   let msg = null;
   if (aRestart)
     msg = /restart/i;
   checkNotification(/Add-ons/, msg, ADDON_IMG, aCallback);
 }
 
 function checkNotification(aTitle, aMessage, aIcon, aCallback) {
+  dump("checkNotification " + aTitle + " " + aMessage + " " + aIcon + "\n");
   let doTest = function() {
     ok(document.getElementById("alerts-container").classList.contains("showing"), "Alert shown");
     let title = document.getElementById("alerts-title").value;
     let msg   = document.getElementById("alerts-text").textContent;
     let img   = document.getElementById("alerts-image").getAttribute("src");
 
     if (aTitle)
       ok(aTitle.test(title), "Correct title alert shown: " + title);
@@ -200,16 +204,17 @@ function checkNotification(aTitle, aMess
     AlertsHelper.container.hidden = true;
     aCallback();
   };
 
   waitFor(doTest, function() { return AlertsHelper.container.hidden == false; });
 }
 
 function checkAlert(aId, aName, aLabel, aShown, aCallback) {
+  info("checkAlert " + aId + " " + aName + " " + aLabel + " " + aShown + "\n");
   let msg = null;
   if (aId)
     msg = document.getElementById(aId);
   else
     msg = window.getNotificationBox(gCurrentTab.browser);
   ok(!!msg, "Have notification box");
 
   let haveNotification = function(notify) {
@@ -341,25 +346,33 @@ function testPrompt(aTitle, aMessage, aB
     }, true);
   } else {
     doTest();
   }
 }
 
 // Installs an addon via the urlbar.
 function installFromURLBar(aAddon) {
+  info("installFromURLBar " + aAddon + "\n");
   return function() {
     loadUrl(gTestURL, function() {
+      info("loadUrl: " + gTestURL + "\n");
       loadUrl(aAddon.sourceURL, null, false);
+      info("loadUrl: " + aAddon.sourceURL + "(2)\n");
       checkInstallAlert(true, function() {
+        dump("info: checkInstallAlert callback\n");
         checkDownloadNotification(function() {
+          dump("info: checkDownloadNotification callback\n");
           checkInstallPopup(aAddon.name, function() {
+            dump("info: checkInstallPopup callback\n");
             checkInstallNotification(!aAddon.bootstrapped, function() {
+              dump("info: checkInstallNotification callback\n");
               open_manager(true, function() {
                 isRestartShown(!aAddon.bootstrapped, false, function() {
+                  dump("info: isRestartShown callback\n");
                   let elt = get_addon_element(aAddon.id);
                   if (aAddon.bootstrapped) {
                     checkAddonListing(aAddon, elt, "local");
                     var button = document.getAnonymousElementByAttribute(elt, "anonid", "uninstall-button");
                     ok(!!button, "Extension has uninstall button");
 
                     var updateButton = document.getElementById("addons-update-all");
                     is(updateButton.disabled, false, "Update button is enabled");