-
Notifications
You must be signed in to change notification settings - Fork 59
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
Rewrite the Automation section and redefine the spec's extension commands #470
Conversation
…ands The previous version from #369 and #377 was never implemented by any engines, and the language it used made it hard to actually implement and use in tests (such as those already present in web-platform-tests). For example: - Mock sensors acted like a mix of device sensors and platform sensors, and the distinction was not entirely clear. - Mock sensors had a separate readings map that never really integrated with the "latest reading" concept used in the abstract operations. - The language in the "Create mock sensor" extension command did not make it clear if it was attempting to create Sensor objects or hand-wavingly change existing Sensor objects' associated platform sensor. - Implementing the custom WebDriver error codes specified here was not trivial and did not bring much extra benefit (other specifications refrain from doing it as well). - Calling "convert to an IDL value" to convert JSON Objects to a platform version is not always trivial to implement since it actually requires a lot of extra WebIDL processing steps that are not really needed here. The new version uses more precise language in the algorithms and properly integrates into the existing abstract operations. It has also been verified to work with Chromium, ChromeDriver and the required changes to web-platform-tests. "Mock sensors" are now called "virtual sensors" to follow the same terminology adopted by the WebAuthn spec. Conceptually, they are now defined as device sensors and therefore always exist at a layer below a platform sensor. This clears up ambiguities and delimits what is expected of platform sensors and what can actually be influenced by a virtual sensor. Some auxiliary concepts also had to be defined, both of which are expected to be set by extension specifications: - "Virtual sensor metadata" is a struct with a sensor type and an algorithm to parse the readings sent to the "update virtual sensor reading" extension command. - "Per-type virtual sensor metadata" is a mapping of strings to virtual sensor metadata instances. This allows us to get rid of MockSensorType, as the keys are then used to identify a given sensor type in the WebDriver extension commands and each specification defines one or more keys. The same virtual sensors are used by all navigables that have the same top-level traversable. In other words, all iframes under the same main frame, regardless of their origin, share the same virtual sensors. Not only does this match the behavior of real, hardware-based sensors more closely, but it also helps with a limitation in web-platform-tests' testdriver.js that only allows WebDriver communication to go through the page that creates the test harness.
@reillyeon the cleanup pull requests I've been sending have also helped pave the way for this one, as I needed some clear concepts I could hook into for this to work. Overall, there was a change in terminology (s/mock/virtual/) and the virtual sensors are treated like device sensors. The rest is of the PR contains more precise algorithms for the extension commands + changes to the main operations so that they integrate with virtual sensors. |
@reillyeon I was wondering if you've had time to take a look at this one? I was hoping to land this PR before TPAC to send the corresponding web-platform-tests changes and ask reviewers to look at them during TPAC if necessary. |
Co-authored-by: Reilly Grant <reillyeon@users.noreply.github.com>
Spec PR: w3c/sensors#470 The Generic Sensor spec used to have an Automation section, but it leaked implementation-specific details and was not implemented anywhere. The changes above have been implemented in Chromium and there are pending patches there to convert the existing Generic Sensor web tests in WPT to the new virtual sensor model, which entirely removes the dependency on Mojo mocks and makes the tests more interoperable. This PR adds the required infrastructure to manipulate virtual sensors from testdriver. The 4 new commands correspond to the 4 WebDriver extension commands added by the spec PR above. This change was co-authored with @JuhaVainio. Related to web-platform-tests#9686.
Spec PR: w3c/sensors#470 The Generic Sensor spec used to have an Automation section, but it leaked implementation-specific details and was not implemented anywhere. The changes above have been implemented in Chromium and there are pending patches there to convert the existing Generic Sensor web tests in WPT to the new virtual sensor model, which entirely removes the dependency on Mojo mocks and makes the tests more interoperable. This PR adds the required infrastructure to manipulate virtual sensors from testdriver. The 4 new commands correspond to the 4 WebDriver extension commands added by the spec PR above. This change was co-authored with @JuhaVainio. Related to web-platform-tests#9686.
Spec PR: w3c/sensors#470 The Generic Sensor spec used to have an Automation section, but it leaked implementation-specific details and was not implemented anywhere. The changes above have been implemented in Chromium and there are pending patches there to convert the existing Generic Sensor web tests in WPT to the new virtual sensor model, which entirely removes the dependency on Mojo mocks and makes the tests more interoperable. This PR adds the required infrastructure to manipulate virtual sensors from testdriver. The 4 new commands correspond to the 4 WebDriver extension commands added by the spec PR above. This change was co-authored with @JuhaVainio. Related to web-platform-tests#9686.
Spec PR: w3c/sensors#470 The Generic Sensor spec used to have an Automation section, but it leaked implementation-specific details and was not implemented anywhere. The changes above have been implemented in Chromium and there are pending patches there to convert the existing Generic Sensor web tests in WPT to the new virtual sensor model, which entirely removes the dependency on Mojo mocks and makes the tests more interoperable. This PR adds the required infrastructure to manipulate virtual sensors from testdriver. The 4 new commands correspond to the 4 WebDriver extension commands added by the spec PR above. This change was co-authored with @JuhaVainio. Related to web-platform-tests#9686.
@reillyeon friendly ping |
Thank you! |
Spec PR: w3c/sensors#470 The Generic Sensor spec used to have an Automation section, but it leaked implementation-specific details and was not implemented anywhere. The changes above have been implemented in Chromium and there are pending patches there to convert the existing Generic Sensor web tests in WPT to the new virtual sensor model, which entirely removes the dependency on Mojo mocks and makes the tests more interoperable. This PR adds the required infrastructure to manipulate virtual sensors from testdriver. The 4 new commands correspond to the 4 WebDriver extension commands added by the spec PR above. This change was co-authored with @JuhaVainio. Related to web-platform-tests#9686.
Spec PR: w3c/sensors#470 The Generic Sensor spec used to have an Automation section, but it leaked implementation-specific details and was not implemented anywhere. The changes above have been implemented in Chromium and there are pending patches there to convert the existing Generic Sensor web tests in WPT to the new virtual sensor model, which entirely removes the dependency on Mojo mocks and makes the tests more interoperable. This PR adds the required infrastructure to manipulate virtual sensors from testdriver. The 4 new commands correspond to the 4 WebDriver extension commands added by the spec PR above. This change was co-authored with @JuhaVainio. Related to web-platform-tests#9686.
Spec PR: w3c/sensors#470 The Generic Sensor spec used to have an Automation section, but it leaked implementation-specific details and was not implemented anywhere. The changes above have been implemented in Chromium and there are pending patches there to convert the existing Generic Sensor web tests in WPT to the new virtual sensor model, which entirely removes the dependency on Mojo mocks and makes the tests more interoperable. This PR adds the required infrastructure to manipulate virtual sensors from testdriver. The 4 new commands correspond to the 4 WebDriver extension commands added by the spec PR above. This change was co-authored with @JuhaVainio. Related to web-platform-tests#9686.
Spec PR: w3c/sensors#470 The Generic Sensor spec used to have an Automation section, but it leaked implementation-specific details and was not implemented anywhere. The changes above have been implemented in Chromium and there are pending patches there to convert the existing Generic Sensor web tests in WPT to the new virtual sensor model, which entirely removes the dependency on Mojo mocks and makes the tests more interoperable. This PR adds the required infrastructure to manipulate virtual sensors from testdriver. The 4 new commands correspond to the 4 WebDriver extension commands added by the spec PR above. This change was co-authored with @JuhaVainio. Related to web-platform-tests#9686.
The Automation section in the Generic Sensor API specification was rewritten and several terms and concepts have changed. This commit adapts the Gyroscope spec to the changes: * Remove references to "mock sensor type", "mock sensor reading values" and the "MockSensorType" enum. * Define an entry in the per-type virtual sensor metadata map whose key is what used to be the "gyroscope" entry in MockSensorType and an appropriate virtual sensor metadata entry. This is enough to integrate properly with the Generic Sensor spec and allow Gyroscope virtual sensors to be created and used. Fixes w3c#51.
The Automation section in the Generic Sensor API specification was rewritten and several terms and concepts have changed. This commit adapts the Gyroscope spec to the changes: * Remove references to "mock sensor type", "mock sensor reading values" and the "MockSensorType" enum. * Define an entry in the per-type virtual sensor metadata map whose key is what used to be the "gyroscope" entry in MockSensorType and an appropriate virtual sensor metadata entry. This is enough to integrate properly with the Generic Sensor spec and allow Gyroscope virtual sensors to be created and used. Fixes w3c#51.
The Automation section in the Generic Sensor API specification was rewritten and several terms and concepts have changed. This commit adapts the Ambient Light Sensor spec to the changes: * Remove references to "mock sensor type", "mock sensor reading values" and the "MockSensorType" enum. * Define an entry in the per-type virtual sensor metadata map whose key is what used to be the "ambient-light" entry in MockSensorType and an appropriate virtual sensor metadata entry. This is enough to integrate properly with the Generic Sensor spec and allow Ambient Light virtual sensors to be created and used. Fixes w3c#86.
Rewrite Automation section after w3c/sensors#470
The Automation section in the Generic Sensor API specification was rewritten and several terms and concepts have changed. This commit adapts the Ambient Light Sensor spec to the changes: * Remove references to "mock sensor type", "mock sensor reading values" and the "MockSensorType" enum. * Define an entry in the per-type virtual sensor metadata map whose key is what used to be the "ambient-light" entry in MockSensorType and an appropriate virtual sensor metadata entry. This is enough to integrate properly with the Generic Sensor spec and allow Ambient Light virtual sensors to be created and used. Fixes w3c#86.
The Automation section in the Generic Sensor API specification was rewritten and several terms and concepts have changed. This commit adapts the Ambient Light Sensor spec to the changes: * Remove references to "mock sensor type", "mock sensor reading values" and the "MockSensorType" enum. * Define an entry in the per-type virtual sensor metadata map whose key is what used to be the "ambient-light" entry in MockSensorType and an appropriate virtual sensor metadata entry. This is enough to integrate properly with the Generic Sensor spec and allow Ambient Light virtual sensors to be created and used. Fixes w3c#86.
The Automation section in the Generic Sensor API specification was rewritten and several terms and concepts have changed. This commit adapts the Ambient Light Sensor spec to the changes: * Remove references to "mock sensor type", "mock sensor reading values" and the "MockSensorType" enum. * Define an entry in the per-type virtual sensor metadata map whose key is what used to be the "ambient-light" entry in MockSensorType and an appropriate virtual sensor metadata entry. This is enough to integrate properly with the Generic Sensor spec and allow Ambient Light virtual sensors to be created and used. Fixes w3c#86.
…rences Rewrite Automation section after w3c/sensors#470
Spec PR: w3c/sensors#470 The Generic Sensor spec used to have an Automation section, but it leaked implementation-specific details and was not implemented anywhere. The changes above have been implemented in Chromium and there are pending patches there to convert the existing Generic Sensor web tests in WPT to the new virtual sensor model, which entirely removes the dependency on Mojo mocks and makes the tests more interoperable. This PR adds the required infrastructure to manipulate virtual sensors from testdriver. The 4 new commands correspond to the 4 WebDriver extension commands added by the spec PR above. This change was co-authored with @JuhaVainio. Related to #9686.
The Automation section in the Generic Sensor API specification was rewritten and several terms and concepts have changed. This commit adapts the Orientation Sensor spec to the changes: * Remove references to "mock sensor type", "mock sensor reading values" and the "MockSensorType" enum. * Define an entry in the per-type virtual sensor metadata map whose key is what used to be the "absolute-orientation" or "relative-orientation" entry in MockSensorType and an appropriate virtual sensor metadata entry. This is enough to integrate properly with the Generic Sensor spec and allow Orientation virtual sensors to be created and used. Fixes w3c#77.
The Automation section in the Generic Sensor API specification was rewritten and several terms and concepts have changed. This commit adapts the Geolocation Sensor spec to the changes: * Remove references to "mock sensor type", "mock sensor reading values" and the "MockSensorType" enum. * Define an entry in the per-type virtual sensor metadata map whose key is what used to be the "geolocation" entry in MockSensorType and an appropriate virtual sensor metadata entry. This is enough to integrate properly with the Generic Sensor spec and allow Geolocation virtual sensors to be created and used. Fixes w3c#55.
The Automation section in the Generic Sensor API specification was rewritten and several terms and concepts have changed. This commit adapts the Magnetometer Sensor spec to the changes: Remove references to "mock sensor type", "mock sensor reading values" and the "MockSensorType" enum. Define an entry in the per-type virtual sensor metadata map whose key is what used to be the "magnetometer" or "uncalibrated-magnetometer" entry in MockSensorType and an appropriate virtual sensor metadata entry. This is enough to integrate properly with the Generic Sensor spec and allow Magnetometer and Uncalibrated Magnetometer virtual sensors to be created and used. Fixes w3c#65.
The Automation section in the Generic Sensor API specification was rewritten and several terms and concepts have changed. This commit adapts the Proximity Sensor spec to the changes: Remove references to "mock sensor type", "mock sensor reading values" and the "MockSensorType" enum. Define an entry in the per-type virtual sensor metadata map whose key is what used to be the "proximity" entry in MockSensorType and an appropriate virtual sensor metadata entry. This is enough to integrate properly with the Generic Sensor spec and allow Proximity virtual sensors to be created and used. Fixes w3c#56.
The Automation section in the Generic Sensor API specification was rewritten and several terms and concepts have changed. This commit adapts the Orientation Sensor spec to the changes: * Remove references to "mock sensor type", "mock sensor reading values" and the "MockSensorType" enum. * Define an entry in the per-type virtual sensor metadata map whose key is what used to be the "absolute-orientation" or "relative-orientation" entry in MockSensorType and an appropriate virtual sensor metadata entry. This is enough to integrate properly with the Generic Sensor spec and allow Orientation virtual sensors to be created and used. Fixes #77.
SHA: aff9350 Reason: push, by rakuco Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…rences Rewrite Automation section after w3c/sensors#470
…rences Rewrite Automation section after w3c/sensors#470
…rences Rewrite Automation section after w3c/sensors#470
…ands to testdriver, a=testonly Automatic update from web-platform-tests sensors: Add virtual sensor-related commands to testdriver (#41906) Spec PR: w3c/sensors#470 The Generic Sensor spec used to have an Automation section, but it leaked implementation-specific details and was not implemented anywhere. The changes above have been implemented in Chromium and there are pending patches there to convert the existing Generic Sensor web tests in WPT to the new virtual sensor model, which entirely removes the dependency on Mojo mocks and makes the tests more interoperable. This PR adds the required infrastructure to manipulate virtual sensors from testdriver. The 4 new commands correspond to the 4 WebDriver extension commands added by the spec PR above. This change was co-authored with @JuhaVainio. Related to #9686. -- wpt-commits: 52115b2fd161d1c1c081b56262937a3d67839133 wpt-pr: 41906
…ands to testdriver, a=testonly Automatic update from web-platform-tests sensors: Add virtual sensor-related commands to testdriver (#41906) Spec PR: w3c/sensors#470 The Generic Sensor spec used to have an Automation section, but it leaked implementation-specific details and was not implemented anywhere. The changes above have been implemented in Chromium and there are pending patches there to convert the existing Generic Sensor web tests in WPT to the new virtual sensor model, which entirely removes the dependency on Mojo mocks and makes the tests more interoperable. This PR adds the required infrastructure to manipulate virtual sensors from testdriver. The 4 new commands correspond to the 4 WebDriver extension commands added by the spec PR above. This change was co-authored with @JuhaVainio. Related to #9686. -- wpt-commits: 52115b2fd161d1c1c081b56262937a3d67839133 wpt-pr: 41906
…ands to testdriver, a=testonly Automatic update from web-platform-tests sensors: Add virtual sensor-related commands to testdriver (#41906) Spec PR: w3c/sensors#470 The Generic Sensor spec used to have an Automation section, but it leaked implementation-specific details and was not implemented anywhere. The changes above have been implemented in Chromium and there are pending patches there to convert the existing Generic Sensor web tests in WPT to the new virtual sensor model, which entirely removes the dependency on Mojo mocks and makes the tests more interoperable. This PR adds the required infrastructure to manipulate virtual sensors from testdriver. The 4 new commands correspond to the 4 WebDriver extension commands added by the spec PR above. This change was co-authored with JuhaVainio. Related to #9686. -- wpt-commits: 52115b2fd161d1c1c081b56262937a3d67839133 wpt-pr: 41906 UltraBlame original commit: 0838abe0dccb344e5949267d8e25986191c55fc2
…ands to testdriver, a=testonly Automatic update from web-platform-tests sensors: Add virtual sensor-related commands to testdriver (#41906) Spec PR: w3c/sensors#470 The Generic Sensor spec used to have an Automation section, but it leaked implementation-specific details and was not implemented anywhere. The changes above have been implemented in Chromium and there are pending patches there to convert the existing Generic Sensor web tests in WPT to the new virtual sensor model, which entirely removes the dependency on Mojo mocks and makes the tests more interoperable. This PR adds the required infrastructure to manipulate virtual sensors from testdriver. The 4 new commands correspond to the 4 WebDriver extension commands added by the spec PR above. This change was co-authored with JuhaVainio. Related to #9686. -- wpt-commits: 52115b2fd161d1c1c081b56262937a3d67839133 wpt-pr: 41906 UltraBlame original commit: 0838abe0dccb344e5949267d8e25986191c55fc2
…ands to testdriver, a=testonly Automatic update from web-platform-tests sensors: Add virtual sensor-related commands to testdriver (#41906) Spec PR: w3c/sensors#470 The Generic Sensor spec used to have an Automation section, but it leaked implementation-specific details and was not implemented anywhere. The changes above have been implemented in Chromium and there are pending patches there to convert the existing Generic Sensor web tests in WPT to the new virtual sensor model, which entirely removes the dependency on Mojo mocks and makes the tests more interoperable. This PR adds the required infrastructure to manipulate virtual sensors from testdriver. The 4 new commands correspond to the 4 WebDriver extension commands added by the spec PR above. This change was co-authored with JuhaVainio. Related to #9686. -- wpt-commits: 52115b2fd161d1c1c081b56262937a3d67839133 wpt-pr: 41906 UltraBlame original commit: 0838abe0dccb344e5949267d8e25986191c55fc2
The previous version from #369 and #377 was never implemented by any engines, and the language it used made it hard to actually implement and use in tests (such as those already present in web-platform-tests). For example:
The new version uses more precise language in the algorithms and properly integrates into the existing abstract operations. It has also been verified to work with Chromium, ChromeDriver and the required changes to web-platform-tests.
"Mock sensors" are now called "virtual sensors" to follow the same terminology adopted by the WebAuthn spec.
Conceptually, they are now defined as device sensors and therefore always exist at a layer below a platform sensor. This clears up ambiguities and delimits what is expected of platform sensors and what can actually be influenced by a virtual sensor.
Some auxiliary concepts also had to be defined, both of which are expected to be set by extension specifications:
The same virtual sensors are used by all navigables that have the same top-level traversable. In other words, all iframes under the same main frame, regardless of their origin, share the same virtual sensors. Not only does this match the behavior of real, hardware-based sensors more closely, but it also helps with a limitation in web-platform-tests' testdriver.js that only allows WebDriver communication to go through the page that creates the test harness.
Preview | Diff