aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2015-04-22 17:15:30 +0200
committerFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2015-04-25 12:02:55 +0000
commit79d56651edc05133ebae13bb93733373b10380f9 (patch)
treed60393857c0f1b28f9e34c55f4461e2f25c99a9e /tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
parentbfd596f36724029441d54095a126d25168e105c1 (diff)
Prospective fix for flakey "network" related QML testsv5.4.2
Replace hard-coded server ports with dynamically allocated ports. Change-Id: Iab8f9a88343a9f2c49af3cd700c954c13c3bf121 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp')
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 38a2affe3a..839f71b8f8 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -4204,12 +4204,12 @@ void tst_qqmlecmascript::importScripts()
QFETCH(QVariantList, propertyValues);
TestHTTPServer server;
- QVERIFY2(server.listen(8111), qPrintable(server.errorString()));
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
server.serveDirectory(dataDirectory() + "/remote");
QStringList importPathList = engine.importPathList();
- QString remotePath(QLatin1String("http://127.0.0.1:8111/"));
+ QString remotePath(server.urlString("/"));
engine.addImportPath(remotePath);
QQmlComponent component(&engine, testfile);
@@ -6055,12 +6055,14 @@ void tst_qqmlecmascript::include()
// Remote - error
{
TestHTTPServer server;
- QVERIFY2(server.listen(8111), qPrintable(server.errorString()));
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
server.serveDirectory(dataDirectory());
QQmlComponent component(&engine, testFileUrl("include_remote_missing.qml"));
- QObject *o = component.create();
+ QObject *o = component.beginCreate(engine.rootContext());
QVERIFY(o != 0);
+ o->setProperty("serverBaseUrl", server.baseUrl().toString());
+ component.completeCreate();
QTRY_VERIFY(o->property("done").toBool() == true);
@@ -6097,12 +6099,14 @@ void tst_qqmlecmascript::includeRemoteSuccess()
// Remote - success
TestHTTPServer server;
- QVERIFY2(server.listen(8111), qPrintable(server.errorString()));
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
server.serveDirectory(dataDirectory());
QQmlComponent component(&engine, testFileUrl("include_remote.qml"));
- QObject *o = component.create();
+ QObject *o = component.beginCreate(engine.rootContext());
QVERIFY(o != 0);
+ o->setProperty("serverBaseUrl", server.baseUrl().toString());
+ component.completeCreate();
QTRY_VERIFY(o->property("done").toBool() == true);
QTRY_VERIFY(o->property("done2").toBool() == true);