aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2015-09-25 10:30:59 +0200
committerUlf Hermann <ulf.hermann@theqtcompany.com>2015-10-14 08:03:38 +0000
commit35da68a15c12586415484def802839e67372eac1 (patch)
tree76639f2eba2999e519511d51a42c8693b4f27299 /tests/auto/qml
parent9e15fb156a0ef58584661a0599f1f85d7597e87c (diff)
Provide a threaded TestHTTPServer
This allows us to do blocking operations that interact with the test server in the main thread. The threaded server is used in tests that don't explicitly require asynchronous operation. Change-Id: Ibcb28e79a1114cb9cfb812e86aae0a1af71c569e Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'tests/auto/qml')
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp4
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp24
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp4
3 files changed, 8 insertions, 24 deletions
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index f238bf6b90..b30dfcbd0b 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -4203,9 +4203,7 @@ void tst_qqmlecmascript::importScripts()
QFETCH(QStringList, propertyNames);
QFETCH(QVariantList, propertyValues);
- TestHTTPServer server;
- QVERIFY2(server.listen(), qPrintable(server.errorString()));
- server.serveDirectory(dataDirectory() + "/remote");
+ ThreadedTestHTTPServer server(dataDirectory() + "/remote");
QStringList importPathList = engine.importPathList();
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 3c7584bfa1..f1e12a0c00 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -2543,9 +2543,7 @@ void tst_qqmllanguage::basicRemote()
QFETCH(QString, type);
QFETCH(QString, error);
- TestHTTPServer server;
- QVERIFY2(server.listen(), qPrintable(server.errorString()));
- server.serveDirectory(dataDirectory());
+ ThreadedTestHTTPServer server(dataDirectory());
url = server.baseUrl().resolved(url);
@@ -2590,9 +2588,7 @@ void tst_qqmllanguage::importsRemote()
QFETCH(QString, type);
QFETCH(QString, error);
- TestHTTPServer server;
- QVERIFY2(server.listen(), qPrintable(server.errorString()));
- server.serveDirectory(dataDirectory());
+ ThreadedTestHTTPServer server(dataDirectory());
qml.replace(QStringLiteral("{{ServerBaseUrl}}"), server.baseUrl().toString());
@@ -2685,9 +2681,7 @@ void tst_qqmllanguage::importsInstalledRemote()
QFETCH(QString, type);
QFETCH(QString, error);
- TestHTTPServer server;
- QVERIFY2(server.listen(), qPrintable(server.errorString()));
- server.serveDirectory(dataDirectory());
+ ThreadedTestHTTPServer server(dataDirectory());
QString serverdir = server.urlString("/lib/");
engine.setImportPathList(QStringList(defaultImportPathList) << serverdir);
@@ -2752,9 +2746,7 @@ void tst_qqmllanguage::importsPath()
QFETCH(QString, qml);
QFETCH(QString, value);
- TestHTTPServer server;
- QVERIFY2(server.listen(), qPrintable(server.errorString()));
- server.serveDirectory(dataDirectory());
+ ThreadedTestHTTPServer server(dataDirectory());
for (int i = 0; i < importPath.count(); ++i)
importPath[i].replace(QStringLiteral("{{ServerBaseUrl}}"), server.baseUrl().toString());
@@ -3386,9 +3378,7 @@ void tst_qqmllanguage::registeredCompositeTypeWithAttachedProperty()
// QTBUG-18268
void tst_qqmllanguage::remoteLoadCrash()
{
- TestHTTPServer server;
- QVERIFY2(server.listen(), qPrintable(server.errorString()));
- server.serveDirectory(dataDirectory());
+ ThreadedTestHTTPServer server(dataDirectory());
QQmlComponent component(&engine);
component.setData("import QtQuick 2.0; Text {}", server.url("/remoteLoadCrash.qml"));
@@ -3877,9 +3867,7 @@ void tst_qqmllanguage::compositeSingletonQmlDirError()
// Load a remote composite singleton type via qmldir that defines the type as a singleton
void tst_qqmllanguage::compositeSingletonRemote()
{
- TestHTTPServer server;
- QVERIFY2(server.listen(), qPrintable(server.errorString()));
- server.serveDirectory(dataDirectory());
+ ThreadedTestHTTPServer server(dataDirectory());
QFile f(testFile("singletonTest15.qml"));
QVERIFY(f.open(QIODevice::ReadOnly));
diff --git a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp
index 77fc67a1ac..89477609ca 100644
--- a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp
@@ -239,9 +239,7 @@ void tst_qqmlmoduleplugin::importPluginWithQmlFile()
void tst_qqmlmoduleplugin::remoteImportWithQuotedUrl()
{
- TestHTTPServer server;
- QVERIFY2(server.listen(), qPrintable(server.errorString()));
- server.serveDirectory(m_dataImportsDirectory);
+ ThreadedTestHTTPServer server(m_dataImportsDirectory);
QQmlEngine engine;
QQmlComponent component(&engine);