Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / pasteboard / data-transfer-items-image-png.html
blob43c203450aa84c3faad275d4edf2ffa9b762c417
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../editing.js"></script>
5 <script>
6 function paste(event)
8 var items = event.clipboardData.items;
9 for (var i = 0; i < items.length; ++i) {
10 if (items[i].kind == 'file' && items[i].type == 'image/png') {
11 var blob = items[i].getAsFile();
12 var url = window.URL.createObjectURL(blob);
13 document.getElementById('dest').src = url;
16 window.setTimeout(function () {
17 if (window.testRunner)
18 testRunner.notifyDone();
19 }, 0);
22 function runTest()
24 if (!window.testRunner)
25 return;
26 testRunner.waitUntilDone();
27 var srcElement = document.getElementById('src');
28 srcElement.contentWindow.document.execCommand('copy');
29 eventSender.mouseMoveTo(1, 1);
30 eventSender.mouseDown();
31 eventSender.mouseUp();
32 document.execCommand('paste');
34 </script>
35 </head>
36 <body onload="runTest()" onpaste="paste(event)">
37 <div>This file tests the image pasting functionality of DataTransferItems.
38 To try the test manually, right-click on the image &gt; Copy Image, click
39 anywhere in the background of the main page and paste.</div>
40 <iframe id="src" src="resources/mozilla.gif"></iframe><br>
41 <img id="dest">
42 </body>
43 </html>