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

Consider ways of advancing virtual time #17489

Open
domenic opened this issue Jun 25, 2019 · 4 comments
Open

Consider ways of advancing virtual time #17489

domenic opened this issue Jun 25, 2019 · 4 comments

Comments

@domenic
Copy link
Member

domenic commented Jun 25, 2019

In C++ tests we have the ability to advance a virtual clock to test time-dependent things. In Web Platform Tests, e.g. testing default timeout behaviors or similar, we do not.

It's conceivable this virtual-clock infrastructure could be exposed as a test-only API. It would presumably affect setTimeout, Date.now, and various other related things.

The specific case that brought this up is wanting to test the default timeout for <std-toast> without actually waiting 3 seconds.

@stephenmcgruer
Copy link
Contributor

We now have 3 requests for this feature; for std-toast (which is no longer a thing so won't be needed...), for periodic background sync, and for service workers.

cc @jgraham as well

@noamr
Copy link
Contributor

noamr commented Apr 6, 2023

It would probably make performance API testing a lot simpler as well. Some of those tests are super tricky flakiness-wise because of the time aspect.

@dbaron
Copy link
Member

dbaron commented Apr 6, 2023

For an example of an existing mechanism that's similar to this, see these APIs on DOMWindowUtils that are used in a number of Gecko-internal mochitests. When I wrote them (for testing CSS animations, I think), I intended to hook them up to more sources of time than they're currently hooked up to (for example, in this bug), but never actually did so. (I wouldn't be surprised if hooking them up to more sources of time today might break some of the existing tests that use them.)

@wanderview
Copy link
Member

This would be useful for testing privacy features that clear state based on a timer; e.g. bounce tracking mitigations. Without the ability to advance time we basically cannot write WPT tests for this kind of feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants