blob: c3597b3db28bd2632152036601a06c1233df9bb8 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<body>
<form id=f>
<input type=hidden name="submitted" value="true">
<input type=button name="button" value="value1">
<input type=checkbox name="checkbox" value="value2" checked>
<input type=radio name="radio" value="value3" checked>
<input type=text name="text" value="value4">
<input type=text name="text2" value="value5" disabled>
<input type=file id="file" name="file" onchange="onInputFileChange()">
<input type=submit>
</form>
<pre id='console'></pre>
<script>
function log(message)
{
document.getElementById('console').appendChild(document.createTextNode(message + "\n"));
}
function onInputFileChange()
{
log("Test that FormData constructor takes a HTML Form element.");
var file = document.getElementById("file").files[0];
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://127.0.0.1:8000/xmlhttprequest/resources/multipart-post-echo.py", false);
xhr.send(new FormData(document.getElementById("f")));
log("Response: " + xhr.responseText);
log("DONE");
if (testRunner.notifyDone)
testRunner.notifyDone();
}
function moveMouseToCenterOfElement(element)
{
var centerX = element.offsetLeft + element.offsetWidth / 2;
var centerY = element.offsetTop + element.offsetHeight / 2;
eventSender.mouseMoveTo(centerX, centerY);
}
function runTests()
{
eventSender.beginDragWithFiles(['resources/test.txt']);
moveMouseToCenterOfElement(document.getElementById("file"));
eventSender.mouseUp();
}
if (window.eventSender) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
window.onload = runTests;
}
</script>
</body>
</html>