#54698: chore: replace FakeLocationProvider with emulated geolocation in specs
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.setGeolocationOverridecommand, throughwebContents.debugger. - Checks that the session's permission request handler saw the
geolocationrequest, and that the emulated coordinates come back. - Removes
FakeLocationProvider, theenable_fake_location_providerGN arg, theOVERRIDE_LOCATION_PROVIDERbuildflag, theOverrideSystemLocationProvider()override, and theisFakeLocationProviderEnabledfeatures 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 buildpassed 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 thesetGeolocationOverridecall and the test failed withPosition unavailable., so the override is what supplies the position.
🤖 Generated with Claude Code
Checklist
- I have built and tested this change
- I have filled out the PR description
- I have reviewed and verified the changes
-
npm testpasses - tests are changed or added
- PR release notes describe the change in a way relevant to app developers, and are capitalized, punctuated, past tense, and no longer than 80 characters.
Release Notes
Notes: none
Backports
Semver Impact
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