Bug 886263 - Make places be enabled by default in all xpcshell-tests to avoid having to set it in lots of places (so that tests work with apps where places is disabled by default). r=mak

This commit is contained in:
Mark Banner 2013-06-26 14:56:11 +01:00
parent dee2df83d6
commit 8e11fc7cb0
6 changed files with 11 additions and 13 deletions

View File

@ -61,8 +61,6 @@ function run_test()
// Needed to properly setup and shutdown the profile.
do_get_profile();
Services.prefs.setBoolPref("places.history.enabled", true);
for (var i = 0; i < tests.length; i++)
tests[i]();

View File

@ -45,6 +45,17 @@ try {
}
catch (e) { }
// Only if building of places is enabled.
if (runningInParent &&
"mozIAsyncHistory" in Components.interfaces) {
// Ensure places history is enabled for xpcshell-tests as some non-FF
// apps disable it.
let (prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch)) {
prefs.setBoolPref("places.history.enabled", true);
};
}
try {
if (runningInParent) {
let prefs = Components.classes["@mozilla.org/preferences-service;1"]

View File

@ -36,9 +36,6 @@ add_task(function test_execute()
if (!("@mozilla.org/browser/nav-history-service;1" in Cc))
return;
// Ensure places is enabled.
Services.prefs.setBoolPref("places.history.enabled", true);
let dm = Cc["@mozilla.org/download-manager;1"].
getService(Ci.nsIDownloadManager);
let db = dm.DBConnection;

View File

@ -55,9 +55,6 @@ function LOG(aMsg) {
let gTestDir = do_get_cwd();
// Ensure history is enabled.
Services.prefs.setBoolPref("places.history.enabled", true);
// Initialize profile.
let gProfD = do_get_profile();

View File

@ -6,9 +6,6 @@ const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
// Ensure history is enabled.
Services.prefs.setBoolPref("places.history.enabled", true);
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
"resource://gre/modules/commonjs/sdk/core/promise.js");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",

View File

@ -733,8 +733,6 @@ let tests = [
function run_test()
{
Services.prefs.setBoolPref("places.history.enabled", true);
for (let i = 0; i < tests.length; i++)
add_task(tests[i]);