aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2015-04-27 09:52:51 +0200
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-04-27 14:40:00 +0200
commite2447f9f5fbe6c8c070ce454bb48c5e45b8c35b3 (patch)
tree5ea8ffde57b47a44577ca79b90daafab52eedd1b /tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp
parent8018c4b6e7743c576a3548f6e73e588f19f632a9 (diff)
parent7302bc550aa75600c7cdcf5c3d34404e0a09cf67 (diff)
Merge remote-tracking branch 'origin/5.4' into 5.5
Conflicts: .qmake.conf tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp Change-Id: I715b8a78b74cbe0dcaf599367fd6e08af4858e11
Diffstat (limited to 'tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp')
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp117
1 files changed, 66 insertions, 51 deletions
diff --git a/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp b/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp
index dd70f81d5e..c159dc8420 100644
--- a/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp
+++ b/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp
@@ -38,11 +38,11 @@
#include <QScopedPointer>
#include <QNetworkCookieJar>
#include <QThread>
+#include <QMutex>
+#include <QWaitCondition>
#include "testhttpserver.h"
#include "../../shared/util.h"
-#define SERVER_PORT 14445
-
class tst_qqmlxmlhttprequest : public QQmlDataTest
{
Q_OBJECT
@@ -238,10 +238,11 @@ void tst_qqmlxmlhttprequest::open()
TestHTTPServer server;
if (remote) {
- QVERIFY2(server.listen(SERVER_PORT), qPrintable(server.errorString()));
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
QVERIFY(server.wait(testFileUrl("open_network.expect"),
testFileUrl("open_network.reply"),
testFileUrl("testdocument.html")));
+ url = server.urlString(url);
}
QQmlComponent component(&engine, qmlFile);
@@ -268,10 +269,10 @@ void tst_qqmlxmlhttprequest::open_data()
QTest::newRow("Relative url)") << testFileUrl("open.qml") << "testdocument.html" << false;
QTest::newRow("Absolute url)") << testFileUrl("open.qml") << testFileUrl("testdocument.html").toString() << false;
- QTest::newRow("Absolute network url)") << testFileUrl("open.qml") << "http://127.0.0.1:14445/testdocument.html" << true;
+ QTest::newRow("Absolute network url)") << testFileUrl("open.qml") << "/testdocument.html" << true;
// ### Check that the username/password were sent to the server
- QTest::newRow("User/pass") << testFileUrl("open_user.qml") << "http://127.0.0.1:14445/testdocument.html" << true;
+ QTest::newRow("User/pass") << testFileUrl("open_user.qml") << "/testdocument.html" << true;
}
// Test that calling XMLHttpRequest.open() with an invalid method raises an exception
@@ -290,9 +291,11 @@ class TestThreadedHTTPServer : public QObject
public:
TestThreadedHTTPServer(const QUrl &expectUrl, const QUrl &replyUrl, const QUrl &bodyUrl)
: m_server(Q_NULLPTR) {
+ QMutexLocker locker(&m_lock);
moveToThread(&m_thread);
m_thread.start();
QMetaObject::invokeMethod(this, "start", Qt::QueuedConnection, Q_ARG(QUrl, expectUrl), Q_ARG(QUrl, replyUrl), Q_ARG(QUrl, bodyUrl));
+ m_startupCondition.wait(&m_lock);
}
~TestThreadedHTTPServer() {
m_server->deleteLater();
@@ -300,16 +303,23 @@ public:
m_thread.wait();
}
+ QUrl serverBaseUrl;
+
private slots:
void start(const QUrl &expectUrl, const QUrl &replyUrl, const QUrl &bodyUrl) {
+ QMutexLocker locker(&m_lock);
m_server = new TestHTTPServer;
- QVERIFY2(m_server->listen(SERVER_PORT), qPrintable(m_server->errorString()));
+ QVERIFY2(m_server->listen(), qPrintable(m_server->errorString()));
+ serverBaseUrl = m_server->baseUrl();
QVERIFY(m_server->wait(expectUrl, replyUrl, bodyUrl));
+ m_startupCondition.wakeAll();
}
private:
TestHTTPServer *m_server;
QThread m_thread;
+ QMutex m_lock;
+ QWaitCondition m_startupCondition;
};
// Test that calling XMLHttpRequest.open() with sync
@@ -320,7 +330,7 @@ void tst_qqmlxmlhttprequest::open_sync()
QQmlComponent component(&engine, testFileUrl("open_sync.qml"));
QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
QVERIFY(!object.isNull());
- object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
+ object->setProperty("url", server.serverBaseUrl.resolved(QStringLiteral("/testdocument.html")).toString());
component.completeCreate();
QCOMPARE(object->property("responseText").toString(), QStringLiteral("QML Rocks!\n"));
@@ -350,7 +360,7 @@ void tst_qqmlxmlhttprequest::open_arg_count()
void tst_qqmlxmlhttprequest::setRequestHeader()
{
TestHTTPServer server;
- QVERIFY2(server.listen(SERVER_PORT), qPrintable(server.errorString()));
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
QVERIFY(server.wait(testFileUrl("setRequestHeader.expect"),
testFileUrl("setRequestHeader.reply"),
testFileUrl("testdocument.html")));
@@ -358,7 +368,7 @@ void tst_qqmlxmlhttprequest::setRequestHeader()
QQmlComponent component(&engine, testFileUrl("setRequestHeader.qml"));
QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
QVERIFY(!object.isNull());
- object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
+ object->setProperty("url", server.urlString("/testdocument.html"));
component.completeCreate();
QTRY_VERIFY(object->property("dataOK").toBool() == true);
@@ -368,7 +378,7 @@ void tst_qqmlxmlhttprequest::setRequestHeader()
void tst_qqmlxmlhttprequest::setRequestHeader_caseInsensitive()
{
TestHTTPServer server;
- QVERIFY2(server.listen(SERVER_PORT), qPrintable(server.errorString()));
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
QVERIFY(server.wait(testFileUrl("setRequestHeader.expect"),
testFileUrl("setRequestHeader.reply"),
testFileUrl("testdocument.html")));
@@ -376,7 +386,7 @@ void tst_qqmlxmlhttprequest::setRequestHeader_caseInsensitive()
QQmlComponent component(&engine, testFileUrl("setRequestHeader_caseInsensitive.qml"));
QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
QVERIFY(!object.isNull());
- object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
+ object->setProperty("url", server.urlString("/testdocument.html"));
component.completeCreate();
QTRY_VERIFY(object->property("dataOK").toBool() == true);
@@ -425,7 +435,7 @@ void tst_qqmlxmlhttprequest::setRequestHeader_illegalName()
QFETCH(QString, name);
TestHTTPServer server;
- QVERIFY2(server.listen(SERVER_PORT), qPrintable(server.errorString()));
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
QVERIFY(server.wait(testFileUrl("open_network.expect"),
testFileUrl("open_network.reply"),
testFileUrl("testdocument.html")));
@@ -433,7 +443,7 @@ void tst_qqmlxmlhttprequest::setRequestHeader_illegalName()
QQmlComponent component(&engine, testFileUrl("setRequestHeader_illegalName.qml"));
QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
QVERIFY(!object.isNull());
- object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
+ object->setProperty("url", server.urlString("/testdocument.html"));
object->setProperty("header", name);
component.completeCreate();
@@ -451,7 +461,7 @@ void tst_qqmlxmlhttprequest::setRequestHeader_illegalName()
void tst_qqmlxmlhttprequest::setRequestHeader_sent()
{
TestHTTPServer server;
- QVERIFY2(server.listen(SERVER_PORT), qPrintable(server.errorString()));
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
QVERIFY(server.wait(testFileUrl("open_network.expect"),
testFileUrl("open_network.reply"),
testFileUrl("testdocument.html")));
@@ -459,7 +469,7 @@ void tst_qqmlxmlhttprequest::setRequestHeader_sent()
QQmlComponent component(&engine, testFileUrl("setRequestHeader_sent.qml"));
QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
QVERIFY(!object.isNull());
- object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
+ object->setProperty("url", server.urlString("/testdocument.html"));
component.completeCreate();
QCOMPARE(object->property("test").toBool(), true);
@@ -503,7 +513,7 @@ void tst_qqmlxmlhttprequest::send_ignoreData()
{
{
TestHTTPServer server;
- QVERIFY2(server.listen(SERVER_PORT), qPrintable(server.errorString()));
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
QVERIFY(server.wait(testFileUrl("send_ignoreData_GET.expect"),
testFileUrl("send_ignoreData.reply"),
testFileUrl("testdocument.html")));
@@ -512,7 +522,7 @@ void tst_qqmlxmlhttprequest::send_ignoreData()
QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
QVERIFY(!object.isNull());
object->setProperty("reqType", "GET");
- object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
+ object->setProperty("url", server.urlString("/testdocument.html"));
component.completeCreate();
QTRY_VERIFY(object->property("dataOK").toBool() == true);
@@ -520,7 +530,7 @@ void tst_qqmlxmlhttprequest::send_ignoreData()
{
TestHTTPServer server;
- QVERIFY2(server.listen(SERVER_PORT), qPrintable(server.errorString()));
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
QVERIFY(server.wait(testFileUrl("send_ignoreData_HEAD.expect"),
testFileUrl("send_ignoreData.reply"),
QUrl()));
@@ -529,7 +539,7 @@ void tst_qqmlxmlhttprequest::send_ignoreData()
QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
QVERIFY(!object.isNull());
object->setProperty("reqType", "HEAD");
- object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
+ object->setProperty("url", server.urlString("/testdocument.html"));
component.completeCreate();
QTRY_VERIFY(object->property("dataOK").toBool() == true);
@@ -537,7 +547,7 @@ void tst_qqmlxmlhttprequest::send_ignoreData()
{
TestHTTPServer server;
- QVERIFY2(server.listen(SERVER_PORT), qPrintable(server.errorString()));
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
QVERIFY(server.wait(testFileUrl("send_ignoreData_DELETE.expect"),
testFileUrl("send_ignoreData.reply"),
QUrl()));
@@ -546,7 +556,7 @@ void tst_qqmlxmlhttprequest::send_ignoreData()
QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
QVERIFY(!object.isNull());
object->setProperty("reqType", "DELETE");
- object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
+ object->setProperty("url", server.urlString("/testdocument.html"));
component.completeCreate();
QTRY_VERIFY(object->property("dataOK").toBool() == true);
@@ -560,7 +570,7 @@ void tst_qqmlxmlhttprequest::send_withdata()
QFETCH(QString, file_qml);
TestHTTPServer server;
- QVERIFY2(server.listen(SERVER_PORT), qPrintable(server.errorString()));
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
QVERIFY(server.wait(testFileUrl(file_expected),
testFileUrl("send_data.reply"),
testFileUrl("testdocument.html")));
@@ -568,7 +578,7 @@ void tst_qqmlxmlhttprequest::send_withdata()
QQmlComponent component(&engine, testFileUrl(file_qml));
QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
QVERIFY(!object.isNull());
- object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
+ object->setProperty("url", server.urlString("/testdocument.html"));
component.completeCreate();
QTRY_VERIFY(object->property("dataOK").toBool() == true);
@@ -596,7 +606,7 @@ void tst_qqmlxmlhttprequest::send_options()
QFETCH(QString, file_reply);
TestHTTPServer server;
- QVERIFY2(server.listen(SERVER_PORT), qPrintable(server.errorString()));
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
QVERIFY(server.wait(testFileUrl(file_expected),
testFileUrl(file_reply),
testFileUrl("testdocument.html")));
@@ -604,7 +614,7 @@ void tst_qqmlxmlhttprequest::send_options()
QQmlComponent component(&engine, testFileUrl(file_qml));
QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
QVERIFY(!object.isNull());
- QString url = "http://127.0.0.1:14445";
+ QString url = server.baseUrl().toString();
if (url_suffix != "/")
url.append("/");
if (!url_suffix.isEmpty())
@@ -671,7 +681,7 @@ void tst_qqmlxmlhttprequest::abort_opened()
void tst_qqmlxmlhttprequest::abort()
{
TestHTTPServer server;
- QVERIFY2(server.listen(SERVER_PORT), qPrintable(server.errorString()));
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
QVERIFY(server.wait(testFileUrl("abort.expect"),
testFileUrl("abort.reply"),
testFileUrl("testdocument.html")));
@@ -679,8 +689,11 @@ void tst_qqmlxmlhttprequest::abort()
QQmlComponent component(&engine, testFileUrl("abort.qml"));
QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
QVERIFY(!object.isNull());
- object->setProperty("urlDummy", "http://127.0.0.1:14449/testdocument.html");
- object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
+ const QUrl url = server.url("/testdocument.html");
+ QUrl dummyUrl = url;
+ dummyUrl.setPort(dummyUrl.port() - 1);
+ object->setProperty("urlDummy", dummyUrl.toString());
+ object->setProperty("url", url.toString());
component.completeCreate();
QCOMPARE(object->property("seenDone").toBool(), true);
@@ -695,7 +708,7 @@ void tst_qqmlxmlhttprequest::getResponseHeader()
QQmlEngine engine; // Avoid cookie contamination
TestHTTPServer server;
- QVERIFY2(server.listen(SERVER_PORT), qPrintable(server.errorString()));
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
QVERIFY(server.wait(testFileUrl("getResponseHeader.expect"),
testFileUrl("getResponseHeader.reply"),
testFileUrl("testdocument.html")));
@@ -704,7 +717,7 @@ void tst_qqmlxmlhttprequest::getResponseHeader()
QQmlComponent component(&engine, testFileUrl("getResponseHeader.qml"));
QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
QVERIFY(!object.isNull());
- object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
+ object->setProperty("url", server.urlString("/testdocument.html"));
component.completeCreate();
QCOMPARE(object->property("unsentException").toBool(), true);
@@ -762,7 +775,7 @@ void tst_qqmlxmlhttprequest::getAllResponseHeaders()
QQmlEngine engine; // Avoid cookie contamination
TestHTTPServer server;
- QVERIFY2(server.listen(SERVER_PORT), qPrintable(server.errorString()));
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
QVERIFY(server.wait(testFileUrl("getResponseHeader.expect"),
testFileUrl("getResponseHeader.reply"),
testFileUrl("testdocument.html")));
@@ -770,7 +783,7 @@ void tst_qqmlxmlhttprequest::getAllResponseHeaders()
QQmlComponent component(&engine, testFileUrl("getAllResponseHeaders.qml"));
QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
QVERIFY(!object.isNull());
- object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
+ object->setProperty("url", server.urlString("/testdocument.html"));
component.completeCreate();
QCOMPARE(object->property("unsentException").toBool(), true);
@@ -820,7 +833,7 @@ void tst_qqmlxmlhttprequest::getAllResponseHeaders_args()
void tst_qqmlxmlhttprequest::getBinaryData()
{
TestHTTPServer server;
- QVERIFY2(server.listen(SERVER_PORT), qPrintable(server.errorString()));
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
QVERIFY(server.wait(testFileUrl("receive_binary_data.expect"),
testFileUrl("receive_binary_data.reply"),
testFileUrl("qml_logo.png")));
@@ -828,7 +841,7 @@ void tst_qqmlxmlhttprequest::getBinaryData()
QQmlComponent component(&engine, testFileUrl("receiveBinaryData.qml"));
QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
QVERIFY(!object.isNull());
- object->setProperty("url", "http://127.0.0.1:14445/gml_logo.png");
+ object->setProperty("url", server.urlString("/gml_logo.png"));
component.completeCreate();
QFileInfo fileInfo("data/qml_logo.png");
@@ -841,7 +854,7 @@ void tst_qqmlxmlhttprequest::status()
QFETCH(int, status);
TestHTTPServer server;
- QVERIFY2(server.listen(SERVER_PORT), qPrintable(server.errorString()));
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
QVERIFY(server.wait(testFileUrl("status.expect"),
replyUrl,
testFileUrl("testdocument.html")));
@@ -849,7 +862,7 @@ void tst_qqmlxmlhttprequest::status()
QQmlComponent component(&engine, testFileUrl("status.qml"));
QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
QVERIFY(!object.isNull());
- object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
+ object->setProperty("url", server.urlString("/testdocument.html"));
object->setProperty("expectedStatus", status);
component.completeCreate();
@@ -880,7 +893,7 @@ void tst_qqmlxmlhttprequest::statusText()
QFETCH(QString, statusText);
TestHTTPServer server;
- QVERIFY2(server.listen(SERVER_PORT), qPrintable(server.errorString()));
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
QVERIFY(server.wait(testFileUrl("status.expect"),
replyUrl,
testFileUrl("testdocument.html")));
@@ -888,7 +901,7 @@ void tst_qqmlxmlhttprequest::statusText()
QQmlComponent component(&engine, testFileUrl("statusText.qml"));
QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
QVERIFY(!object.isNull());
- object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
+ object->setProperty("url", server.urlString("/testdocument.html"));
object->setProperty("expectedStatus", statusText);
component.completeCreate();
@@ -920,7 +933,7 @@ void tst_qqmlxmlhttprequest::responseText()
QFETCH(QString, responseText);
TestHTTPServer server;
- QVERIFY2(server.listen(SERVER_PORT), qPrintable(server.errorString()));
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
QVERIFY(server.wait(testFileUrl("status.expect"),
replyUrl,
bodyUrl));
@@ -928,7 +941,7 @@ void tst_qqmlxmlhttprequest::responseText()
QQmlComponent component(&engine, testFileUrl("responseText.qml"));
QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
QVERIFY(!object.isNull());
- object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
+ object->setProperty("url", server.urlString("/testdocument.html"));
object->setProperty("expectedText", responseText);
component.completeCreate();
@@ -1021,14 +1034,14 @@ void tst_qqmlxmlhttprequest::redirects()
{
{
TestHTTPServer server;
- QVERIFY2(server.listen(SERVER_PORT), qPrintable(server.errorString()));
- server.addRedirect("redirect.html", "http://127.0.0.1:14445/redirecttarget.html");
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
+ server.addRedirect("redirect.html", server.urlString("/redirecttarget.html"));
server.serveDirectory(dataDirectory());
QQmlComponent component(&engine, testFileUrl("redirects.qml"));
QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
QVERIFY(!object.isNull());
- object->setProperty("url", "http://127.0.0.1:14445/redirect.html");
+ object->setProperty("url", server.urlString("/redirect.html"));
object->setProperty("expectedText", "");
component.completeCreate();
@@ -1038,14 +1051,14 @@ void tst_qqmlxmlhttprequest::redirects()
{
TestHTTPServer server;
- QVERIFY2(server.listen(SERVER_PORT), qPrintable(server.errorString()));
- server.addRedirect("redirect.html", "http://127.0.0.1:14445/redirectmissing.html");
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
+ server.addRedirect("redirect.html", server.urlString("/redirectmissing.html"));
server.serveDirectory(dataDirectory());
QQmlComponent component(&engine, testFileUrl("redirectError.qml"));
QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
QVERIFY(!object.isNull());
- object->setProperty("url", "http://127.0.0.1:14445/redirect.html");
+ object->setProperty("url", server.urlString("/redirect.html"));
object->setProperty("expectedText", "");
component.completeCreate();
@@ -1055,14 +1068,14 @@ void tst_qqmlxmlhttprequest::redirects()
{
TestHTTPServer server;
- QVERIFY2(server.listen(SERVER_PORT), qPrintable(server.errorString()));
- server.addRedirect("redirect.html", "http://127.0.0.1:14445/redirect.html");
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
+ server.addRedirect("redirect.html", server.urlString("/redirect.html"));
server.serveDirectory(dataDirectory());
QQmlComponent component(&engine, testFileUrl("redirectRecur.qml"));
QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
QVERIFY(!object.isNull());
- object->setProperty("url", "http://127.0.0.1:14445/redirect.html");
+ object->setProperty("url", server.urlString("/redirect.html"));
object->setProperty("expectedText", "");
component.completeCreate();
@@ -1157,12 +1170,14 @@ void tst_qqmlxmlhttprequest::stateChangeCallingContext()
// without a valid calling context.
TestHTTPServer server;
- QVERIFY2(server.listen(SERVER_PORT), qPrintable(server.errorString()));
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
server.serveDirectory(dataDirectory(), TestHTTPServer::Delay);
QQmlComponent component(&engine, testFileUrl("stateChangeCallingContext.qml"));
- QScopedPointer<QObject> object(component.create());
+ QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
QVERIFY(!object.isNull());
+ object->setProperty("serverBaseUrl", server.baseUrl().toString());
+ component.completeCreate();
server.sendDelayedItem();
QTRY_VERIFY(object->property("success").toBool() == true);
}