aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp
diff options
context:
space:
mode:
authorValery Kotov <kotov.valery@gmail.com>2015-05-31 22:47:50 +0300
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-07-18 16:36:26 +0000
commitf21df860fcc97fe47334d0f8d4675d515987cc8a (patch)
treeeddbcf9ef51c7f9836c7a72ae243d7cb639e11e4 /tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp
parentcb61de50c3fffd9085975205de91409ee86b80b2 (diff)
QML Engine: Support for "PROPFIND" method for XMLHTTPRequest
Support for WevDAV PROPFIND method was added to QQmlXMLHttpRequest. Tests for PROPFIND method in XMLHttpRequest were added. [ChangeLog][QtQml][QQmlXMLHttpRequest] QQmlXMLHttpRequest now supports the PROPFIND method in HTTP requests. Task-number: QTBUG-36456 Change-Id: Ie36fcc901e7c1583840f04166c1774a1defe9308 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp')
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp b/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp
index 56314a29f5..d7f0d3bb79 100644
--- a/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp
+++ b/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp
@@ -101,6 +101,10 @@ private slots:
void nonUtf8();
void nonUtf8_data();
+ // WebDAV
+ void sendPropfind();
+ void sendPropfind_data();
+
// Attributes
void document();
void element();
@@ -1026,6 +1030,46 @@ void tst_qqmlxmlhttprequest::nonUtf8_data()
QTest::newRow("responseXML") << "utf16.xml" << "<?xml version=\"1.0\" encoding=\"UTF-16\" standalone='yes'?>\n<root>\n" + uc + "\n</root>\n" << QString('\n' + uc + '\n');
}
+void tst_qqmlxmlhttprequest::sendPropfind()
+{
+ const QString prefix = "WebDAV//";
+
+ QFETCH(QString, qml);
+ QFETCH(QString, resource);
+ QFETCH(QString, expectedFile);
+ QFETCH(QString, replyHeader);
+ QFETCH(QString, replyBody);
+
+ TestHTTPServer server;
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
+
+ QVERIFY(server.wait(testFileUrl(prefix + expectedFile),
+ testFileUrl(prefix + replyHeader),
+ testFileUrl(prefix + replyBody)));
+
+ QQmlComponent component(&engine, testFileUrl(prefix + qml));
+ QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
+ QVERIFY(!object.isNull());
+ object->setProperty("url", server.urlString(resource));
+ component.completeCreate();
+
+ QTRY_VERIFY(object->property("xmlTest").toBool());
+ QCOMPARE(object->property("typeTest").toBool(), true);
+}
+
+void tst_qqmlxmlhttprequest::sendPropfind_data()
+{
+ QTest::addColumn<QString>("qml");
+ QTest::addColumn<QString>("resource");
+ QTest::addColumn<QString>("expectedFile");
+ QTest::addColumn<QString>("replyHeader");
+ QTest::addColumn<QString>("replyBody");
+
+ QTest::newRow("Send PROPFIND for file (bigbox, author, DingALing, Random properties). Get response with responseXML.") << "sendPropfind.responseXML.qml" << "/file" << "propfind.file.expect" << "propfind.file.reply.header" << "propfind.file.reply.body";
+ QTest::newRow("Send PROPFIND for file (bigbox, author, DingALing, Random properties). Get response with response.") << "sendPropfind.response.qml" << "/file" << "propfind.file.expect" << "propfind.file.reply.header" << "propfind.file.reply.body";
+ QTest::newRow("Send PROPFIND \"allprop\" request for collection.") << "sendPropfind.collection.allprop.qml" << "/container/" << "propfind.collection.allprop.expect" << "propfind.file.reply.header" << "propfind.collection.allprop.reply.body";
+}
+
// Test that calling hte XMLHttpRequest methods on a non-XMLHttpRequest object
// throws an exception
void tst_qqmlxmlhttprequest::invalidMethodUsage()