Bug 893683 - checkSocialUI is too verbose when running social tests. r=mixedpuppy
authorMark Hammond <mhammond@skippinet.com.au>
Tue, 16 Jul 2013 13:32:19 +1000
changeset 138620 e111361f9c1f4b0eedb02def1dc00ec0cc28241a
parent 138619 556a557c7276b15deb36e92e35d402b677a6e4e2
child 138621 f22202174cea5fe29f55239399c015eaf5b3cc43
push id24964
push userryanvm@gmail.com
push dateTue, 16 Jul 2013 20:04:09 +0000
treeherderautoland@fd10ead17ace [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmixedpuppy
bugs893683
milestone25.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 893683 - checkSocialUI is too verbose when running social tests. r=mixedpuppy
browser/base/content/test/social/head.js
--- a/browser/base/content/test/social/head.js
+++ b/browser/base/content/test/social/head.js
@@ -195,52 +195,70 @@ function runSocialTests(tests, cbPreTest
 function checkSocialUI(win) {
   win = win || window;
   let doc = win.document;
   let provider = Social.provider;
   let enabled = win.SocialUI.enabled;
   let active = Social.providers.length > 0 && !win.SocialUI._chromeless &&
                !PrivateBrowsingUtils.isWindowPrivate(win);
 
+  // some local helpers to avoid log-spew for the many checks made here.
+  let numGoodTests = 0, numTests = 0;
+  function _ok(what, msg) {
+    numTests++;
+    if (!ok)
+      ok(what, msg)
+    else
+      ++numGoodTests;
+  }
+  function _is(a, b, msg) {
+    numTests++;
+    if (a != b)
+      is(a, b, msg)
+    else
+      ++numGoodTests;
+  }
   function isbool(a, b, msg) {
-    is(!!a, !!b, msg);
+    _is(!!a, !!b, msg);
   }
   isbool(win.SocialSidebar.canShow, enabled, "social sidebar active?");
   if (enabled)
     isbool(win.SocialSidebar.opened, enabled, "social sidebar open?");
   isbool(win.SocialChatBar.isAvailable, enabled && Social.haveLoggedInUser(), "chatbar available?");
   isbool(!win.SocialChatBar.chatbar.hidden, enabled && Social.haveLoggedInUser(), "chatbar visible?");
 
   let markVisible = enabled && provider.pageMarkInfo;
   let canMark = markVisible && win.SocialMark.canMarkPage(win.gBrowser.currentURI);
   isbool(!win.SocialMark.button.hidden, markVisible, "SocialMark button visible?");
   isbool(!win.SocialMark.button.disabled, canMark, "SocialMark button enabled?");
   isbool(!doc.getElementById("social-toolbar-item").hidden, active, "toolbar items visible?");
   if (active) {
     if (!enabled) {
-      ok(!win.SocialToolbar.button.style.listStyleImage, "toolbar button is default icon");
+      _ok(!win.SocialToolbar.button.style.listStyleImage, "toolbar button is default icon");
     } else {
-      is(win.SocialToolbar.button.style.listStyleImage, 'url("' + Social.defaultProvider.iconURL + '")', "toolbar button has provider icon");
+      _is(win.SocialToolbar.button.style.listStyleImage, 'url("' + Social.defaultProvider.iconURL + '")', "toolbar button has provider icon");
     }
   }
   // the menus should always have the provider name
   if (provider) {
     for (let id of ["menu_socialSidebar", "menu_socialAmbientMenu"])
-      is(document.getElementById(id).getAttribute("label"), Social.provider.name, "element has the provider name");
+      _is(document.getElementById(id).getAttribute("label"), Social.provider.name, "element has the provider name");
   }
 
   // and for good measure, check all the social commands.
   isbool(!doc.getElementById("Social:Toggle").hidden, active, "Social:Toggle visible?");
   isbool(!doc.getElementById("Social:ToggleNotifications").hidden, enabled, "Social:ToggleNotifications visible?");
   isbool(!doc.getElementById("Social:FocusChat").hidden, enabled && Social.haveLoggedInUser(), "Social:FocusChat visible?");
   isbool(doc.getElementById("Social:FocusChat").getAttribute("disabled"), enabled ? "false" : "true", "Social:FocusChat disabled?");
-  is(doc.getElementById("Social:TogglePageMark").getAttribute("disabled"), canMark ? "false" : "true", "Social:TogglePageMark enabled?");
+  _is(doc.getElementById("Social:TogglePageMark").getAttribute("disabled"), canMark ? "false" : "true", "Social:TogglePageMark enabled?");
 
   // broadcasters.
   isbool(!doc.getElementById("socialActiveBroadcaster").hidden, active, "socialActiveBroadcaster hidden?");
+  // and report on overall success of failure of the various checks here.
+  is(numGoodTests, numTests, "The Social UI tests succeeded.")
 }
 
 // blocklist testing
 function updateBlocklist(aCallback) {
   var blocklistNotifier = Cc["@mozilla.org/extensions/blocklist;1"]
                           .getService(Ci.nsITimerCallback);
   var observer = function() {
     Services.obs.removeObserver(observer, "blocklist-updated");