diff options
Diffstat (limited to 'tests/auto/declarative/qmlxmlhttprequest/data/abort.qml')
-rw-r--r-- | tests/auto/declarative/qmlxmlhttprequest/data/abort.qml | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/abort.qml b/tests/auto/declarative/qmlxmlhttprequest/data/abort.qml new file mode 100644 index 0000000..d7b9266 --- /dev/null +++ b/tests/auto/declarative/qmlxmlhttprequest/data/abort.qml @@ -0,0 +1,42 @@ +import Qt 4.6 + +QtObject { + property string urlDummy + property string url + + property bool seenDone: false + property bool didNotSeeUnsent: true + property bool endStateUnsent: false + property bool dataOK: false + + Component.onCompleted: { + var x = new XMLHttpRequest; + x.open("GET", urlDummy); + x.setRequestHeader("Test-header", "TestValue"); + x.send(); + + x.onreadystatechange = function() { + if (x.readyState == XMLHttpRequest.DONE) { + seenDone = true; + } else if (x.readyState == XMLHttpRequest.UNSENT) { + didNotSeeUnsent = false; + } + } + + x.abort(); + + if (x.readyState == XMLHttpRequest.UNSENT) { + endStateUnsent = true; + } + + x.onreadystatechange = function() { + if (x.readyState == XMLHttpRequest.DONE) { + dataOK = (x.responseText == "QML Rocks!\n"); + } + } + x.open("PUT", url); + x.send("Test Data"); + } +} + + |