You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(ChatGPT generated plan based on the tests we have)
This plan focuses exclusively on testing the Permissions API using the geolocation permission. By covering the scenarios below, we aim to ensure thorough coverage of how navigator.permissions.query({ name: 'geolocation' }) behaves, including event firing, revocation, and usage in both Window and Worker contexts.
1. Event Model Expansion
Goal: Verify the "change" event for PermissionStatus objects works correctly under multiple conditions.
Multiple Listeners
Test: Call navigator.permissions.query({ name: 'geolocation' }) once, attach two or more listeners:
Then force a state transition from "prompt" → "granted" (or "denied") using test_driver.set_permission(...).
Check: Ensure all listeners fire exactly once when the state changes.
Multi-step Transitions
Test: With a single PermissionStatus, step through multiple transitions:
"prompt" to "granted"
"granted" back to "prompt" (simulating revocation or expiry)
"prompt" to "denied"
Check: Each state change fires exactly one "change" event, and no event fires if the state is forced to remain the same.
Multiple Watchers
Test: Call navigator.permissions.query({ name: 'geolocation' }) two or three times. Store each returned PermissionStatus in a separate variable, and attach "change" listeners to all.
Check: When the permission state changes, all watchers receive the "change" event.
2. Worker Context
Goal: Ensure navigator.permissions behaves as expected in a Worker (i.e., WorkerNavigator.permissions).
Check: Confirm the PermissionStatus object’s "change" event fires. Confirm status.state is "denied" after the event.
(Optional) Artificial “Expiry”
If your test environment supports an “expiry-like” scenario, you can replicate it by setting "granted" → "prompt" after some time. You’d still use test_driver.set_permission(...) to automate that transition.
4. Non–Fully Active Documents
Goal: Ensure that a document losing “fully active” status stops receiving permission events and/or throws the appropriate exceptions.
Iframe Removal
Test: Put a script in an iframe that calls navigator.permissions.query({ name: 'geolocation' }). Store the PermissionStatus, attach a "change" listener, then remove the iframe from the DOM.
Check: When you call test_driver.set_permission({ name: 'geolocation' }, 'granted') afterwards, confirm that the removed iframe’s listener does not fire.
Worker in a Removed Iframe
(If feasible) same idea, but from a Worker in that iframe.
5. WebDriver Extension Commands
Goal: Validate that the user agent’s WebDriver (or BiDi) implementation properly handles the setPermission command for geolocation.
Test: If your UA refuses certain states, confirm the same error is returned.
6. Edge Cases
No Change
Test: Force the same state that’s already in effect—e.g., from "prompt" → "prompt" again.
Check: No "change" event fires.
Invalid PermissionDescriptor
Test: navigator.permissions.query({ name: '' }) or some obviously broken descriptor.
Check: Must throw TypeError or DOMException("InvalidStateError") according to the spec rules.
7. Implementation Notes
Automation: Most tests rely on test_driver.set_permission({ name: 'geolocation' }, newState) to transition the permission under test.
Cross-Browser: Since geolocation is the only permission guaranteed across major browsers, all tests should revolve around { name: 'geolocation' }.
WPT Integration: Where possible, add these as new .https.html or .https.any.js files in the permissions/ folder so they can run automatically in WPT infrastructures.
User Interaction: The spec has a “prompt the user to choose” algorithm, but it’s not generally automatable. We can rely on direct state changes (like “prompt” → “granted”) via test harness commands.
Summary
These tests—focusing solely on the geolocation permission—will expand coverage to include:
More thorough event model checks (multiple listeners, multiple PermissionStatus objects).
Worker usage tests.
Revocation and lifetime-like expiration scenarios.
Proper handling of non–fully active documents.
Validation of the new WebDriver extension command for permissions.
Edge case and error-condition testing.
By implementing these scenarios, we achieve a much more robust conformance suite for the Permissions spec as it applies to geolocation.
The text was updated successfully, but these errors were encountered:
(ChatGPT generated plan based on the tests we have)
This plan focuses exclusively on testing the Permissions API using the
geolocation
permission. By covering the scenarios below, we aim to ensure thorough coverage of hownavigator.permissions.query({ name: 'geolocation' })
behaves, including event firing, revocation, and usage in both Window and Worker contexts.1. Event Model Expansion
Goal: Verify the
"change"
event forPermissionStatus
objects works correctly under multiple conditions.Multiple Listeners
navigator.permissions.query({ name: 'geolocation' })
once, attach two or more listeners:"prompt"
→"granted"
(or"denied"
) usingtest_driver.set_permission(...)
.Multi-step Transitions
PermissionStatus
, step through multiple transitions:"change"
event, and no event fires if the state is forced to remain the same.Multiple Watchers
navigator.permissions.query({ name: 'geolocation' })
two or three times. Store each returnedPermissionStatus
in a separate variable, and attach"change"
listeners to all."change"
event.2. Worker Context
Goal: Ensure
navigator.permissions
behaves as expected in a Worker (i.e.,WorkerNavigator.permissions
).Basic Query in a Worker
PermissionStatus.state
."prompt"
,"granted"
, or"denied"
) depending on how you configuretest_driver.set_permission(...)
.Event Handling in a Worker
"change"
listener to the returnedPermissionStatus
, then force state changes."change"
event fires in the Worker’s context (or is consistently handled according to spec if any constraints apply).3. Revocation & Lifetime Expiry
Goal: Confirm that reverting from
"granted"
to some other state also triggers"change"
events.Manual Revocation Simulation
test_driver.set_permission({ name: 'geolocation' }, 'granted')
.navigator.permissions.query({ name: 'geolocation' })
to confirm it’s"granted"
."prompt"
or"denied"
:PermissionStatus
object’s"change"
event fires. Confirmstatus.state
is"denied"
after the event.(Optional) Artificial “Expiry”
"granted"
→"prompt"
after some time. You’d still usetest_driver.set_permission(...)
to automate that transition.4. Non–Fully Active Documents
Goal: Ensure that a document losing “fully active” status stops receiving permission events and/or throws the appropriate exceptions.
Iframe Removal
navigator.permissions.query({ name: 'geolocation' })
. Store thePermissionStatus
, attach a"change"
listener, then remove the iframe from the DOM.test_driver.set_permission({ name: 'geolocation' }, 'granted')
afterwards, confirm that the removed iframe’s listener does not fire.Worker in a Removed Iframe
5. WebDriver Extension Commands
Goal: Validate that the user agent’s WebDriver (or BiDi) implementation properly handles the
setPermission
command for geolocation.Success Path
POST /session/:sessionId/permissions
with:navigator.permissions.query({ name: 'geolocation' })
in the same session; expect"granted"
.Invalid Argument
POST /session/:sessionId/permissions
with:Unsupported State
6. Edge Cases
No Change
"prompt"
→"prompt"
again."change"
event fires.Invalid
PermissionDescriptor
navigator.permissions.query({ name: '' })
or some obviously broken descriptor.TypeError
orDOMException("InvalidStateError")
according to the spec rules.7. Implementation Notes
test_driver.set_permission({ name: 'geolocation' }, newState)
to transition the permission under test.{ name: 'geolocation' }
..https.html
or.https.any.js
files in thepermissions/
folder so they can run automatically in WPT infrastructures.Summary
These tests—focusing solely on the
geolocation
permission—will expand coverage to include:PermissionStatus
objects).By implementing these scenarios, we achieve a much more robust conformance suite for the Permissions spec as it applies to geolocation.
The text was updated successfully, but these errors were encountered: