Bug 1122540 - Set preferences which are necessary for passing xpcshell test on comm-central. r=hurley

This commit is contained in:
Hiroyuki Ikezoe 2015-01-19 01:03:00 +02:00
parent dc130e7588
commit da8bdaa669

View File

@ -291,16 +291,10 @@ function test_origin() {
} }
var prefs; var prefs;
var predictor_pref;
var preconnect_min_pref;
var cleaned_up_pref;
function cleanup() { function cleanup() {
observer.cleaningUp = true; observer.cleaningUp = true;
predictor.reset(); predictor.reset();
prefs.setIntPref("network.predictor.preconnect-min-confidence", preconnect_min_pref);
prefs.setBoolPref("network.predictor.enabled", predictor_pref);
prefs.setBoolPref("network.predictor.cleaned-up", cleaned_up_pref);
} }
var tests = [ var tests = [
@ -355,11 +349,17 @@ function run_test() {
tests.forEach(add_test); tests.forEach(add_test);
profile = do_get_profile(); profile = do_get_profile();
prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch); prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
preconnect_min_pref = prefs.getIntPref("network.predictor.preconnect-min-confidence");
predictor_pref = prefs.getBoolPref("network.predictor.enabled");
cleaned_up_pref = prefs.getBoolPref("network.predictor.cleaned-up");
prefs.setBoolPref("network.predictor.enabled", true); prefs.setBoolPref("network.predictor.enabled", true);
prefs.setBoolPref("network.predictor.cleaned-up", true); prefs.setBoolPref("network.predictor.cleaned-up", true);
prefs.setBoolPref("browser.cache.use_new_backend_temp", true);
prefs.setIntPref("browser.cache.use_new_backend", 1);
do_register_cleanup(() => {
prefs.clearUserPref("network.predictor.preconnect-min-confidence");
prefs.clearUserPref("network.predictor.enabled");
prefs.clearUserPref("network.predictor.cleaned-up");
prefs.clearUserPref("browser.cache.use_new_backend_temp");
prefs.clearUserPref("browser.cache.use_new_backend");
});
predictor = Cc["@mozilla.org/network/predictor;1"].getService(Ci.nsINetworkPredictor); predictor = Cc["@mozilla.org/network/predictor;1"].getService(Ci.nsINetworkPredictor);
registerObserver(); registerObserver();
run_next_test(); run_next_test();