Bug 843980 - Switch tests to check for category entries, not service existence. r=mconnor

This commit is contained in:
Richard Newman 2013-02-22 08:15:53 -08:00
parent c878d63b6a
commit 8ba9584d11
4 changed files with 22 additions and 6 deletions

View File

@ -110,12 +110,15 @@ let gTests = [
desc: "Check that performing a search records to Firefox Health Report.",
setup: function () { },
run: function () {
if (!("@mozilla.org/datareporting/service;1" in Components.classes)) {
try {
let cm = Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICategoryManager);
cm.getCategoryEntry("healthreport-js-provider", "SearchesProvider");
} catch (ex) {
// Health Report disabled, or no SearchesProvider.
runNextTest();
return;
}
let doc = gBrowser.contentDocument;
// We rely on the listener in browser.js being installed and fired before

View File

@ -26,7 +26,12 @@ function test() {
container.removeEventListener("TabOpen", tabAdded, false);
tabs.forEach(gBrowser.removeTab, gBrowser);
if (!"@mozilla.org/datareporting/service;1" in Components.classes) {
try {
let cm = Components.classes["@mozilla.org/categorymanager;1"]
.getService(Components.interfaces.nsICategoryManager);
cm.getCategoryEntry("healthreport-js-provider", "SearchesProvider");
} catch (ex) {
// Health Report disabled, or no SearchesProvider.
finish();
return;
}

View File

@ -5,8 +5,11 @@
function test() {
waitForExplicitFinish();
if (!("@mozilla.org/datareporting/service;1" in Cc)) {
try {
let cm = Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICategoryManager);
cm.getCategoryEntry("healthreport-js-provider", "SearchesProvider");
} catch (ex) {
// Health Report disabled, or no SearchesProvider.
ok(true, "Firefox Health Report is not enabled.");
finish();
return;

View File

@ -6,7 +6,12 @@
function test() {
waitForExplicitFinish();
if (!("@mozilla.org/datareporting/service;1" in Components.classes)) {
try {
let cm = Components.classes["@mozilla.org/categorymanager;1"]
.getService(Components.interfaces.nsICategoryManager);
cm.getCategoryEntry("healthreport-js-provider", "SearchesProvider");
} catch (ex) {
// Health Report disabled, or no SearchesProvider.
// We need a test or else we'll be marked as failure.
ok(true, "Firefox Health Report is not enabled.");
finish();