Skip to content

Commit

Permalink
Add an Automation section with WebDriver support to the spec
Browse files Browse the repository at this point in the history
Add WebDriver endpoints which allow manipulating virtual pressure sources,
which are pressure sources whose behavior and samples are entirelly
user-controlled. Also contrary to regular pressure sources, the provided
samples (or, in spec parlance, a virtual pressure source's latest sample's
data) are already PressureState instances rather than raw telemetry data
that will be transformed into an adjusted pressure state.

Caveats:
- Shared workers are unsupported at the moment (i.e. the WebDriver endpoints
  only have an effect on Window and DedicaredWorkerGlobalScope globals).
  Storing virtual pressure source information in a top-level traversable
  does not play well with shared workers, for which the concept is somewhat
  irrelevant.
  We need to think of a different solution in the future if support for
  shared workers is important.
- Once `PressureObserver.observe()` resolves, the same platform collector
  will be used until `disconnect()` or `unobserve()` are called. In other
  words, if a PressureObserver instance is active and using a real pressure
  source, adding a virtual pressure source of the same type will only have
  an effect on it and other instances in the same global once they all
  disconnect from the existing pressure source first.

In terms of changes to the existing algorithms and concepts:
- A top-level traversable has a mapping of source types to virtual pressure
  sources that is manipulated by the WebDriver endpoints.
- When creating a new platform collector, `PressureObserver.observe()` first
  attempts to use a virtual pressure source when one exists and can be used.
- The data collection algorithm distinguishes between the data format used
  by a virtual pressure source (which already is a PressureState) and by a
  real pressure source (which needs to be transformed into a PressureState).

Co-authored with @kenchris in #265. It was split off as a separate pull
request to make it easier to review and understand.

Fixes #282.
  • Loading branch information
rakuco committed Jun 14, 2024
1 parent 10b4251 commit 3f6a94b
Showing 1 changed file with 503 additions and 18 deletions.
Loading

0 comments on commit 3f6a94b

Please sign in to comment.