diff --git a/index.html b/index.html index e41190f..8c616fa 100644 --- a/index.html +++ b/index.html @@ -257,7 +257,8 @@

Sampling and Reporting Rate

+
+

+ Automation +

+

+ The Compute Pressure API poses a challenge to test authors, as fully + exercising interface requires physical hardware devices that respond in + predictable ways. +

+

+ To address this challenge this document defines a [[!WEBDRIVER2]] [=extension + commands=] that allows defining and controlling virtual pressure sources that behave + like real ones and which can have particular properties and whose readings can be + entirely defined by users. +

+

+ Virtual Pressure Source +

+

+ A virtual pressure source is a [=pressure source=] that + simulates the behavior of a real one in controlled ways. It reports + pressure changes to zero or more [=platform collectors=] connected to it. +

+

+ Contrary to a real [=pressure source=], however, it reports [=pressure + state=] values directly instead of [=implementation-defined=] values that + must be processed into [=pressure states=] by a [=platform collector=]. In + other words, a [=virtual pressure source=]'s [=pressure source sample=]'s + [=pressure source sample/data=] is a {{PressureState}}. +

+

+ In addition to the data associated with all [=pressure sources=] (such as + [=pressure source sample=]), each [=virtual pressure source=] has: +

+

+

+ Each [=top-level traversable=] has a virtual pressure source mapping, which is an [=ordered map=] of + [=source types=] to [=virtual pressure source=]. +

+ + +

+ Extension Commands +

+

+ Create virtual pressure source +

+ + + + + + + + + +
+ HTTP Method + + [=extension command URI Template|URI Template=] +
+ POST + + /session/{session id}/pressuresource +
+

+ This [=extension command=] creates a new [=virtual pressure source=] of a specified + [=source type=]. Calls to {{PressureObserver/observe()}} from {{PressureObserver}} instances + of the same [=source type=] will cause this [=virtual pressure source=] to be used as their + backing [=pressure source=] until [[[#delete-virtual-pressure-source]]] is run. +

+ + + + + + + + + + + + + + + + + +
+ Properties of the parameters argument used by this algorithm +
+ Parameter name + + Value type + + Required +
+ type + + String + + yes +
+ supported + + Boolean + + no +
+

+ The [=remote end steps=] given |session|, |URL variables| and |parameters| are: +

+
    +
  1. + Let |virtualPressureSourceType| be the result of invoking + get a property "type" from |parameters|. +
  2. +
  3. + If the [=user agent=]'s [=supported source types=] does not + [=list/contain=] |virtualPressureSourceType|, return [=error=] with + [=error code|WebDriver error code=] [=invalid argument=]. +
  4. +
  5. + Let |topLevelTraversable| be the current browsing + context's [=browsing context/top-level traversable=]. +
  6. +
  7. + Let |topLevelVirtualPressureSourceMapping| be the |topLevelTraversable|'s [=virtual pressure source mapping=]. +
  8. +
  9. + If |topLevelVirtualPressureSourceMapping| contains |virtualPressureSourceType|, return [=error=] with + [=error code|WebDriver error code=] [=invalid argument=]. +
  10. +
  11. + Let |supported| be the result of invoking get a + property with default + with "supported" and true from |parameters|. +
  12. +
  13. + Let |virtualPressureSource| be a new [=virtual pressure source=]. +
  14. +
  15. + Set |virtualPressureSource|'s [=virtual pressure source/can provide + samples=] to |supported|. +
  16. +
  17. + Set |topLevelVirtualPressureSourceMapping|[|virtualPressureSourceType|] to |virtualPressureSource|. +
  18. +
  19. + Return [=success=] with data null. +
  20. +
+

+ Delete virtual pressure source +

+ + + + + + + + + +
+ HTTP Method + + [=extension command URI Template|URI Template=] +
+ DELETE + + /session/{session id}/pressuresource/{type} +
+

+ This [=extension command=] deletes a given [=virtual pressure source=], meaning that, + if available, data for the given [=source type=] will be delivered the regular way, by non-virtual means. +

+

+ The [=remote end steps=] given |session|, |URL variables| and |parameters| are: +

+
    +
  1. + Let |virtualPressureSourceType| be the value of the |URL variables|["type"]. +
  2. +
  3. + If the [=user agent=]'s [=supported source types=] does not + [=list/contain=] |virtualPressureSourceType|, return [=error=] with + [=error code|WebDriver error code=] [=invalid argument=]. +
  4. +
  5. + Let |topLevelTraversable| be the current browsing + context's [=browsing context/top-level traversable=]. +
  6. +
  7. + Let |topLevelVirtualPressureSourceMapping| be the |topLevelTraversable|'s [=virtual pressure source mapping=]. +
  8. +
  9. + Let |pressureSource| be |topLevelVirtualPressureSourceMapping|[|virtualPressureSourceType|]. +
  10. +
  11. + [=set/For each=] |platformCollector| of |pressureSource|'s [=virtual + pressure source/connected platform collectors=]: +
      +
    1. + Set |platformCollector|'s [=platform collector/associated pressure + source=] to null. +
    2. +
    +
  12. +
  13. + [=map/Remove=] |topLevelVirtualPressureSourceMapping|[|virtualPressureSourceType|]. +
  14. +
  15. + Return [=success=] with data null. +
  16. +
+ +

+ Update virtual pressure source +

+ + + + + + + + + +
+ HTTP Method + + [=extension command URI Template|URI Template=] +
+ POST + + /session/{session id}/pressuresource/{type} +
+

+ This [=extension command=] allows updating the state of a [=virtual pressure source=] by pushing + a new [=pressure source sample=]. +

+ + + + + + + + + + + + + +
+ Properties of the parameters argument used by this algorithm +
+ Parameter name + + Value type + + Required +
+ sample + + {{PressureState}} + + yes +
+

+ The [=remote end steps=] given |session|, |URL variables| and |parameters| are: +

+
    +
  1. + Let |virtualPressureSourceType| be the value of the |URL variables|["type"]. +
  2. +
  3. + If the [=user agent=]'s [=supported source types=] does not + [=list/contain=] |virtualPressureSourceType|, return [=error=] with + [=error code|WebDriver error code=] [=invalid argument=]. +
  4. +
  5. + Let |topLevelTraversable| be the current browsing + context's [=browsing context/top-level traversable=]. +
  6. +
  7. + Let |topLevelVirtualPressureSourceMapping| be the |topLevelTraversable|'s [=virtual pressure source mapping=]. +
  8. +
  9. + If |topLevelVirtualPressureSourceMapping| does not [=map/contain=] |virtualPressureSource|, + return [=error=] with [=error code|WebDriver error code=] + unsupported operation. +
  10. +
  11. + Let |virtualPressureSource| be |topLevelVirtualPressureSourceMapping|[|virtualPressureSourceType|]. +
  12. +
  13. + Let |sample| be the result of invoking + get a property "sample" from |parameters|. +
  14. +
  15. + If |sample| is not of type {{PressureState}}, return [=error=] with [=error code|WebDriver error code=] [=invalid argument=]. +
  16. +
  17. + Set |virtualPressureSource|'s [=pressure source/latest sample=] to a new + [=pressure source sample=] whose [=pressure source sample/data=] is + |sample| and [=pressure source sample/timestamp=] is the [=unsafe shared + current time=]. +
  18. +
  19. + In an [=implementation-defined=] way, make |virtualPressureSource|'s + [=pressure source/latest sample=] available to |virtualPressureSource|'s + [=virtual pressure source/connected platform collectors=]. +
  20. +
  21. + Return [=success=] with data null. +
  22. +
+