aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2015-08-10 15:13:09 +0200
committerUlf Hermann <ulf.hermann@theqtcompany.com>2015-10-15 08:20:41 +0000
commit36cbf6a62aec4de253e935291bdd33370e7b7faa (patch)
tree3826f1b70498069f2e02b9c6a06ac7588378fa95
parent7063fefe4b5e866b27001bb9b911fc2f68034e40 (diff)
Properly test services arguments for QQmlDebugServer
So far we have only tested that each service is still functional when the services:<service> argument is given on the command line. This test checks that services which aren't specified are indeed not loaded. Change-Id: Ica935da0337b2215898f65cf283d6e11365432a8 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp6
-rw-r--r--tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp5
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp5
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp4
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp5
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp6
-rw-r--r--tests/auto/qml/debugger/shared/qqmldebugclient.cpp28
-rw-r--r--tests/auto/qml/debugger/shared/qqmldebugclient.h2
8 files changed, 60 insertions, 1 deletions
diff --git a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
index 7dbe35807d..c22adbcc36 100644
--- a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
+++ b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
@@ -831,6 +831,7 @@ void tst_QQmlDebugJS::init(const QString &qmlFile, bool blockMode, bool restrict
connection = new QQmlDebugConnection();
process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", this);
client = new QJSDebugClient(connection);
+ QList<QQmlDebugClient *> others = connection->createOtherClients();
const char *args = 0;
if (blockMode)
@@ -849,6 +850,11 @@ void tst_QQmlDebugJS::init(const QString &qmlFile, bool blockMode, bool restrict
if (client->state() != QQmlDebugClient::Enabled)
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(enabled())));
+
+ foreach (QQmlDebugClient *otherClient, others)
+ QCOMPARE(otherClient->state(), restrictServices ? QQmlDebugClient::Unavailable :
+ QQmlDebugClient::Enabled);
+ qDeleteAll(others);
}
void tst_QQmlDebugJS::cleanup()
diff --git a/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp b/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp
index 11fa56d710..6c21ba27d7 100644
--- a/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp
+++ b/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp
@@ -167,11 +167,16 @@ void tst_QQmlEngineControl::connect(const QString &testFile, bool restrictServic
m_connection = new QQmlDebugConnection();
m_client = new QQmlEngineControlClient(m_connection);
+ QList<QQmlDebugClient *> others = m_connection->createOtherClients();
const int port = m_process->debugPort();
m_connection->connectToHost(QLatin1String("127.0.0.1"), port);
QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
+ foreach (QQmlDebugClient *other, others)
+ QCOMPARE(other->state(), restrictServices ? QQmlDebugClient::Unavailable :
+ QQmlDebugClient::Enabled);
+ qDeleteAll(others);
}
void tst_QQmlEngineControl::cleanup()
diff --git a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp
index 0285bae189..adf46c8dab 100644
--- a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp
+++ b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp
@@ -111,9 +111,14 @@ void tst_QQmlEngineDebugInspectorIntegration::init(bool restrictServices)
QQmlDebugConnection *m_connection = new QQmlDebugConnection(this);
m_inspectorClient = new QQmlInspectorClient(m_connection);
m_engineDebugClient = new QQmlEngineDebugClient(m_connection);
+ QList<QQmlDebugClient *> others = m_connection->createOtherClients();
m_connection->connectToHost(QLatin1String("127.0.0.1"), m_process->debugPort());
QVERIFY(m_connection->waitForConnected());
+ foreach (QQmlDebugClient *other, others)
+ QCOMPARE(other->state(), restrictServices ? QQmlDebugClient::Unavailable :
+ QQmlDebugClient::Enabled);
+ qDeleteAll(others);
}
void tst_QQmlEngineDebugInspectorIntegration::cleanup()
diff --git a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
index bc3220ad8c..653af61be5 100644
--- a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
+++ b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
@@ -352,7 +352,11 @@ void tst_QQmlEngineDebugService::initTestCase()
bool ok = m_conn->waitForConnected();
QVERIFY(ok);
m_dbg = new QQmlEngineDebugClient(m_conn);
+ QList<QQmlDebugClient *> others = m_conn->createOtherClients();
QTRY_COMPARE(m_dbg->state(), QQmlEngineDebugClient::Enabled);
+ foreach (QQmlDebugClient *other, others)
+ QCOMPARE(other->state(), QQmlDebugClient::Unavailable);
+ qDeleteAll(others);
}
void tst_QQmlEngineDebugService::cleanupTestCase()
diff --git a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
index 70833f5e2c..5d3583a5d2 100644
--- a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
+++ b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
@@ -91,11 +91,16 @@ void tst_QQmlInspector::startQmlsceneProcess(const char * /* qmlFile */, bool re
m_connection = new QQmlDebugConnection();
m_client = new QQmlInspectorClient(m_connection);
+ QList<QQmlDebugClient *> others = m_connection->createOtherClients();
m_connection->connectToHost(QLatin1String("127.0.0.1"), m_process->debugPort());
QVERIFY(m_client);
QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
+ foreach (QQmlDebugClient *other, others)
+ QCOMPARE(other->state(), restrictServices ? QQmlDebugClient::Unavailable :
+ QQmlDebugClient::Enabled);
+ qDeleteAll(others);
}
void tst_QQmlInspector::cleanup()
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
index 0e63e18952..17e3260026 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
@@ -373,11 +373,17 @@ void tst_QQmlProfilerService::connect(bool block, const QString &testFile, bool
m_connection = new QQmlDebugConnection();
m_client = new QQmlProfilerClient(m_connection);
+ QList<QQmlDebugClient *> others = m_connection->createOtherClients();
const int port = m_process->debugPort();
m_connection->connectToHost(QLatin1String("127.0.0.1"), port);
QVERIFY(m_client);
QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
+
+ foreach (QQmlDebugClient *other, others)
+ QCOMPARE(other->state(), restrictServices ? QQmlDebugClient::Unavailable :
+ QQmlDebugClient::Enabled);
+ qDeleteAll(others);
}
void tst_QQmlProfilerService::checkTraceReceived()
diff --git a/tests/auto/qml/debugger/shared/qqmldebugclient.cpp b/tests/auto/qml/debugger/shared/qqmldebugclient.cpp
index 0f7e572e02..f350614a47 100644
--- a/tests/auto/qml/debugger/shared/qqmldebugclient.cpp
+++ b/tests/auto/qml/debugger/shared/qqmldebugclient.cpp
@@ -41,6 +41,7 @@
#include <QtNetwork/qnetworkproxy.h>
#include <QtNetwork/qlocalserver.h>
#include <QtNetwork/qlocalsocket.h>
+#include <QtQml/qqmldebug.h>
const int protocolVersion = 1;
const QString serverId = QLatin1String("QDeclarativeDebugServer");
@@ -70,6 +71,7 @@ public:
bool gotHello;
QHash <QString, float> serverPlugins;
QHash<QString, QQmlDebugClient *> plugins;
+ QStringList removedPlugins;
void advertisePlugins();
void connectDeviceSignals();
@@ -224,7 +226,11 @@ void QQmlDebugConnectionPrivate::readyRead()
QHash<QString, QQmlDebugClient *>::Iterator iter =
plugins.find(name);
if (iter == plugins.end()) {
- qWarning() << "QQmlDebugConnection: Message received for missing plugin" << name;
+ // We can get more messages for plugins we have removed because it takes time to
+ // send the advertisement message but the removal is instant locally.
+ if (!removedPlugins.contains(name))
+ qWarning() << "QQmlDebugConnection: Message received for missing plugin"
+ << name;
} else {
(*iter)->messageReceived(message);
}
@@ -440,6 +446,7 @@ QQmlDebugClient::QQmlDebugClient(const QString &name,
qWarning() << "QQmlDebugClient: Conflicting plugin name" << name;
d->connection = 0;
} else {
+ d->connection->d->removedPlugins.removeAll(name);
d->connection->d->plugins.insert(name, this);
d->connection->d->advertisePlugins();
}
@@ -449,6 +456,7 @@ QQmlDebugClient::~QQmlDebugClient()
{
if (d->connection && d->connection->d) {
d->connection->d->plugins.remove(d->name);
+ d->connection->d->removedPlugins.append(d->name);
d->connection->d->advertisePlugins();
}
delete d;
@@ -500,6 +508,24 @@ void QQmlDebugClient::sendMessage(const QByteArray &message)
d->connection->flush();
}
+QList<QQmlDebugClient *> QQmlDebugConnection::createOtherClients()
+{
+ QList<QQmlDebugClient *> ret;
+ foreach (const QString &service, QQmlDebuggingEnabler::debuggerServices()) {
+ if (!d->plugins.contains(service))
+ ret << new QQmlDebugClient(service, this);
+ }
+ foreach (const QString &service, QQmlDebuggingEnabler::inspectorServices()) {
+ if (!d->plugins.contains(service))
+ ret << new QQmlDebugClient(service, this);
+ }
+ foreach (const QString &service, QQmlDebuggingEnabler::profilerServices()) {
+ if (!d->plugins.contains(service))
+ ret << new QQmlDebugClient(service, this);
+ }
+ return ret;
+}
+
void QQmlDebugClient::stateChanged(State)
{
}
diff --git a/tests/auto/qml/debugger/shared/qqmldebugclient.h b/tests/auto/qml/debugger/shared/qqmldebugclient.h
index fe9da693c8..659f7c8631 100644
--- a/tests/auto/qml/debugger/shared/qqmldebugclient.h
+++ b/tests/auto/qml/debugger/shared/qqmldebugclient.h
@@ -36,6 +36,7 @@
#include <QtNetwork/qtcpsocket.h>
+class QQmlDebugClient;
class QQmlDebugConnectionPrivate;
class QQmlDebugConnection : public QIODevice
{
@@ -60,6 +61,7 @@ public:
bool waitForConnected(int msecs = 30000);
QString stateString() const;
+ QList<QQmlDebugClient *> createOtherClients();
signals:
void connected();