Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix slow downloadFile test by stubbing URL.createObjectURL #6707

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

robertknight
Copy link
Member

This test was often reported as slow (>1000ms) when running the whole test suite. Measuring timing showed that most of the delay was in the first URL.createObjectURL call. The issue did not reproduce when running only the downloadFile tests. If changing the order in which different file types are tested, the slowness still only occurred on the first call, so isn't related to a particular file type. https://issues.chromium.org/issues/40269900 notes that this call involves a synchronous IPC call between renderer and browser process, so the issue may just be that the browser process is busier when the full suite runs.

As createObjectURL has a simple signature, I think we can get away with just stubbing it.

This test was often reported as slow (>1000ms) when running the whole test
suite. Measuring timing showed that most of the delay was in the first
`URL.createObjectURL` call. The issue did not reproduce when running only the
`downloadFile` tests. If changing the order in which different file types are
tested, the slowness still only occurred on the first call, so isn't related to
a particular file type. https://issues.chromium.org/issues/40269900 notes that
this call involves a synchronous IPC call between renderer and browser process,
so the issue may just be that the browser process is busier when the full suite
runs.

As `createObjectURL` has a simple signature, I think we can get away with
just stubbing it.
Copy link

codecov bot commented Dec 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.43%. Comparing base (c738173) to head (d8c68e7).
Report is 9 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6707   +/-   ##
=======================================
  Coverage   99.43%   99.43%           
=======================================
  Files         271      271           
  Lines       10215    10215           
  Branches     2434     2434           
=======================================
  Hits        10157    10157           
  Misses         58       58           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@robertknight robertknight merged commit dc53ad7 into main Dec 10, 2024
4 checks passed
@robertknight robertknight deleted the stub-createobjecturl branch December 10, 2024 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants