chromium/third_party/blink/web_tests/editing/pasteboard/get-data-text-plain-drop.html

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../editing.js" type="text/javascript"></script>
<script type="text/javascript">
if (window.testRunner) {  
    testRunner.waitUntilDone(); 
    testRunner.dumpAsText();
}

var handleDrop = function(e) {
    var console = document.getElementById('console');
    var pasteText = e.dataTransfer.getData("text/plain");
    // Check that the content we get is the same content we dragged.
    var expectedText = 'drag';
    if (pasteText == expectedText)
        console.innerHTML += "SUCCESS: Pasted text matched expected text";
    else
        console.innerHTML += "FAILURE: Expected: " +expectedText + "\nbut was: " + pasteText;
}

var handleDrag = function(e) {
    e.dataTransfer.dropEffect = "copy";
    // Cancel the drag, so we get the drop.
    e.preventDefault();
}
    
function runTest() {
    if (window.internals)
        internals.settings.setEditingBehavior('mac');
    var console = document.getElementById('console');
    var editDiv = document.getElementById('test');
    editDiv.addEventListener('drop', handleDrop, false);
    editDiv.addEventListener('dragover', handleDrag, false);
  
    // Select the text to drag.
    selection.collapse(editDiv, 0);
    extendSelectionForwardByWordCommand(); 

    if (!window.testRunner)
        return;
    
    // Now, drag foo.
    var drag = document.getElementById('drag');
    var x = drag.offsetLeft + drag.offsetWidth / 2;
    var y = drag.offsetTop + drag.offsetHeight / 2;
    eventSender.mouseMoveTo(x, y);
    eventSender.mouseDown();
    eventSender.leapForward(400);

    // And drop it.
    var drop = document.getElementById("drop");
    x = drop.offsetLeft + drop.offsetWidth / 2;
    y = drop.offsetTop + drop.offsetHeight / 2;
    eventSender.mouseMoveTo(x, y);
    eventSender.mouseUp();
    testRunner.notifyDone();
}

</script>
<title>Test getData during drag and drop.</title>
</head>
<body onload='runTest();'>
<p>This tests that getData is supported for type text/plain during drop.  We select "drag", drag it, and then check that on drop getData returns "drag".  To run this test manually, just drag "drag" on to "drop".</p>
<div contentEditable id='test'><div><span id='drag'>drag</span></div><div><span id='drop'>drop</span></div></div>
<div id='console'></div>
</body>
</html>