Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clipboard API Tests: Move permissions tests to WPT. #23617

Merged
merged 1 commit into from
May 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions clipboard-apis/permissions/readText-denied.https.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!doctype html>
<meta charset="utf-8">
<title>navigator.clipboard.readText() fails when permission denied</title>
<link rel="help" href="https://w3c.github.io/clipboard-apis/#async-clipboard-api">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script>
'use strict';

promise_test(async t => {
test_driver.set_permission({name: 'clipboard-read'}, 'denied');
await promise_rejects_dom(t,
'NotAllowedError', navigator.clipboard.readText());
}, 'navigator.clipboard.readText() fails when permission denied');
</script>
16 changes: 16 additions & 0 deletions clipboard-apis/permissions/readText-granted.https.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!doctype html>
<meta charset="utf-8">
<title>navigator.clipboard.readText() succeeds when permission granted</title>
<link rel="help" href="https://w3c.github.io/clipboard-apis/#async-clipboard-api">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script>
'use strict';

promise_test(async () => {
test_driver.set_permission({name: 'clipboard-read'}, 'granted');
await navigator.clipboard.readText();
}, 'navigator.clipboard.readText() succeeds when permission granted');
</script>
17 changes: 17 additions & 0 deletions clipboard-apis/permissions/writeText-denied.https.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!doctype html>
<meta charset="utf-8">
<title>navigator.clipboard.writeText() fails when permission denied</title>
<link rel="help" href="https://w3c.github.io/clipboard-apis/#async-clipboard-api">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script>
'use strict';

promise_test(async t => {
test_driver.set_permission({name: 'clipboard-write'}, 'denied');
await promise_rejects_dom(t, 'NotAllowedError',
navigator.clipboard.writeText('xyz'));
}, 'navigator.clipboard.writeText() fails when permission denied');
</script>
16 changes: 16 additions & 0 deletions clipboard-apis/permissions/writeText-granted.https.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!doctype html>
<meta charset="utf-8">
<title>navigator.clipboard.writeText() succeeds when permission granted</title>
<link rel="help" href="https://w3c.github.io/clipboard-apis/#async-clipboard-api">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script>
'use strict';

promise_test(async () => {
test_driver.set_permission({name: 'clipboard-write'}, 'granted');
await navigator.clipboard.writeText('xyz');
}, 'navigator.clipboard.writeText() succeeds when permission granted');
</script>