2011-09-29 23:17:31 +04:00
|
|
|
var localeList = serverRoot + "locales_list.sjs";
|
|
|
|
var PREF_LOCALE_LIST = "extensions.getLocales.get.url";
|
|
|
|
|
2012-04-07 00:02:15 +04:00
|
|
|
let tmp = {};
|
|
|
|
Components.utils.import("resource://gre/modules/LocaleRepository.jsm", tmp);
|
|
|
|
let LocaleRepository = tmp.LocaleRepository;
|
2011-09-29 23:17:31 +04:00
|
|
|
|
|
|
|
function test() {
|
|
|
|
waitForExplicitFinish();
|
|
|
|
runNextTest();
|
|
|
|
}
|
|
|
|
|
|
|
|
function end_test() {
|
|
|
|
Services.prefs.clearUserPref(PREF_LOCALE_LIST);
|
|
|
|
}
|
|
|
|
|
|
|
|
registerCleanupFunction(end_test);
|
|
|
|
|
|
|
|
gTests.push({
|
|
|
|
desc: "Test dynamically changing extensions.getLocales.get.url",
|
|
|
|
run: function() {
|
|
|
|
Services.prefs.setCharPref(PREF_LOCALE_LIST, localeList);
|
|
|
|
LocaleRepository.getLocales(this.listLoaded.bind(this));
|
|
|
|
},
|
|
|
|
|
|
|
|
listLoaded: function(aLocales) {
|
|
|
|
is(aLocales.length, 1, "Correct number of locales were found");
|
|
|
|
Services.prefs.setCharPref(PREF_LOCALE_LIST, localeList + "?numvalid=2");
|
|
|
|
LocaleRepository.getLocales(this.secondListLoaded.bind(this));
|
|
|
|
},
|
|
|
|
|
|
|
|
secondListLoaded: function(aLocales) {
|
|
|
|
is(aLocales.length, 2, "Correct number of locales were found");
|
|
|
|
runNextTest();
|
|
|
|
}
|
|
|
|
});
|