blob: e664acb4fe5b960326f225a30a34d4704fc36391 [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>