зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1748930 - Add search selector engine properties to search settings metadata object. r=Standard8
Differential Revision: https://phabricator.services.mozilla.com/D135894
This commit is contained in:
Родитель
51db0fdc6c
Коммит
6515360a34
|
@ -1041,23 +1041,26 @@ SearchService.prototype = {
|
|||
},
|
||||
|
||||
async _fetchEngineSelectorEngines() {
|
||||
let locale = Services.locale.appLocaleAsBCP47;
|
||||
let region = Region.home || "default";
|
||||
let searchEngineSelectorProperties = {
|
||||
locale: Services.locale.appLocaleAsBCP47,
|
||||
region: Region.home || "default",
|
||||
channel: AppConstants.MOZ_APP_VERSION_DISPLAY.endsWith("esr")
|
||||
? "esr"
|
||||
: AppConstants.MOZ_UPDATE_CHANNEL,
|
||||
experiment: NimbusFeatures.search.getVariable("experiment") ?? "",
|
||||
distroID: SearchUtils.distroID ?? "",
|
||||
};
|
||||
|
||||
let channel = AppConstants.MOZ_APP_VERSION_DISPLAY.endsWith("esr")
|
||||
? "esr"
|
||||
: AppConstants.MOZ_UPDATE_CHANNEL;
|
||||
for (let [key, value] of Object.entries(searchEngineSelectorProperties)) {
|
||||
this._settings.setAttribute(key, value);
|
||||
}
|
||||
|
||||
let {
|
||||
engines,
|
||||
privateDefault,
|
||||
} = await this._engineSelector.fetchEngineConfiguration({
|
||||
locale,
|
||||
region,
|
||||
channel,
|
||||
experiment: NimbusFeatures.search.getVariable("experiment"),
|
||||
distroID: SearchUtils.distroID,
|
||||
});
|
||||
} = await this._engineSelector.fetchEngineConfiguration(
|
||||
searchEngineSelectorProperties
|
||||
);
|
||||
|
||||
for (let e of engines) {
|
||||
if (!e.webExtension) {
|
||||
|
|
|
@ -122,6 +122,39 @@ add_task(async function test_current_setting_engine_properties() {
|
|||
await checkLoadSettingProperties("data/search.json", true, false);
|
||||
});
|
||||
|
||||
add_task(async function test_settings_metadata_properties() {
|
||||
info("init search service");
|
||||
await loadSettingsFile("data/search.json");
|
||||
|
||||
const settingsFileWritten = promiseAfterSettings();
|
||||
let ss = new SearchService();
|
||||
let result = await ss.init();
|
||||
|
||||
info("init'd search service");
|
||||
Assert.ok(Components.isSuccessCode(result));
|
||||
|
||||
await settingsFileWritten;
|
||||
|
||||
let metaDataProperties = [
|
||||
"locale",
|
||||
"region",
|
||||
"channel",
|
||||
"experiment",
|
||||
"distroID",
|
||||
];
|
||||
|
||||
for (let name of metaDataProperties) {
|
||||
Assert.notEqual(
|
||||
ss._settings.getAttribute(`${name}`),
|
||||
undefined,
|
||||
`Search settings should have ${name} property defined.`
|
||||
);
|
||||
}
|
||||
|
||||
removeSettingsFile();
|
||||
ss._removeObservers();
|
||||
});
|
||||
|
||||
/**
|
||||
* Test that the JSON settings written in the profile is correct.
|
||||
*/
|
||||
|
|
Загрузка…
Ссылка в новой задаче