| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="/resources/js-test-pre.js"></script> |
| <script src="/resources/notifications-test-pre.js"></script> |
| </head> |
| <body> |
| <script> |
| |
| description("This test checks that Permissions::query() works in window contexts") |
| |
| jsTestIsAsync = true; |
| |
| function defaultTest() |
| { |
| navigator.permissions.query({ name: "geolocation" }).then((status)=>{ |
| window.state = status.state; |
| shouldBeEqualToString("state", "prompt"); |
| grantTest(); |
| }); |
| } |
| |
| function grantTest() |
| { |
| testRunner.setGeolocationPermission(true); |
| navigator.permissions.query({ name: "geolocation" }).then((status)=>{ |
| window.state = status.state; |
| shouldBeEqualToString("state", "granted"); |
| denyTest(); |
| }); |
| } |
| |
| function denyTest() |
| { |
| testRunner.setGeolocationPermission(false); |
| navigator.permissions.query({ name: "geolocation" }).then((status)=>{ |
| window.state = status.state; |
| shouldBeEqualToString("state", "prompt"); |
| finishJSTest(); |
| }); |
| } |
| |
| defaultTest(); |
| |
| </script> |
| <script src="/resources/js-test-post.js"></script> |
| </body> |
| </html> |