Update web-platform-tests to revision e3cf1284464a4a3e46fd15e4138f8e32c6cecdd8

This commit is contained in:
WPT Sync Bot 2019-04-18 21:48:35 -04:00
parent b20333a324
commit c5c325d8bb
57 changed files with 1422 additions and 493 deletions

View file

@ -0,0 +1,37 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>
Async Clipboard write ([text/plain ClipboardItem]) ->
read ([text/plain ClipboardItem]) tests
</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>
async function readWriteTest(textInput) {
promise_test(async t => {
const blobInput = new Blob([textInput], {type: 'text/plain'});
const clipboardItemInput = new ClipboardItem({'text/plain': blobInput});
await navigator.clipboard.write([clipboardItemInput]);
const clipboardItems = await navigator.clipboard.read();
assert_equals(clipboardItems.length, 1);
const clipboardItemOutput = clipboardItems[0];
assert_true(clipboardItemOutput instanceof ClipboardItem);
assert_equals(clipboardItemOutput.types.length, 1);
const blobOutput = await clipboardItemOutput.getType('text/plain');
assert_equals(blobOutput.type, 'text/plain');
const textOutput = await (new Response(blobOutput)).text();
assert_equals(textOutput, textInput);
}, 'Verify write and read clipboard given text: ' + textInput);
}
readWriteTest('Clipboard write ([text/plain ClipboardItem]) -> read ([text/plain ClipboardItem]) test');
readWriteTest('non-Latin1 text encoding test データ');
</script>
<p>
Note: This is a manual test because it writes/reads to the shared system
clipboard and thus cannot be run async with other tests that might interact
with the clipboard.
</p>

View file

@ -0,0 +1,29 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>
Async Clipboard write ([text/plain ClipboardItem]) -> readText tests
</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>
async function readWriteTest(textInput) {
promise_test(async t => {
const blobInput = new Blob([textInput], {type: 'text/plain'});
const clipboardItem = new ClipboardItem({'text/plain': blobInput});
await navigator.clipboard.write([clipboardItem]);
const textOutput = await navigator.clipboard.readText();
assert_equals(textOutput, textInput);
}, 'Verify write and read clipboard given text: ' + textInput);
}
readWriteTest('Clipboard write ([text/plain ClipboardItem) -> read text test');
readWriteTest('non-Latin1 text encoding test データ');
</script>
<p>
Note: This is a manual test because it writes/reads to the shared system
clipboard and thus cannot be run async with other tests that might interact
with the clipboard.
</p>

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>
Async Clipboard writeText -> read ([text/plain ClipboardItem]) tests
</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>
async function readWriteTest(textInput) {
promise_test(async t => {
await navigator.clipboard.writeText(textInput);
const clipboardItems = await navigator.clipboard.read();
assert_equals(clipboardItems.length, 1);
const clipboardItem = clipboardItems[0];
assert_true(clipboardItem instanceof ClipboardItem);
assert_equals(clipboardItem.types.length, 1);
const blobOutput = await clipboardItem.getType('text/plain');
assert_equals(blobOutput.type, 'text/plain');
const textOutput = await (new Response(blobOutput)).text();
assert_equals(textOutput, textInput);
}, 'Verify write and read clipboard given text: ' + textInput);
}
readWriteTest('Clipboard write text -> read ([text/plain ClipboardItem]) test');
readWriteTest('non-Latin1 text encoding test データ');
</script>
<p>
Note: This is a manual test because it writes/reads to the shared system
clipboard and thus cannot be run async with other tests that might interact
with the clipboard.
</p>

View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Async Clipboard writeText -> readText tests</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>
async function readWriteTest(textInput) {
promise_test(async t => {
await navigator.clipboard.writeText(textInput);
const textOutput = await navigator.clipboard.readText();
assert_equals(textOutput, textInput);
}, 'Verify write and read clipboard given text: ' + textInput);
}
readWriteTest('Clipboard write text -> read text test');
readWriteTest('non-Latin1 text encoding test データ');
</script>
<p>
Note: This is a manual test because it writes/reads to the shared system
clipboard and thus cannot be run async with other tests that might interact
with the clipboard.
</p>