blob: 1b31de62e078e8e28ce13fde924055d6f3230c1e [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 success.");
shouldBeDefined("PermissionsHelper.setPermission");
function successCallback(access) {
testPassed("clipboard.writeText() success (as expected).");
finishJSTest();
}
function errorCallback(error) {
testFailed(
"clipboard.writeText() does not fail (even though we hoped it would).");
finishJSTest();
}
window.jsTestIsAsync = true;
PermissionsHelper.setPermission('clipboard-write', 'granted').then(function() {
shouldBeNonNull("navigator.clipboard");
navigator.clipboard.writeText("xyz").then(successCallback, errorCallback);
});
</script>
</body>
</html>