Closed Bug 1753449 Opened 4 years ago Closed 3 years ago

Add BrowserUtils test for shouldShowVPNPromo when an enterprise policy is active

Categories

(Firefox :: Messaging System, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
99 Branch
Iteration:
99.1 - Feb 7 - Feb 20
Tracking Status
firefox99 --- fixed

People

(Reporter: mviar, Assigned: mviar)

Details

Attachments

(1 file)

In Bug 1747149, the logic below was originally included in in toolkit/modules/tests/xpcshell/test_BrowserUtils.js's test_shouldShowVPNPromo test. Running it results in a Linux specific error where Services.appinfo.name is undefined when it's referenced in EnterprisePoliciesParent.jsm.

Investigate the cause of this error and find a way to mitigate it so we can test shouldShowVPNPromo when an enterprise policy is active.

  // set up an arbitrary enterprise policy
  await EnterprisePolicyTesting.setupPolicyEngineWithJson({
    policies: {
      EnableTrackingProtection: {
        Value: true,
      },
    },
  });

  // Don't show VPN if there's an active enterprise policy
  Assert.ok(!BrowserUtils.shouldShowVPNPromo());

  await EnterprisePolicyTesting.setupPolicyEngineWithJson(""); // revert changes to policies
Iteration: --- → 99.1 - Feb 7 - Feb 20
Priority: -- → P1
Assignee: nobody → mviar

Hi @kaply. We recently added some logic that checks for a active enterprise policies when determining whether to show VPN promos. Do you have any suggestions for investigating why Services.appinfo.name is undefined when it's referred to in this Linux specific logic in EnterprisePoliciesParent.jsm? It this case it was being called in the course of an xpcshell test (see above).

Flags: needinfo?(mozilla)

Service.appinfo.name is not defined by default for XPCShell tests.

You can add code similar to this to do that:

https://searchfox.org/mozilla-central/source/browser/components/enterprisepolicies/tests/xpcshell/head.js#24

Flags: needinfo?(mozilla)
Attachment #9263081 - Attachment description: WIP: Bug 1753449 - Add BrowserUtils test for shouldShowVPNPromo when an enterprise policy is active → Bug 1753449 - Add BrowserUtils test for shouldShowVPNPromo when an enterprise policy is active
Pushed by mviar@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2b6b1dd94000 Add BrowserUtils test for shouldShowVPNPromo when an enterprise policy is active r=Gijs

Backed out for causing xpcshell failures on test_BrowserUtils.js

Backout link

Push with failures

Failure log

Failure line(s): TEST-UNEXPECTED-TIMEOUT | toolkit/modules/tests/xpcshell/test_BrowserUtils.js | Test timed out

Flags: needinfo?(mviar)
Pushed by mviar@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1a12cffd1051 Add BrowserUtils test for shouldShowVPNPromo when an enterprise policy is active r=Gijs

I added a condition to skip policy related parts of the test when the platform is Android as policies aren't supported on that platform.

Flags: needinfo?(mviar)
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 99 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: