blob: 43c203450aa84c3faad275d4edf2ffa9b762c417 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../editing.js"></script>
<script>
function paste(event)
{
var items = event.clipboardData.items;
for (var i = 0; i < items.length; ++i) {
if (items[i].kind == 'file' && items[i].type == 'image/png') {
var blob = items[i].getAsFile();
var url = window.URL.createObjectURL(blob);
document.getElementById('dest').src = url;
}
}
window.setTimeout(function () {
if (window.testRunner)
testRunner.notifyDone();
}, 0);
}
function runTest()
{
if (!window.testRunner)
return;
testRunner.waitUntilDone();
var srcElement = document.getElementById('src');
srcElement.contentWindow.document.execCommand('copy');
eventSender.mouseMoveTo(1, 1);
eventSender.mouseDown();
eventSender.mouseUp();
document.execCommand('paste');
}
</script>
</head>
<body onload="runTest()" onpaste="paste(event)">
<div>This file tests the image pasting functionality of DataTransferItems.
To try the test manually, right-click on the image &gt; Copy Image, click
anywhere in the background of the main page and paste.</div>
<iframe id="src" src="resources/mozilla.gif"></iframe><br>
<img id="dest">
</body>
</html>