aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/debugger/shared
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 /tests/auto/qml/debugger/shared
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>
Diffstat (limited to 'tests/auto/qml/debugger/shared')
-rw-r--r--tests/auto/qml/debugger/shared/qqmldebugclient.cpp28
-rw-r--r--tests/auto/qml/debugger/shared/qqmldebugclient.h2
2 files changed, 29 insertions, 1 deletions
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();