<html>
<body onload="runTest()">
<div contenteditable>drag<img src=abe.png id=dragme>me<span id=target>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></div>
<script>
function moveToCenter(element) {
    var x, y;
    x = element.offsetLeft + element.offsetWidth / 2;
    y = element.offsetTop + element.offsetHeight / 2;
    eventSender.mouseMoveTo(x, y);
}

function runTest() {
    e = document.getElementById("dragme");
    moveToCenter(e);
    eventSender.mouseDown();

    e = document.getElementById("target");
    moveToCenter(e);
    eventSender.mouseUp();

    if (document.getElementById("dragme").parentNode.tagName == "SPAN" && document.getElementById("dragme").src.length > 10)
        console.log("PASS");
    else
        console.log("FAIL");

    testRunner.notifyDone();
}
</script>
</body>
</html>
