#53938: test: isolate reporting API session
Description of Change
Found while investigating repeated Windows ARM64 test failures when running tests on a downstream Electron fork: reporting api sends a report for an intervention repeatedly exhausted its 30-second timeout and all automatic retries.
The test uses session.defaultSession, so it inherits reporting state from earlier activity and retries. Chromium sends immediately only when the session's delivery timer is not running, then starts a one-minute delivery interval. A report queued while that timer is active can therefore outlive the test's timeout. This is a test-isolation defect, not a reason to change runtime delivery behavior.
Use a fresh in-memory session for every test invocation, including retries, so delivery is independent of previous reporting activity. Also check the reported URL against the page URL rather than comparing it to itself. No runtime changes, longer timeouts, sleeps, or skips.
Validation:
- Native differential reproduction on Linux, Electron 46 nightly / Chromium 155: after priming the default session, the exact original test body delivered after 60,002 ms; five executions of the fixed body in the same process delivered in 48-63 ms each.
- Focused native Mocha spec passed with retries disabled; file-scoped JavaScript lint, pre-commit checks, and whitespace checks passed. The full suite was not run.
- Windows ARM64 has not been retested. The exact activity that primed reporting state in the downstream runs remains unconfirmed; the shared-session failure mechanism is reproduced locally.
Backport assessment: 45-x-y, 44-x-y, 43-x-y, and 42-x-y all contain the identical unfixed reporting suite and 30-second test timeout. Their pinned Chromium versions (155.0.8038.2, 152.0.7977.78, 150.0.7871.250, and 148.0.7778.280, respectively) all have the same delivery-timer gate and one-minute interval. The patch applies cleanly to all four branches; release-branch runtime testing remains for CI.
CC @mlaurencin
Checklist
- I have built and tested this change (test-only change, using the existing native build)
- I have filled out the PR description
- I have reviewed and verified the changes
-
npm testpasses (full suite not run; focused spec passed) - tests are changed or added
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