Bug 1664197 - Use explicit telemetry ids for search engines for some distributions. r=daleharvey

Differential Revision: https://phabricator.services.mozilla.com/D95021
This commit is contained in:
Mark Banner 2020-11-13 15:24:05 +00:00
Родитель 6b4fae17f8
Коммит 4687ec3695
2 изменённых файлов: 25 добавлений и 7 удалений

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -72,7 +72,8 @@ for (let canonicalId of ["canonical", "canonical-001", "canonical-002"]) {
distribution: canonicalId,
test: engines =>
hasParams(engines, "Google", "searchbar", "client=ubuntu") &&
hasParams(engines, "Google", "searchbar", "channel=fs"),
hasParams(engines, "Google", "searchbar", "channel=fs") &&
hasTelemetryId(engines, "Google", "google-canonical"),
});
tests.push({
@ -81,7 +82,8 @@ for (let canonicalId of ["canonical", "canonical-001", "canonical-002"]) {
distribution: canonicalId,
test: engines =>
hasParams(engines, "Google", "searchbar", "client=ubuntu") &&
hasParams(engines, "Google", "searchbar", "channel=fs"),
hasParams(engines, "Google", "searchbar", "channel=fs") &&
hasTelemetryId(engines, "Google", "google-canonical"),
});
tests.push({
@ -438,7 +440,8 @@ for (const locale of ["en-US", "en-GB", "fr", "de"]) {
test: engines =>
hasParams(engines, "Google", "searchbar", "client=firefox-b-oem1") &&
hasDefault(engines, "Google") &&
hasEnginesFirst(engines, ["Google"]),
hasEnginesFirst(engines, ["Google"]) &&
hasTelemetryId(engines, "Google", "google-sweetlabs"),
});
tests.push({
@ -447,7 +450,8 @@ for (const locale of ["en-US", "en-GB", "fr", "de"]) {
test: engines =>
hasParams(engines, "Google", "searchbar", "client=firefox-b-oem1") &&
hasDefault(engines, "Google") &&
hasEnginesFirst(engines, ["Google"]),
hasEnginesFirst(engines, ["Google"]) &&
hasTelemetryId(engines, "Google", "google-sweetlabs"),
});
tests.push({
@ -456,7 +460,8 @@ for (const locale of ["en-US", "en-GB", "fr", "de"]) {
test: engines =>
hasParams(engines, "Google", "searchbar", "client=firefox-b-oem2") &&
hasDefault(engines, "Google") &&
hasEnginesFirst(engines, ["Google"]),
hasEnginesFirst(engines, ["Google"]) &&
hasTelemetryId(engines, "Google", "google-sweetlabs"),
});
tests.push({
@ -465,7 +470,8 @@ for (const locale of ["en-US", "en-GB", "fr", "de"]) {
test: engines =>
hasParams(engines, "Google", "searchbar", "client=firefox-b-oem2") &&
hasDefault(engines, "Google") &&
hasEnginesFirst(engines, ["Google"]),
hasEnginesFirst(engines, ["Google"]) &&
hasTelemetryId(engines, "Google", "google-sweetlabs"),
});
}
@ -708,6 +714,18 @@ function hasParams(engines, engineName, purpose, param) {
return true;
}
function hasTelemetryId(engines, engineName, telemetryId) {
let engine = engines.find(e => e._name === engineName);
Assert.ok(engine, `Should be able to find ${engineName}`);
Assert.equal(
engine.telemetryId,
telemetryId,
"Should have the correct telemetryId"
);
return true;
}
function hasDefault(engines, expectedDefaultName) {
Assert.equal(
engines[0].name,