OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <meta charset="utf-8"> | |
3 <title>Async Clipboard write/read (DataTransfer/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 = "Exciting DataTransfer/text clipboard 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(function() { | |
foolip
2017/05/15 15:33:27
The spec says "Handle access permissions. Reject p
garykac
2017/05/17 23:51:14
We have a clipboard Permission[1] that is not yet
| |
14 cb.read().then(function(data) { | |
15 t.step(function(){assert_equals(data.items.length, 1);}); | |
foolip
2017/05/15 15:33:27
None of the explicit t.step should be required. In
garykac
2017/05/17 23:51:14
Done. Thanks! That looks nicer.
| |
16 data.items[0].getAsString(function(s) { | |
17 t.step(function(){assert_equals(s, test_data);}); | |
18 t.done(); | |
foolip
2017/05/15 15:33:27
This'll be the final and only t.done(). It doesn't
garykac
2017/05/17 23:51:14
Acknowledged.
| |
19 }); | |
20 }, function() { | |
21 t.step(function(){assert_false(true, "Read fail");}); | |
foolip
2017/05/15 15:33:27
If you stick with async_test you can use t.unreach
garykac
2017/05/17 23:51:14
Done.
| |
22 t.done(); | |
23 }); | |
24 }, function() { | |
25 t.step(function(){assert_false(true, "Write fail");}); | |
26 t.done(); | |
27 }); | |
28 }, "Verify write and read clipboard (DataTransfer/text)"); | |
29 </script> | |
30 Note: This is a manual test because it writes/reads to the shared system | |
foolip
2017/05/15 15:33:27
Can you file bugs on web-platform-tests with type:
garykac
2017/05/17 23:51:14
Filed: https://github.com/w3c/web-platform-tests/i
| |
31 clipboard and thus cannot be run async with other tests that might interact | |
32 with the clipboard. | |
OLD | NEW |