ckerr

#54698: chore: replace FakeLocationProvider with emulated geolocation in specs

Merged
Created: Oct 7, 2026, 12:39:24 PM
Merged: Oct 8, 2026, 9:22:54 PM
6 comments
Target: main

Description of Change

Make the geolocation spec "returns position when permission is granted" run on every build without depending on the network, and remove FakeLocationProvider, which existed only to mock geolocation in tests.

Before this change the test only ran on official builds.
Other builds replaced the system location provider with FakeLocationProvider, which always reports "Position unavailable."
On official builds the test queried the real network location service, which fails on CI with "Failed to query location from network service."
Upstream CI doesn't build official builds, so it never ran the test.

This change:

  • Sets the position with the DevTools Emulation.setGeolocationOverride command, through webContents.debugger.
  • Checks that the session's permission request handler saw the geolocation request, and that the emulated coordinates come back.
  • Removes FakeLocationProvider, the enable_fake_location_provider GN arg, the OVERRIDE_LOCATION_PROVIDER buildflag, the OverrideSystemLocationProvider() override, and the isFakeLocationProviderEnabled features binding.
  • Runs "returns error when permission is denied" on all builds. A denied request fails before any provider is queried, so it never needed the fake provider.

Non-official builds now use Chromium's default system location provider, the same as release builds. Release builds are unchanged.

Validation

Ran on a local Linux testing build from main:

  • e build passed with the fake provider removed.
  • e test --files spec/chromium.spec.ts -g "navigator.geolocation": 2 passed. That's this test plus "returns error when permission is denied".
  • As a control, before removing FakeLocationProvider, I removed the setGeolocationOverride call and the test failed with Position unavailable., so the override is what supplies the position.

🤖 Generated with Claude Code

Checklist

Release Notes

Notes: none

Backports

42-x-y
Pending
Waiting for a manual backport
43-x-y
Pending
Waiting for a manual backport
44-x-y
In-flight
PR Number
#54799
Waiting to be merged
45-x-y
Merged
PR Number
#54793
Merged At
Oct 8, 2026, 10:33:51 PM
Released In
Not yet
Release Date
Not yet

Semver Impact

Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.

Semantic Versioning helps users understand the impact of updates:

  • Major (X.y.z): Breaking changes that may require code modifications
  • Minor (x.Y.z): New features that maintain backward compatibility
  • Patch (x.y.Z): Bug fixes that don't change the API
  • None: Changes that don't affect using facing parts of Electron