diff options
Diffstat (limited to 'tests/auto/qml/qqmlxmlhttprequest/data/send_alreadySent.qml')
-rw-r--r-- | tests/auto/qml/qqmlxmlhttprequest/data/send_alreadySent.qml | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/send_alreadySent.qml b/tests/auto/qml/qqmlxmlhttprequest/data/send_alreadySent.qml new file mode 100644 index 0000000000..4e0caa7171 --- /dev/null +++ b/tests/auto/qml/qqmlxmlhttprequest/data/send_alreadySent.qml @@ -0,0 +1,28 @@ +import QtQuick 2.0 + +QtObject { + property bool dataOK: false + property bool test: false + + Component.onCompleted: { + var x = new XMLHttpRequest; + x.open("GET", "testdocument.html"); + x.setRequestHeader("Accept-Language","en-US"); + + // Test to the end + x.onreadystatechange = function() { + if (x.readyState == XMLHttpRequest.DONE) { + dataOK = (x.responseText == "QML Rocks!\n"); + } + } + + x.send(); + + try { + x.send() + } catch (e) { + if (e.code == DOMException.INVALID_STATE_ERR) + test = true; + } + } +} |