aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2015-07-13 16:38:25 +0200
committerUlf Hermann <ulf.hermann@theqtcompany.com>2015-07-30 14:55:19 +0000
commit6557b7118897347ccf7c5915c169cf86c818be83 (patch)
treee7e67d77b5255222edbd620bd6ae77ec50052ee4
parent52e782bdc56fb3a62b045f2d1ca71f38bc7ef796 (diff)
Make QQmlDebugService::registerService() private and part of ctor
By forcing all debug services to register before the thread starts we can get rid of the complicated thread synchronization and have a more natural API for the services. We can also better enforce the thread situation when registering services in QQmlDebugServer now. QQmlProfilerService should not moveToThread() in its constructor as the thread has not been started, yet. The thread affinity of QQmlProfilerService doesn't make any difference anyway, as all relevant methods are protected by mutexes and it doesn't have any slots. Change-Id: I57db9e2bf94ec6884ede694715dadf5bfd687334 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
-rw-r--r--src/qml/debugger/qdebugmessageservice.cpp1
-rw-r--r--src/qml/debugger/qqmlconfigurabledebugservice.cpp2
-rw-r--r--src/qml/debugger/qqmldebugserver.cpp17
-rw-r--r--src/qml/debugger/qqmldebugservice.cpp15
-rw-r--r--src/qml/debugger/qqmlenginecontrolservice.cpp2
-rw-r--r--src/qml/debugger/qqmlenginedebugservice.cpp2
-rw-r--r--src/qml/debugger/qqmlinspectorservice.cpp1
-rw-r--r--src/qml/debugger/qqmlprofilerservice.cpp5
-rw-r--r--tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp39
-rw-r--r--tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp40
-rw-r--r--tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp76
-rw-r--r--tests/auto/qml/debugger/shared/qqmldebugtestservice.cpp1
12 files changed, 81 insertions, 120 deletions
diff --git a/src/qml/debugger/qdebugmessageservice.cpp b/src/qml/debugger/qdebugmessageservice.cpp
index 9d5d5d0d9c..4483cf1573 100644
--- a/src/qml/debugger/qdebugmessageservice.cpp
+++ b/src/qml/debugger/qdebugmessageservice.cpp
@@ -67,7 +67,6 @@ QDebugMessageService::QDebugMessageService(QObject *parent) :
// don't execute stateChanged() in parallel
QMutexLocker lock(&d->initMutex);
- registerService();
if (state() == Enabled) {
d->oldMsgHandler = qInstallMessageHandler(DebugMessageHandler);
d->prevState = Enabled;
diff --git a/src/qml/debugger/qqmlconfigurabledebugservice.cpp b/src/qml/debugger/qqmlconfigurabledebugservice.cpp
index aa5e69b63d..9382cea42e 100644
--- a/src/qml/debugger/qqmlconfigurabledebugservice.cpp
+++ b/src/qml/debugger/qqmlconfigurabledebugservice.cpp
@@ -41,7 +41,6 @@ QQmlConfigurableDebugService::QQmlConfigurableDebugService(const QString &name,
QObject *parent) :
QQmlDebugService((*new QQmlConfigurableDebugServicePrivate(name, version)), parent)
{
- registerService();
init();
}
@@ -49,7 +48,6 @@ QQmlConfigurableDebugService::QQmlConfigurableDebugService(QQmlDebugServicePriva
QObject *parent) :
QQmlDebugService(dd, parent)
{
- registerService();
init();
}
diff --git a/src/qml/debugger/qqmldebugserver.cpp b/src/qml/debugger/qqmldebugserver.cpp
index 4974bce8d8..da2eac79ed 100644
--- a/src/qml/debugger/qqmldebugserver.cpp
+++ b/src/qml/debugger/qqmldebugserver.cpp
@@ -701,6 +701,9 @@ QQmlDebugService *QQmlDebugServerImpl::service(const QString &name) const
void QQmlDebugServerImpl::addEngine(QQmlEngine *engine)
{
+ // to be executed outside of debugger thread
+ Q_ASSERT(QThread::currentThread() != m_thread);
+
QWriteLocker lock(&m_pluginsLock);
foreach (QQmlDebugService *service, m_plugins)
@@ -714,6 +717,9 @@ void QQmlDebugServerImpl::addEngine(QQmlEngine *engine)
void QQmlDebugServerImpl::removeEngine(QQmlEngine *engine)
{
+ // to be executed outside of debugger thread
+ Q_ASSERT(QThread::currentThread() != m_thread);
+
QWriteLocker lock(&m_pluginsLock);
foreach (QQmlDebugService *service, m_plugins)
@@ -727,8 +733,8 @@ void QQmlDebugServerImpl::removeEngine(QQmlEngine *engine)
bool QQmlDebugServerImpl::addService(QQmlDebugService *service)
{
- // to be executed outside of debugger thread
- Q_ASSERT(!m_thread || QThread::currentThread() != thread());
+ // to be executed before thread starts
+ Q_ASSERT(!m_thread);
connect(service, SIGNAL(attachedToEngine(QQmlEngine*)),
this, SLOT(wakeEngine(QQmlEngine*)), Qt::QueuedConnection);
@@ -750,8 +756,8 @@ bool QQmlDebugServerImpl::addService(QQmlDebugService *service)
bool QQmlDebugServerImpl::removeService(QQmlDebugService *service)
{
- // to be executed outside of debugger thread
- Q_ASSERT(!m_thread || QThread::currentThread() != thread());
+ // to be executed after thread ends
+ Q_ASSERT(!m_thread);
QWriteLocker lock(&m_pluginsLock);
QQmlDebugService::State newState = QQmlDebugService::NotConnected;
@@ -816,9 +822,6 @@ void QQmlDebugServerImpl::wakeEngine(QQmlEngine *engine)
bool QQmlDebugServerImpl::EngineCondition::waitForServices(QReadWriteLock *locked, int num)
{
- // to be executed outside of debugger thread
- Q_ASSERT(QThread::currentThread() != QQmlDebugServer::instance()->thread());
-
Q_ASSERT_X(numServices == 0, Q_FUNC_INFO, "Request to wait again before previous wait finished");
numServices = num;
return numServices > 0 ? condition->wait(locked) : true;
diff --git a/src/qml/debugger/qqmldebugservice.cpp b/src/qml/debugger/qqmldebugservice.cpp
index a406d99fff..44f42af5e4 100644
--- a/src/qml/debugger/qqmldebugservice.cpp
+++ b/src/qml/debugger/qqmldebugservice.cpp
@@ -51,12 +51,13 @@ QQmlDebugServicePrivate::QQmlDebugServicePrivate(const QString &name, float vers
QQmlDebugService::QQmlDebugService(const QString &name, float version, QObject *parent)
: QObject(*(new QQmlDebugServicePrivate(name, version)), parent)
{
- QQmlDebugConnector::instance(); // create it when it isn't there yet.
+ registerService();
}
QQmlDebugService::QQmlDebugService(QQmlDebugServicePrivate &dd, QObject *parent)
: QObject(dd, parent)
{
+ registerService();
}
/**
@@ -81,8 +82,16 @@ QQmlDebugService::State QQmlDebugService::registerService()
QQmlDebugService::~QQmlDebugService()
{
- if (QQmlDebugConnector *inst = QQmlDebugConnector::instance())
- inst->removeService(this);
+ Q_D(QQmlDebugService);
+ QQmlDebugConnector *server = QQmlDebugConnector::instance();
+
+ if (!server)
+ return;
+
+ if (server->service(d->name) != this)
+ qWarning() << "QQmlDebugService: Plugin" << d->name << "is not registered.";
+ else
+ server->removeService(this);
}
const QString &QQmlDebugService::name() const
diff --git a/src/qml/debugger/qqmlenginecontrolservice.cpp b/src/qml/debugger/qqmlenginecontrolservice.cpp
index 07c6715524..ed3fc9e1de 100644
--- a/src/qml/debugger/qqmlenginecontrolservice.cpp
+++ b/src/qml/debugger/qqmlenginecontrolservice.cpp
@@ -42,8 +42,6 @@ Q_GLOBAL_STATIC(QQmlEngineControlService, qmlEngineControlService)
QQmlEngineControlService::QQmlEngineControlService() :
QQmlDebugService(QStringLiteral("EngineControl"), 1)
{
- QMutexLocker lock(&dataMutex);
- registerService();
}
QQmlEngineControlService *QQmlEngineControlService::instance()
diff --git a/src/qml/debugger/qqmlenginedebugservice.cpp b/src/qml/debugger/qqmlenginedebugservice.cpp
index ac49d99f09..ad8f4fb15a 100644
--- a/src/qml/debugger/qqmlenginedebugservice.cpp
+++ b/src/qml/debugger/qqmlenginedebugservice.cpp
@@ -67,8 +67,6 @@ QQmlEngineDebugService::QQmlEngineDebugService(QObject *parent)
{
QObject::connect(m_watch, SIGNAL(propertyChanged(int,int,QMetaProperty,QVariant)),
this, SLOT(propertyChanged(int,int,QMetaProperty,QVariant)));
-
- registerService();
}
QQmlEngineDebugService::~QQmlEngineDebugService()
diff --git a/src/qml/debugger/qqmlinspectorservice.cpp b/src/qml/debugger/qqmlinspectorservice.cpp
index 7cd8b796ec..e3c7ad7d55 100644
--- a/src/qml/debugger/qqmlinspectorservice.cpp
+++ b/src/qml/debugger/qqmlinspectorservice.cpp
@@ -54,7 +54,6 @@ QQmlInspectorService::QQmlInspectorService()
: QQmlDebugService(QStringLiteral("QmlInspector"), 1)
, m_currentInspectorPlugin(0)
{
- registerService();
}
QQmlInspectorService *QQmlInspectorService::instance()
diff --git a/src/qml/debugger/qqmlprofilerservice.cpp b/src/qml/debugger/qqmlprofilerservice.cpp
index 4062f2f33c..e48771090e 100644
--- a/src/qml/debugger/qqmlprofilerservice.cpp
+++ b/src/qml/debugger/qqmlprofilerservice.cpp
@@ -51,11 +51,6 @@ QQmlProfilerService::QQmlProfilerService()
: QQmlConfigurableDebugService(QStringLiteral("CanvasFrameRate"), 1)
{
m_timer.start();
-
- QMutexLocker lock(configMutex());
- // If there is no debug server it doesn't matter as we'll never get enabled anyway.
- if (QQmlDebugConnector::instance() != 0)
- moveToThread(QQmlDebugConnector::instance()->thread());
}
QQmlProfilerService::~QQmlProfilerService()
diff --git a/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp b/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp
index 7a8411c49f..6fc6c6a914 100644
--- a/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp
+++ b/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp
@@ -42,6 +42,8 @@
#include "debugutil_p.h"
#include "qqmldebugtestservice.h"
+#include <private/qqmldebugconnector_p.h>
+
#define PORT 13770
#define STR_PORT "13770"
@@ -51,6 +53,7 @@ class tst_QQmlDebugClient : public QObject
private:
QQmlDebugConnection *m_conn;
+ QQmlDebugTestService *m_service;
private slots:
void initTestCase();
@@ -64,14 +67,21 @@ private slots:
void tst_QQmlDebugClient::initTestCase()
{
+ QQmlDebugConnector::setPluginKey(QLatin1String("QQmlDebugServer"));
+ QTest::ignoreMessage(QtWarningMsg,
+ "QML debugger: Cannot set plugin key after loading the plugin.");
+
+ m_service = new QQmlDebugTestService("tst_QQmlDebugClient::handshake()");
const QString waitingMsg = QString("QML Debugger: Waiting for connection on port %1...").arg(PORT);
QTest::ignoreMessage(QtDebugMsg, waitingMsg.toLatin1().constData());
+ QQmlDebuggingEnabler::startTcpDebugServer(PORT);
+
new QQmlEngine(this);
m_conn = new QQmlDebugConnection(this);
QQmlDebugTestClient client("tst_QQmlDebugClient::handshake()", m_conn);
- QQmlDebugTestService service("tst_QQmlDebugClient::handshake()");
+
for (int i = 0; i < 50; ++i) {
// try for 5 seconds ...
@@ -105,14 +115,6 @@ void tst_QQmlDebugClient::state()
QQmlDebugTestClient client("tst_QQmlDebugClient::state()", m_conn);
QCOMPARE(client.state(), QQmlDebugClient::Unavailable);
- {
- QQmlDebugTestService service("tst_QQmlDebugClient::state()", 2);
- QTRY_COMPARE(client.state(), QQmlDebugClient::Enabled);
- QCOMPARE(client.serviceVersion(), 2.0f);
- }
-
- QTRY_COMPARE(client.state(), QQmlDebugClient::Unavailable);
-
// duplicate plugin name
QTest::ignoreMessage(QtWarningMsg, "QQmlDebugClient: Conflicting plugin name \"tst_QQmlDebugClient::state()\"");
QQmlDebugClient client2("tst_QQmlDebugClient::state()", m_conn);
@@ -124,8 +126,7 @@ void tst_QQmlDebugClient::state()
void tst_QQmlDebugClient::sendMessage()
{
- QQmlDebugTestService service("tst_QQmlDebugClient::sendMessage()");
- QQmlDebugTestClient client("tst_QQmlDebugClient::sendMessage()", m_conn);
+ QQmlDebugTestClient client("tst_QQmlDebugClient::handshake()", m_conn);
QByteArray msg = "hello!";
@@ -151,7 +152,6 @@ void tst_QQmlDebugClient::sequentialConnect()
{
QQmlDebugConnection connection2;
QQmlDebugTestClient client2("tst_QQmlDebugClient::handshake()", &connection2);
- QQmlDebugTestService service("tst_QQmlDebugClient::handshake()");
m_conn->close();
QVERIFY(!m_conn->isConnected());
@@ -166,20 +166,7 @@ void tst_QQmlDebugClient::sequentialConnect()
QTRY_COMPARE(client2.state(), QQmlDebugClient::Enabled);
}
-int main(int argc, char *argv[])
-{
- int _argc = argc + 1;
- char **_argv = new char*[_argc];
- for (int i = 0; i < argc; ++i)
- _argv[i] = argv[i];
- char arg[] = "-qmljsdebugger=port:" STR_PORT;
- _argv[_argc - 1] = arg;
-
- QGuiApplication app(_argc, _argv);
- tst_QQmlDebugClient tc;
- return QTest::qExec(&tc, _argc, _argv);
- delete _argv;
-}
+QTEST_MAIN(tst_QQmlDebugClient)
#include "tst_qqmldebugclient.moc"
diff --git a/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp b/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp
index 748c153822..0343ea77ee 100644
--- a/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp
+++ b/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp
@@ -42,6 +42,8 @@
#include "debugutil_p.h"
#include "qqmldebugtestservice.h"
+#include <private/qqmldebugconnector_p.h>
+
QString fileName;
class tst_QQmlDebugLocal : public QObject
@@ -50,6 +52,7 @@ class tst_QQmlDebugLocal : public QObject
private:
QQmlDebugConnection *m_conn;
+ QQmlDebugTestService *m_service;
bool connect();
@@ -67,16 +70,23 @@ private slots:
void tst_QQmlDebugLocal::initTestCase()
{
+ fileName = QString::fromLatin1("tst_QQmlDebugLocal%1").arg(std::time(0));
+ QQmlDebugConnector::setPluginKey("QQmlDebugServer");
+ QTest::ignoreMessage(QtWarningMsg,
+ "QML debugger: Cannot set plugin key after loading the plugin.");
+ m_service = new QQmlDebugTestService("tst_QQmlDebugLocal::handshake()");
+
const QString waitingMsg = QString("QML Debugger: Connecting to socket %1...").arg(fileName);
QTest::ignoreMessage(QtDebugMsg, waitingMsg.toLatin1().constData());
m_conn = new QQmlDebugConnection(this);
m_conn->startLocalServer(fileName);
+ QQmlDebuggingEnabler::connectToLocalDebugger(fileName);
+
new QQmlEngine(this);
QQmlDebugTestClient client("tst_QQmlDebugLocal::handshake()", m_conn);
- QQmlDebugTestService service("tst_QQmlDebugLocal::handshake()");
for (int i = 0; i < 50; ++i) {
// try for 5 seconds ...
@@ -109,14 +119,6 @@ void tst_QQmlDebugLocal::state()
QQmlDebugTestClient client("tst_QQmlDebugLocal::state()", m_conn);
QCOMPARE(client.state(), QQmlDebugClient::Unavailable);
- {
- QQmlDebugTestService service("tst_QQmlDebugLocal::state()", 2);
- QTRY_COMPARE(client.state(), QQmlDebugClient::Enabled);
- QCOMPARE(client.serviceVersion(), 2.0f);
- }
-
- QTRY_COMPARE(client.state(), QQmlDebugClient::Unavailable);
-
// duplicate plugin name
QTest::ignoreMessage(QtWarningMsg, "QQmlDebugClient: Conflicting plugin name \"tst_QQmlDebugLocal::state()\"");
QQmlDebugClient client2("tst_QQmlDebugLocal::state()", m_conn);
@@ -128,8 +130,7 @@ void tst_QQmlDebugLocal::state()
void tst_QQmlDebugLocal::sendMessage()
{
- QQmlDebugTestService service("tst_QQmlDebugLocal::sendMessage()");
- QQmlDebugTestClient client("tst_QQmlDebugLocal::sendMessage()", m_conn);
+ QQmlDebugTestClient client("tst_QQmlDebugLocal::handshake()", m_conn);
QByteArray msg = "hello!";
@@ -140,21 +141,6 @@ void tst_QQmlDebugLocal::sendMessage()
QCOMPARE(resp, msg);
}
-int main(int argc, char *argv[])
-{
- fileName = QString::fromLatin1("tst_QQmlDebugLocal%1").arg(std::time(0));
-
- int _argc = argc + 1;
- char **_argv = new char*[_argc];
- for (int i = 0; i < argc; ++i)
- _argv[i] = argv[i];
- char *arg = strdup((QString::fromLatin1("-qmljsdebugger=file:") + fileName).toLatin1().data());
- _argv[_argc - 1] = arg;
-
- QGuiApplication app(_argc, _argv);
- tst_QQmlDebugLocal tc;
- return QTest::qExec(&tc, _argc, _argv);
- delete _argv;
-}
+QTEST_MAIN(tst_QQmlDebugLocal)
#include "tst_qqmldebuglocal.moc"
diff --git a/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp b/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
index 15d8ffff15..6ae59078f6 100644
--- a/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
+++ b/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
@@ -44,6 +44,7 @@
#include "debugutil_p.h"
#include "qqmldebugclient.h"
#include "qqmldebugtestservice.h"
+#include <private/qqmldebugconnector_p.h>
#define PORT 3769
#define STR_PORT "3769"
@@ -53,7 +54,7 @@ class tst_QQmlDebugService : public QQmlDataTest
Q_OBJECT
private:
QQmlDebugConnection *m_conn;
-
+ QQmlDebugTestService *m_service;
private slots:
@@ -72,8 +73,15 @@ private slots:
void tst_QQmlDebugService::initTestCase()
{
QQmlDataTest::initTestCase();
+ QQmlDebugConnector::setPluginKey(QLatin1String("QQmlDebugServer"));
+ QTest::ignoreMessage(QtWarningMsg,
+ "QML debugger: Cannot set plugin key after loading the plugin.");
+ m_service = new QQmlDebugTestService("tst_QQmlDebugService", 2);
+
const QString waitingMsg = QString("QML Debugger: Waiting for connection on port %1...").arg(PORT);
QTest::ignoreMessage(QtDebugMsg, waitingMsg.toLatin1().constData());
+ QQmlDebuggingEnabler::startTcpDebugServer(PORT);
+
new QQmlEngine(this);
m_conn = new QQmlDebugConnection(this);
@@ -125,67 +133,64 @@ void tst_QQmlDebugService::checkPortRange()
void tst_QQmlDebugService::name()
{
- QString name = "tst_QQmlDebugService::name()";
-
- QQmlDebugTestService service(name, 1);
- QCOMPARE(service.name(), name);
+ QCOMPARE(m_service->name(), QLatin1String("tst_QQmlDebugService"));
}
void tst_QQmlDebugService::version()
{
- QString name = "tst_QQmlDebugService::name()";
-
- QQmlDebugTestService service(name, 2);
- QCOMPARE(service.version(), 2.0f);
+ QCOMPARE(m_service->version(), 2.0f);
}
void tst_QQmlDebugService::state()
{
- QQmlDebugTestService service("tst_QQmlDebugService::state()");
- QCOMPARE(service.state(), QQmlDebugService::Unavailable);
+ QCOMPARE(m_service->state(), QQmlDebugService::Unavailable);
{
- QQmlDebugTestClient client("tst_QQmlDebugService::state()", m_conn);
+ QQmlDebugTestClient client("tst_QQmlDebugService", m_conn);
QTRY_COMPARE(client.state(), QQmlDebugClient::Enabled);
- QTRY_COMPARE(service.state(), QQmlDebugService::Enabled);
+ QTRY_COMPARE(m_service->state(), QQmlDebugService::Enabled);
}
+ QTRY_COMPARE(m_service->state(), QQmlDebugService::Unavailable);
- QTRY_COMPARE(service.state(), QQmlDebugService::Unavailable);
-
- QTest::ignoreMessage(QtWarningMsg, "QQmlDebugService: Conflicting plugin name \"tst_QQmlDebugService::state()\"");
- QQmlDebugTestService duplicate("tst_QQmlDebugService::state()");
+ // We can do this because it will never addService()
+ QTest::ignoreMessage(QtWarningMsg,
+ "QQmlDebugService: Conflicting plugin name \"tst_QQmlDebugService\"");
+ QQmlDebugTestService duplicate("tst_QQmlDebugService");
QCOMPARE(duplicate.state(), QQmlDebugService::NotConnected);
+ QTest::ignoreMessage(QtWarningMsg,
+ "QQmlDebugService: Plugin \"tst_QQmlDebugService\" is not registered.");
}
void tst_QQmlDebugService::sendMessage()
{
- QQmlDebugTestService service("tst_QQmlDebugService::sendMessage()");
- QQmlDebugTestClient client("tst_QQmlDebugService::sendMessage()", m_conn);
+ QQmlDebugTestClient client("tst_QQmlDebugService", m_conn);
QByteArray msg = "hello!";
QTRY_COMPARE(client.state(), QQmlDebugClient::Enabled);
- QTRY_COMPARE(service.state(), QQmlDebugService::Enabled);
+ QTRY_COMPARE(m_service->state(), QQmlDebugService::Enabled);
client.sendMessage(msg);
QByteArray resp = client.waitForResponse();
QCOMPARE(resp, msg);
- QTest::ignoreMessage(QtWarningMsg, "QQmlDebugService: Conflicting plugin name \"tst_QQmlDebugService::sendMessage()\"");
- QQmlDebugTestService duplicate("tst_QQmlDebugService::sendMessage()");
+ QTest::ignoreMessage(QtWarningMsg,
+ "QQmlDebugService: Conflicting plugin name \"tst_QQmlDebugService\"");
+ QQmlDebugTestService duplicate("tst_QQmlDebugService");
duplicate.sendMessage("msg");
+ QTest::ignoreMessage(QtWarningMsg,
+ "QQmlDebugService: Plugin \"tst_QQmlDebugService\" is not registered.");
}
void tst_QQmlDebugService::checkSupportForDataStreamVersion()
{
- QQmlDebugTestService service("tst_QQmlDebugService::sendMessage2()");
- QQmlDebugTestClient client("tst_QQmlDebugService::sendMessage2()", m_conn);
+ QQmlDebugTestClient client("tst_QQmlDebugService", m_conn);
QByteArray msg = "hello!";
QTRY_COMPARE(client.state(), QQmlDebugClient::Enabled);
- QTRY_COMPARE(service.state(), QQmlDebugService::Enabled);
+ QTRY_COMPARE(m_service->state(), QQmlDebugService::Enabled);
client.sendMessage(msg);
QByteArray resp = client.waitForResponse();
@@ -243,13 +248,12 @@ void tst_QQmlDebugService::checkSupportForOldDataStreamVersion()
}
QVERIFY(m_conn->isConnected());
- QQmlDebugTestService service("tst_QQmlDebugService::sendMessage2()");
- QQmlDebugTestClient client("tst_QQmlDebugService::sendMessage2()", m_conn);
+ QQmlDebugTestClient client("tst_QQmlDebugService", m_conn);
QByteArray msg = "hello!";
QTRY_COMPARE(client.state(), QQmlDebugClient::Enabled);
- QTRY_COMPARE(service.state(), QQmlDebugService::Enabled);
+ QTRY_COMPARE(m_service->state(), QQmlDebugService::Enabled);
client.sendMessage(msg);
QByteArray resp = client.waitForResponse();
@@ -257,20 +261,6 @@ void tst_QQmlDebugService::checkSupportForOldDataStreamVersion()
QCOMPARE(m_conn->dataStreamVersion(), int(QDataStream::Qt_4_7));
}
-
-int main(int argc, char *argv[])
-{
- int _argc = argc + 1;
- char **_argv = new char*[_argc];
- for (int i = 0; i < argc; ++i)
- _argv[i] = argv[i];
- char arg[] = "-qmljsdebugger=port:" STR_PORT ",host:127.0.0.1";
- _argv[_argc - 1] = arg;
-
- QGuiApplication app(_argc, _argv);
- tst_QQmlDebugService tc;
- return QTest::qExec(&tc, _argc, _argv);
- delete _argv;
-}
+QTEST_MAIN(tst_QQmlDebugService)
#include "tst_qqmldebugservice.moc"
diff --git a/tests/auto/qml/debugger/shared/qqmldebugtestservice.cpp b/tests/auto/qml/debugger/shared/qqmldebugtestservice.cpp
index 990cb1caa1..94eaa2c083 100644
--- a/tests/auto/qml/debugger/shared/qqmldebugtestservice.cpp
+++ b/tests/auto/qml/debugger/shared/qqmldebugtestservice.cpp
@@ -37,7 +37,6 @@
QQmlDebugTestService::QQmlDebugTestService(const QString &s, float version, QObject *parent)
: QQmlDebugService(s, version, parent)
{
- registerService();
}
void QQmlDebugTestService::messageReceived(const QByteArray &ba)