blob: 3abd9b74d75a32db6ebb4aab284c9e97bc06cc79 [file] [log] [blame]
<!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.writeText() permission failure.");
shouldBeDefined("PermissionsHelper.setPermission");
function successCallback(access) {
testFailed(
"clipboard.writeText() does not fail (even though it really should have).");
finishJSTest();
}
function errorCallback(error) {
testPassed("clipboard.writeText() fail (as expected).");
finishJSTest();
}
window.jsTestIsAsync = true;
PermissionsHelper.setPermission('clipboard-write', 'denied').then(function() {
shouldBeNonNull("navigator.clipboard");
navigator.clipboard.writeText("xyz").then(successCallback, errorCallback);
});
</script>
</body>
</html>