OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <meta charset="utf-8"> |
| 3 <title>Async Clipboard write (dt/text) -> read (dt/text) tests</title> |
| 4 <script src="/resources/testharness.js"></script> |
| 5 <script src="/resources/testharnessreport.js"></script> |
| 6 <script> |
| 7 async_test(function(t) { |
| 8 var test_data = "Clipboard write (dt/text) -> read (dt/text) test data"; |
| 9 var cb = navigator.clipboard; |
| 10 var dt = new DataTransfer(); |
| 11 dt.items.add(test_data, "text/plain"); |
| 12 |
| 13 cb.write(dt).then(t.step_func(() => { |
| 14 cb.read().then(t.step_func((data) => { |
| 15 assert_equals(data.items.length, 1); |
| 16 data.items[0].getAsString(t.step_func((s) => { |
| 17 assert_equals(s, test_data); |
| 18 t.done(); |
| 19 })); |
| 20 }), function() { |
| 21 t.unreached_func("clipboard.read() fail"); |
| 22 }); |
| 23 }), function() { |
| 24 t.unreached_func("clipboard.write() fail"); |
| 25 }); |
| 26 }, "Verify write and read clipboard (DataTransfer/text)"); |
| 27 </script> |
| 28 Note: This is a manual test because it writes/reads to the shared system |
| 29 clipboard and thus cannot be run async with other tests that might interact |
| 30 with the clipboard. |
OLD | NEW |