async-writeText-readText.https.html (1070B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <title>Async Clipboard writeText -> readText tests</title> 4 <link rel="help" href="https://w3c.github.io/clipboard-apis/#async-clipboard-api"> 5 <body>Body needed for test_driver.click()</body> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <script src="/resources/testdriver.js"></script> 9 <script src="/resources/testdriver-vendor.js"></script> 10 <script src="../resources/user-activation.js"></script> 11 <script> 12 async function readWriteTest(textInput) { 13 promise_test(async t => { 14 await tryGrantReadPermission(); 15 await tryGrantWritePermission(); 16 17 await waitForUserActivation(); 18 await navigator.clipboard.writeText(textInput); 19 await waitForUserActivation(); 20 const textOutput = await navigator.clipboard.readText(); 21 22 assert_equals(textOutput, textInput); 23 }, 'Verify write and read clipboard given text: ' + textInput); 24 } 25 26 readWriteTest('Clipboard write text -> read text test'); 27 readWriteTest('non-Latin1 text encoding test データ'); 28 </script>