diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-11-10 02:10:57 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-11-10 02:10:57 (GMT) |
commit | cdabdb79808b3788519fa3bde0d240f2b11a4b34 (patch) | |
tree | e296059c6332d73ae2c55caf7dd2026316a6dc54 /tests/auto/declarative/xmlhttprequest/data | |
parent | fc5fd47fc7e7d87d17386e23690af4fec80dae05 (diff) | |
download | Qt-cdabdb79808b3788519fa3bde0d240f2b11a4b34.zip Qt-cdabdb79808b3788519fa3bde0d240f2b11a4b34.tar.gz Qt-cdabdb79808b3788519fa3bde0d240f2b11a4b34.tar.bz2 |
More XMLHttpRequest tests
Diffstat (limited to 'tests/auto/declarative/xmlhttprequest/data')
16 files changed, 252 insertions, 0 deletions
diff --git a/tests/auto/declarative/xmlhttprequest/data/send_alreadySent.qml b/tests/auto/declarative/xmlhttprequest/data/send_alreadySent.qml new file mode 100644 index 0000000..4598169 --- /dev/null +++ b/tests/auto/declarative/xmlhttprequest/data/send_alreadySent.qml @@ -0,0 +1,27 @@ +import Qt 4.6 + +Object { + property bool dataOK: false + property bool test: false + + Component.onCompleted: { + var x = new XMLHttpRequest; + x.open("GET", "testdocument.html"); + + // 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; + } + } +} diff --git a/tests/auto/declarative/xmlhttprequest/data/send_data.1.expect b/tests/auto/declarative/xmlhttprequest/data/send_data.1.expect new file mode 100644 index 0000000..1ef179b --- /dev/null +++ b/tests/auto/declarative/xmlhttprequest/data/send_data.1.expect @@ -0,0 +1,10 @@ +POST /testdocument.html HTTP/1.1 +Content-Type: text/plain;charset=UTF-8 +Content-Length: 12 +Connection: Keep-Alive +Accept-Encoding: gzip +accept-language: en,* +User-Agent: Mozilla/5.0 +Host: localhost:14445 + +My Sent Data
\ No newline at end of file diff --git a/tests/auto/declarative/xmlhttprequest/data/send_data.1.qml b/tests/auto/declarative/xmlhttprequest/data/send_data.1.qml new file mode 100644 index 0000000..c0b5bf8 --- /dev/null +++ b/tests/auto/declarative/xmlhttprequest/data/send_data.1.qml @@ -0,0 +1,21 @@ +import Qt 4.6 + +Object { + property string url + + property bool dataOK: false + + Component.onCompleted: { + var x = new XMLHttpRequest; + x.open("POST", url); + + // Test to the end + x.onreadystatechange = function() { + if (x.readyState == XMLHttpRequest.DONE) { + dataOK = (x.responseText == "QML Rocks!\n"); + } + } + + x.send("My Sent Data"); + } +} diff --git a/tests/auto/declarative/xmlhttprequest/data/send_data.2.qml b/tests/auto/declarative/xmlhttprequest/data/send_data.2.qml new file mode 100644 index 0000000..8a8c375 --- /dev/null +++ b/tests/auto/declarative/xmlhttprequest/data/send_data.2.qml @@ -0,0 +1,23 @@ +import Qt 4.6 + +Object { + property string url + + property bool dataOK: false + + Component.onCompleted: { + var x = new XMLHttpRequest; + x.open("POST", url); + x.setRequestHeader("Content-Type", "text/plain;charset=UTF-8"); + + // Test to the end + x.onreadystatechange = function() { + if (x.readyState == XMLHttpRequest.DONE) { + dataOK = (x.responseText == "QML Rocks!\n"); + } + } + + x.send("My Sent Data"); + } +} + diff --git a/tests/auto/declarative/xmlhttprequest/data/send_data.3.qml b/tests/auto/declarative/xmlhttprequest/data/send_data.3.qml new file mode 100644 index 0000000..ae5731f --- /dev/null +++ b/tests/auto/declarative/xmlhttprequest/data/send_data.3.qml @@ -0,0 +1,23 @@ +import Qt 4.6 + +Object { + property string url + + property bool dataOK: false + + Component.onCompleted: { + var x = new XMLHttpRequest; + x.open("POST", url); + x.setRequestHeader("Content-Type", "text/plain;charset=latin1"); + + // Test to the end + x.onreadystatechange = function() { + if (x.readyState == XMLHttpRequest.DONE) { + dataOK = (x.responseText == "QML Rocks!\n"); + } + } + + x.send("My Sent Data"); + } +} + diff --git a/tests/auto/declarative/xmlhttprequest/data/send_data.4.expect b/tests/auto/declarative/xmlhttprequest/data/send_data.4.expect new file mode 100644 index 0000000..6b10b4a --- /dev/null +++ b/tests/auto/declarative/xmlhttprequest/data/send_data.4.expect @@ -0,0 +1,10 @@ +POST /testdocument.html HTTP/1.1 +Content-Type: charset=UTF-8;text/plain +Content-Length: 12 +Connection: Keep-Alive +Accept-Encoding: gzip +accept-language: en,* +User-Agent: Mozilla/5.0 +Host: localhost:14445 + +My Sent Data
\ No newline at end of file diff --git a/tests/auto/declarative/xmlhttprequest/data/send_data.4.qml b/tests/auto/declarative/xmlhttprequest/data/send_data.4.qml new file mode 100644 index 0000000..375f2fa --- /dev/null +++ b/tests/auto/declarative/xmlhttprequest/data/send_data.4.qml @@ -0,0 +1,24 @@ +import Qt 4.6 + +Object { + property string url + + property bool dataOK: false + + Component.onCompleted: { + var x = new XMLHttpRequest; + x.open("POST", url); + x.setRequestHeader("Content-Type", "charset=UTF-8;text/plain"); + + // Test to the end + x.onreadystatechange = function() { + if (x.readyState == XMLHttpRequest.DONE) { + dataOK = (x.responseText == "QML Rocks!\n"); + } + } + + x.send("My Sent Data"); + } +} + + diff --git a/tests/auto/declarative/xmlhttprequest/data/send_data.5.qml b/tests/auto/declarative/xmlhttprequest/data/send_data.5.qml new file mode 100644 index 0000000..eca1676 --- /dev/null +++ b/tests/auto/declarative/xmlhttprequest/data/send_data.5.qml @@ -0,0 +1,23 @@ +import Qt 4.6 + +Object { + property string url + + property bool dataOK: false + + Component.onCompleted: { + var x = new XMLHttpRequest; + x.open("POST", url); + x.setRequestHeader("Content-Type", "charset=latin1;text/plain"); + + // Test to the end + x.onreadystatechange = function() { + if (x.readyState == XMLHttpRequest.DONE) { + dataOK = (x.responseText == "QML Rocks!\n"); + } + } + + x.send("My Sent Data"); + } +} + diff --git a/tests/auto/declarative/xmlhttprequest/data/send_data.6.expect b/tests/auto/declarative/xmlhttprequest/data/send_data.6.expect new file mode 100644 index 0000000..dc0d6c2 --- /dev/null +++ b/tests/auto/declarative/xmlhttprequest/data/send_data.6.expect @@ -0,0 +1,10 @@ +PUT /testdocument.html HTTP/1.1 +Content-Type: text/plain;charset=UTF-8 +Content-Length: 12 +Connection: Keep-Alive +Accept-Encoding: gzip +accept-language: en,* +User-Agent: Mozilla/5.0 +Host: localhost:14445 + +My Sent Data
\ No newline at end of file diff --git a/tests/auto/declarative/xmlhttprequest/data/send_data.6.qml b/tests/auto/declarative/xmlhttprequest/data/send_data.6.qml new file mode 100644 index 0000000..0bc2e35 --- /dev/null +++ b/tests/auto/declarative/xmlhttprequest/data/send_data.6.qml @@ -0,0 +1,21 @@ +import Qt 4.6 + +Object { + property string url + + property bool dataOK: false + + Component.onCompleted: { + var x = new XMLHttpRequest; + x.open("PUT", url); + + // Test to the end + x.onreadystatechange = function() { + if (x.readyState == XMLHttpRequest.DONE) { + dataOK = (x.responseText == "QML Rocks!\n"); + } + } + + x.send("My Sent Data"); + } +} diff --git a/tests/auto/declarative/xmlhttprequest/data/send_data.reply b/tests/auto/declarative/xmlhttprequest/data/send_data.reply new file mode 100644 index 0000000..35b11f4 --- /dev/null +++ b/tests/auto/declarative/xmlhttprequest/data/send_data.reply @@ -0,0 +1,2 @@ +HTTP/1.0 200 OK +Content-type: text/html; charset=UTF-8 diff --git a/tests/auto/declarative/xmlhttprequest/data/send_ignoreData.qml b/tests/auto/declarative/xmlhttprequest/data/send_ignoreData.qml new file mode 100644 index 0000000..6f33eef --- /dev/null +++ b/tests/auto/declarative/xmlhttprequest/data/send_ignoreData.qml @@ -0,0 +1,26 @@ +import Qt 4.6 + +Object { + property string reqType + property string url + + property bool dataOK: false + + Component.onCompleted: { + var x = new XMLHttpRequest; + x.open(reqType, url); + + // Test to the end + x.onreadystatechange = function() { + if (x.readyState == XMLHttpRequest.DONE) { + if (reqType == "HEAD") + dataOK = (x.responseText == ""); + else + dataOK = (x.responseText == "QML Rocks!\n"); + } + } + + x.send("Data To Ignore"); + } +} + diff --git a/tests/auto/declarative/xmlhttprequest/data/send_ignoreData.reply b/tests/auto/declarative/xmlhttprequest/data/send_ignoreData.reply new file mode 100644 index 0000000..35b11f4 --- /dev/null +++ b/tests/auto/declarative/xmlhttprequest/data/send_ignoreData.reply @@ -0,0 +1,2 @@ +HTTP/1.0 200 OK +Content-type: text/html; charset=UTF-8 diff --git a/tests/auto/declarative/xmlhttprequest/data/send_ignoreData_GET.expect b/tests/auto/declarative/xmlhttprequest/data/send_ignoreData_GET.expect new file mode 100644 index 0000000..40e648e --- /dev/null +++ b/tests/auto/declarative/xmlhttprequest/data/send_ignoreData_GET.expect @@ -0,0 +1,7 @@ +GET /testdocument.html HTTP/1.1 +Connection: Keep-Alive +Accept-Encoding: gzip +accept-language: en,* +User-Agent: Mozilla/5.0 +Host: localhost:14445 + diff --git a/tests/auto/declarative/xmlhttprequest/data/send_ignoreData_PUT.expect b/tests/auto/declarative/xmlhttprequest/data/send_ignoreData_PUT.expect new file mode 100644 index 0000000..381cc89 --- /dev/null +++ b/tests/auto/declarative/xmlhttprequest/data/send_ignoreData_PUT.expect @@ -0,0 +1,7 @@ +HEAD /testdocument.html HTTP/1.1 +Connection: Keep-Alive +Accept-Encoding: gzip +accept-language: en,* +User-Agent: Mozilla/5.0 +Host: localhost:14445 + diff --git a/tests/auto/declarative/xmlhttprequest/data/send_unsent.qml b/tests/auto/declarative/xmlhttprequest/data/send_unsent.qml new file mode 100644 index 0000000..76c26a3 --- /dev/null +++ b/tests/auto/declarative/xmlhttprequest/data/send_unsent.qml @@ -0,0 +1,16 @@ +import Qt 4.6 + +Object { + property bool test: false + + Component.onCompleted: { + var x = new XMLHttpRequest; + + try { + x.send(); + } catch (e) { + if (e.code == DOMException.INVALID_STATE_ERR) + test = true; + } + } +} |