diff --git a/browser/base/content/test/social/head.js b/browser/base/content/test/social/head.js index cb37e3c925c..0f5a3668019 100644 --- a/browser/base/content/test/social/head.js +++ b/browser/base/content/test/social/head.js @@ -200,8 +200,24 @@ function checkSocialUI(win) { 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) @@ -216,15 +232,15 @@ function checkSocialUI(win) { 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. @@ -232,10 +248,12 @@ function checkSocialUI(win) { 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