Bug 1638136 [wpt PR 23617] - Clipboard API Tests: Move permissions tests to WPT., a=testonly

Automatic update from web-platform-tests
Clipboard API Tests: Move permissions tests to WPT.

Since https://github.com/web-platform-tests/wpt/pull/20461 and
https://github.com/web-platform-tests/wpt/issues/5671 were fixed, it now
becomes possible to automate some Web Platform Tests, and have them run
on all browsers automatically.

Clipboard API permission tests were previously outside WPT in order to
automate permissions using PermissionsHelper and detect regressions.

This allows us to share our permissions tests with other browsers
testing using WPT.

Bug: 1076691
Change-Id: I1ff6a8bbdf60b8d77fd8621efce840739fbeec23
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2200278
Auto-Submit: Darwin Huang <huangdarwin@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#769171}

--

wpt-commits: 290d03696f5008625c2ebd1bfaf37eb9bff5bd79
wpt-pr: 23617
This commit is contained in:
Darwin Huang 2020-05-21 10:21:53 +00:00 коммит произвёл moz-wptsync-bot
Родитель 142c0e6ebe
Коммит 1a03b5c86b
4 изменённых файлов: 66 добавлений и 0 удалений

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>