Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / pasteboard / can-read-in-copy-and-cut-events.html
blob869483249035594a009110895e4fc408ae1efa8e
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script>
5 function log(text) {
6 var log = document.getElementById('log');
7 log.appendChild(document.createTextNode(text));
8 log.appendChild(document.createElement('br'));
11 function copyTest(e) {
12 e.clipboardData.setData('text/plain', 'copy test');
13 if (event.clipboardData.types.indexOf('text/plain') < 0 ||
14 event.clipboardData.getData('text/plain') != 'copy test')
15 log('copy: FAILED');
16 else
17 log('copy: SUCCESS');
20 function cutTest(e) {
21 e.clipboardData.setData('text/plain', 'cut test');
22 if (event.clipboardData.types.indexOf('text/plain') < 0 ||
23 event.clipboardData.getData('text/plain') != 'cut test')
24 log('cut: FAILED');
25 else
26 log('cut: SUCCESS');
29 function runTest() {
30 if (!window.testRunner)
31 return;
32 testRunner.dumpAsText();
33 document.execCommand('copy');
34 document.execCommand('cut');
36 </script>
37 </head>
38 <body onload="runTest()" oncopy="copyTest(event)" oncut="cutTest(event)">
39 <p>Simple test that data set during a copy/cut event can be read back. To run
40 the test manually, simply select any text and initiate a copy/cut operation.
41 <div id="log"></div>
42 </html>