зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1676241 - Fix usage of ExperimentAPI in TelemetryFeed r=nanj
Differential Revision: https://phabricator.services.mozilla.com/D96460
This commit is contained in:
Родитель
297ab08c2d
Коммит
f6d99002c8
|
@ -323,7 +323,7 @@ this.TelemetryFeed = class TelemetryFeed {
|
|||
get isInCFRCohort() {
|
||||
try {
|
||||
const experimentData = ExperimentAPI.getExperiment({
|
||||
group: "cfr",
|
||||
featureId: "cfr",
|
||||
});
|
||||
if (experimentData && experimentData.slug) {
|
||||
return true;
|
||||
|
|
|
@ -13,6 +13,9 @@ const { ExperimentAPI } = ChromeUtils.import(
|
|||
const { ExperimentFakes } = ChromeUtils.import(
|
||||
"resource://testing-common/MSTestUtils.jsm"
|
||||
);
|
||||
const { TelemetryFeed } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/TelemetryFeed.jsm"
|
||||
);
|
||||
|
||||
const EXPERIMENT_PAYLOAD = ExperimentFakes.recipe("test_xman_cfr", {
|
||||
id: "xman_test_message",
|
||||
|
@ -158,6 +161,12 @@ add_task(async function test_loading_experimentsAPI() {
|
|||
"ExperimentAPI should return an experiment"
|
||||
);
|
||||
|
||||
const telemetryFeedInstance = new TelemetryFeed();
|
||||
Assert.ok(
|
||||
telemetryFeedInstance.isInCFRCohort,
|
||||
"Telemetry should return true"
|
||||
);
|
||||
|
||||
// Reload the provider
|
||||
await ASRouter._updateMessageProviders();
|
||||
// Wait to load the messages from the messaging-experiments provider
|
||||
|
|
|
@ -1896,6 +1896,11 @@ describe("TelemetryFeed", () => {
|
|||
});
|
||||
|
||||
assert.ok(instance.isInCFRCohort);
|
||||
assert.propertyVal(
|
||||
ExperimentAPI.getExperiment.firstCall.args[0],
|
||||
"featureId",
|
||||
"cfr"
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче