| <!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><br> |
| <input type=file id="file" name="file" onchange="onInputFileChange()"> |
| <input type=submit> |
| </form> |
| <pre id='console'></pre> |
| <script src='../../../../resources/ui-helper.js'></script> |
| <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 runTests() |
| { |
| testRunner.setOpenPanelFiles(['resources/test.txt']); |
| |
| var element = document.getElementById("file") |
| var centerX = element.offsetLeft + element.offsetWidth / 2; |
| var centerY = element.offsetTop + element.offsetHeight / 2; |
| UIHelper.activateAt(centerX, centerY); |
| } |
| |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| testRunner.waitUntilDone(); |
| window.onload = runTests; |
| } |
| </script> |
| </body> |
| </html> |