| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../resources/js-test.js"></script> |
| <script src="../http/tests/resources/permissions-helper.js"></script> |
| </head> |
| <body> |
| <script> |
| description("Tests navigator.clipboard.readText() permission success."); |
| |
| shouldBeDefined("PermissionsHelper.setPermission"); |
| |
| function successCallback(access) { |
| testPassed("clipboard.readText() success (as expected)."); |
| finishJSTest(); |
| } |
| |
| function errorCallback(error) { |
| testFailed( |
| "clipboard.readText() does not fail (even though we hoped it would)."); |
| finishJSTest(); |
| } |
| |
| window.jsTestIsAsync = true; |
| |
| PermissionsHelper.setPermission('clipboard-read', 'granted').then(function() { |
| shouldBeNonNull("navigator.clipboard"); |
| navigator.clipboard.readText().then(successCallback, errorCallback); |
| }); |
| |
| |
| </script> |
| </body> |
| </html> |