<!DOCTYPE html>
<html>
<head>
<script>
function runTest() {
    if (window.testRunner) {
        testRunner.dumpAsText();
        testRunner.waitUntilDone();
    } else
        return;
    
    e = document.getElementById("source");
    x = e.offsetLeft + e.offsetWidth / 2;
    y = e.offsetTop + e.offsetHeight / 2;

    eventSender.mouseMoveTo(x, y);
    eventSender.mouseDown();    
    e = document.getElementById("target");
    x = e.offsetLeft + e.offsetWidth / 2;
    y = e.offsetTop + e.offsetHeight / 2;
    
    eventSender.mouseMoveTo(x, y);
    eventSender.mouseUp();
}

function dragEnterOrOver(event) {
    event.dataTransfer.dropEffect = "copy";
    event.preventDefault();
}

function drop(event) {
    event.preventDefault();
    eventSender.dumpFilenameBeingDragged();
    testRunner.notifyDone();
}
</script>
<style>
#target {
    height: 100px;
    width: 100px;
}
</style>
</head>

<body onload="runTest()">  

<p>This test requires DumpRenderTree. To test manually, drag the image to the desktop. It should receive the name "onload-image.png".

<div id="target" ondragenter="dragEnterOrOver(event)" ondragover="dragEnterOrOver(event)" ondrop="drop(event)"></div>
<img id="source" src="resources/onload-image.png" alt="Does it work?">

</body>
</html>
