.: Blob.slice support.
[WebKit-https.git] / LayoutTests / http / tests / local / resources / send-dragged-file.js
1 description("Test for sending a dragged file via XMLHttpRequest.");
2
3 function onFileDrop(file)
4 {
5     var xhr = new XMLHttpRequest();
6     xhr.open("POST", "http://127.0.0.1:8000/xmlhttprequest/resources/post-echo.cgi", false);
7     xhr.send(file);
8     if (xhr.responseText == "1234567890")
9         testPassed("Expected response data received.");
10     else
11         testFailed("Unexpected response data received: " + xhr.responseText);
12
13     event.preventDefault();
14 }
15
16 function runTest()
17 {
18     setFileInputDropCallback(onFileDrop);
19     eventSender.beginDragWithFiles(["resources/file-for-drag-to-send.txt"]);
20     moveMouseToCenterOfElement(fileInput);
21     eventSender.mouseUp();
22 }
23
24 if (window.eventSender) {
25     runTest();
26     // Clean up after ourselves
27     removeFileInputElement();
28 } else {
29     testFailed("This test is not interactive, please run using DumpRenderTree");
30 }
31
32 var successfullyParsed = true;