From a90a5cba08fdf6c0ceb95101c275108a152a3aed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:35:37 +0200 Subject: Merging upstream version 127.0. Signed-off-by: Daniel Baumann --- .../tests/browser/browser_asrouter_infobar.js | 8 +-- .../tests/browser/browser_asrouter_targeting.js | 63 ++++++++-------------- .../asrouter/tests/unit/CFRMessageProvider.test.js | 25 +-------- .../asrouter/tests/unit/RemoteL10n.test.js | 2 - 4 files changed, 27 insertions(+), 71 deletions(-) (limited to 'browser/components/asrouter/tests') diff --git a/browser/components/asrouter/tests/browser/browser_asrouter_infobar.js b/browser/components/asrouter/tests/browser/browser_asrouter_infobar.js index b80b3ec7a4..a01b2cf14c 100644 --- a/browser/components/asrouter/tests/browser/browser_asrouter_infobar.js +++ b/browser/components/asrouter/tests/browser/browser_asrouter_infobar.js @@ -107,7 +107,7 @@ add_task(async function react_to_trigger() { "Notification has default priority" ); // Dismiss the notification - notificationStack.currentNotification.closeButtonEl.click(); + notificationStack.currentNotification.closeButton.click(); }); add_task(async function dismiss_telemetry() { @@ -128,7 +128,7 @@ add_task(async function dismiss_telemetry() { // Remove any IMPRESSION pings dispatchStub.reset(); - infobar.notification.closeButtonEl.click(); + infobar.notification.closeButton.click(); await BrowserTestUtils.waitForCondition( () => infobar.notification === null, @@ -204,7 +204,7 @@ add_task(async function prevent_multiple_messages() { Assert.equal(dispatchStub.callCount, 2, "Impression count did not increase"); // Dismiss the first notification - infobar.notification.closeButtonEl.click(); + infobar.notification.closeButton.click(); Assert.equal(InfoBar._activeInfobar, null, "Cleared the active notification"); // Reset impressions count @@ -218,6 +218,6 @@ add_task(async function prevent_multiple_messages() { Assert.ok(InfoBar._activeInfobar, "activeInfobar is set"); Assert.equal(dispatchStub.callCount, 2, "Called twice with IMPRESSION"); // Dismiss the notification again - infobar.notification.closeButtonEl.click(); + infobar.notification.closeButton.click(); Assert.equal(InfoBar._activeInfobar, null, "Cleared the active notification"); }); diff --git a/browser/components/asrouter/tests/browser/browser_asrouter_targeting.js b/browser/components/asrouter/tests/browser/browser_asrouter_targeting.js index 55f278fd7d..e20a75c5ab 100644 --- a/browser/components/asrouter/tests/browser/browser_asrouter_targeting.js +++ b/browser/components/asrouter/tests/browser/browser_asrouter_targeting.js @@ -1226,47 +1226,6 @@ add_task(async function check_userPrefersReducedMotion() { ); }); -add_task(async function test_mr2022Holdback() { - await ExperimentAPI.ready(); - - ok( - !ASRouterTargeting.Environment.inMr2022Holdback, - "Should not be in holdback (no experiment)" - ); - - { - const doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({ - featureId: "majorRelease2022", - value: { - onboarding: true, - }, - }); - - ok( - !ASRouterTargeting.Environment.inMr2022Holdback, - "Should not be in holdback (onboarding = true)" - ); - - await doExperimentCleanup(); - } - - { - const doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({ - featureId: "majorRelease2022", - value: { - onboarding: false, - }, - }); - - ok( - ASRouterTargeting.Environment.inMr2022Holdback, - "Should be in holdback (onboarding = false)" - ); - - await doExperimentCleanup(); - } -}); - add_task(async function test_distributionId() { is( ASRouterTargeting.Environment.distributionId, @@ -1469,6 +1428,28 @@ add_task(async function check_useEmbeddedMigrationWizard() { ok(!(await ASRouterTargeting.Environment.useEmbeddedMigrationWizard)); }); +add_task(async function check_isMSIX() { + is( + typeof ASRouterTargeting.Environment.isMSIX, + "boolean", + "Should return a boolean" + ); + if (AppConstants.platform !== "win") { + is( + ASRouterTargeting.Environment.isMSIX, + false, + "Should always be false on non-Windows" + ); + return; + } + + is( + ASRouterTargeting.Environment.isMSIX, + Services.sysinfo.getProperty("hasWinPackageId"), + "Should match the value from sysinfo" + ); +}); + add_task(async function check_isRTAMO() { is( typeof ASRouterTargeting.Environment.isRTAMO, diff --git a/browser/components/asrouter/tests/unit/CFRMessageProvider.test.js b/browser/components/asrouter/tests/unit/CFRMessageProvider.test.js index fe6959852c..ec35806d11 100644 --- a/browser/components/asrouter/tests/unit/CFRMessageProvider.test.js +++ b/browser/components/asrouter/tests/unit/CFRMessageProvider.test.js @@ -1,32 +1,9 @@ import { CFRMessageProvider } from "modules/CFRMessageProvider.sys.mjs"; -const REGULAR_IDS = [ - "FACEBOOK_CONTAINER", - "GOOGLE_TRANSLATE", - "YOUTUBE_ENHANCE", - // These are excluded for now. - // "WIKIPEDIA_CONTEXT_MENU_SEARCH", - // "REDDIT_ENHANCEMENT", -]; - describe("CFRMessageProvider", () => { let messages; beforeEach(async () => { messages = await CFRMessageProvider.getMessages(); }); - it("should have a total of 11 messages", () => { - assert.lengthOf(messages, 11); - }); - it("should have one message each for the three regular addons", () => { - for (const id of REGULAR_IDS) { - const cohort3 = messages.find(msg => msg.id === `${id}_3`); - assert.ok(cohort3, `contains three day cohort for ${id}`); - assert.deepEqual( - cohort3.frequency, - { lifetime: 3 }, - "three day cohort has the right frequency cap" - ); - assert.notInclude(cohort3.targeting, `providerCohorts.cfr`); - } - }); + it("should have messages", () => assert.ok(messages.length)); }); diff --git a/browser/components/asrouter/tests/unit/RemoteL10n.test.js b/browser/components/asrouter/tests/unit/RemoteL10n.test.js index dd0f858750..0e32442522 100644 --- a/browser/components/asrouter/tests/unit/RemoteL10n.test.js +++ b/browser/components/asrouter/tests/unit/RemoteL10n.test.js @@ -81,7 +81,6 @@ describe("RemoteL10n", () => { "branding/brand.ftl", "browser/defaultBrowserNotification.ftl", "browser/newtab/asrouter.ftl", - "toolkit/branding/accounts.ftl", "toolkit/branding/brandings.ftl", ]); assert.isFalse(args[1]); @@ -103,7 +102,6 @@ describe("RemoteL10n", () => { "branding/brand.ftl", "browser/defaultBrowserNotification.ftl", "browser/newtab/asrouter.ftl", - "toolkit/branding/accounts.ftl", "toolkit/branding/brandings.ftl", ]); assert.isFalse(args[1]); -- cgit v1.2.3