diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-11-10 04:53:36 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-11-10 06:52:02 (GMT) |
commit | bdb9c0ffa84bfab386de5550bd8f9b013288daca (patch) | |
tree | 54e0d7d8fa31271476caa053abcab37f1436d36d /tests/auto/declarative/xmlhttprequest/data/responseText.qml | |
parent | 4983b04da9f3258519e4b15f8e593bf2a11f3556 (diff) | |
download | Qt-bdb9c0ffa84bfab386de5550bd8f9b013288daca.zip Qt-bdb9c0ffa84bfab386de5550bd8f9b013288daca.tar.gz Qt-bdb9c0ffa84bfab386de5550bd8f9b013288daca.tar.bz2 |
XMLHttpRequest tests
Diffstat (limited to 'tests/auto/declarative/xmlhttprequest/data/responseText.qml')
-rw-r--r-- | tests/auto/declarative/xmlhttprequest/data/responseText.qml | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/auto/declarative/xmlhttprequest/data/responseText.qml b/tests/auto/declarative/xmlhttprequest/data/responseText.qml new file mode 100644 index 0000000..0bb8659 --- /dev/null +++ b/tests/auto/declarative/xmlhttprequest/data/responseText.qml @@ -0,0 +1,52 @@ +import Qt 4.6 + +Object { + property string url + property string expectedText + + property bool unsent: false + property bool opened: false + property bool sent: false + property bool headersReceived: false + + property bool loading: false + property bool done: false + + property bool reset: false + + property bool dataOK: false + + Component.onCompleted: { + var x = new XMLHttpRequest; + + unsent = (x.responseText == ""); + + x.open("GET", url); + + opened = (x.responseText == ""); + + // Test to the end + x.onreadystatechange = function() { + if (x.readyState == XMLHttpRequest.HEADERS_RECEIVED) { + headersReceived = (x.responseText == ""); + } else if (x.readyState == XMLHttpRequest.LOADING) { + if (x.responseText == expectedText) + loading = true; + } else if (x.readyState == XMLHttpRequest.DONE) { + if (x.responseText == expectedText) + done = true; + + dataOK = (x.responseText == expectedText); + + x.open("GET", url); + + reset = (x.responseText == ""); + } + } + + x.send() + + sent = (x.responseText == ""); + } +} + |