aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/debugger
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/debugger')
-rw-r--r--tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp10
-rw-r--r--tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp22
-rw-r--r--tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp24
-rw-r--r--tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.cpp6
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp24
-rw-r--r--tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp20
-rw-r--r--tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp25
-rw-r--r--tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp16
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp24
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp36
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp21
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp16
-rw-r--r--tests/auto/qml/debugger/shared/debugutil.cpp50
-rw-r--r--tests/auto/qml/debugger/shared/debugutil.pri10
-rw-r--r--tests/auto/qml/debugger/shared/debugutil_p.h24
-rw-r--r--tests/auto/qml/debugger/shared/qqmldebugclient.cpp539
-rw-r--r--tests/auto/qml/debugger/shared/qqmldebugclient.h112
-rw-r--r--tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp2
-rw-r--r--tests/auto/qml/debugger/shared/qqmlenginedebugclient.h4
-rw-r--r--tests/auto/qml/debugger/shared/qqmlinspectorclient.cpp2
-rw-r--r--tests/auto/qml/debugger/shared/qqmlinspectorclient.h2
21 files changed, 203 insertions, 786 deletions
diff --git a/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp b/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
index 0f8b7ef9f2..779ab8c2a1 100644
--- a/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
+++ b/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
@@ -31,14 +31,16 @@
**
****************************************************************************/
-#include "qqmldebugclient.h"
-
//QQmlDebugTest
#include "debugutil_p.h"
#include "../../../shared/util.h"
-#include <QtCore/QString>
-#include <QtTest/QtTest>
+#include <private/qqmldebugclient_p.h>
+#include <private/qqmldebugconnection_p.h>
+
+#include <QtCore/qstring.h>
+#include <QtCore/qlibraryinfo.h>
+#include <QtTest/qtest.h>
const char *NORMALMODE = "-qmljsdebugger=port:3777,3787,block";
const char *QMLFILE = "test.qml";
diff --git a/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp b/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp
index abdc2483ea..1bf03dbdee 100644
--- a/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp
+++ b/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp
@@ -30,19 +30,20 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include <qtest.h>
-#include <QSignalSpy>
-#include <QTimer>
-#include <QHostAddress>
-#include <QDebug>
-#include <QThread>
-
-#include <QtQml/qqmlengine.h>
#include "debugutil_p.h"
#include "qqmldebugtestservice.h"
#include <private/qqmldebugconnector_p.h>
+#include <private/qqmldebugconnection_p.h>
+
+#include <QtTest/qtest.h>
+#include <QtTest/qsignalspy.h>
+#include <QtCore/qtimer.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qthread.h>
+#include <QtNetwork/qhostaddress.h>
+#include <QtQml/qqmlengine.h>
#define PORT 13770
#define STR_PORT "13770"
@@ -154,7 +155,9 @@ void tst_QQmlDebugClient::parallelConnect()
QTest::ignoreMessage(QtWarningMsg, "QML Debugger: Another client is already connected.");
// will connect & immediately disconnect
connection2.connectToHost("127.0.0.1", PORT);
- QTRY_COMPARE(connection2.state(), QAbstractSocket::UnconnectedState);
+ QTest::ignoreMessage(QtWarningMsg, "QQmlDebugConnection: Did not get handshake answer in time");
+ QVERIFY(!connection2.waitForConnected(1000));
+ QVERIFY(!connection2.isConnected());
QVERIFY(m_conn->isConnected());
}
@@ -165,7 +168,6 @@ void tst_QQmlDebugClient::sequentialConnect()
m_conn->close();
QVERIFY(!m_conn->isConnected());
- QCOMPARE(m_conn->state(), QAbstractSocket::UnconnectedState);
// Make sure that the disconnect is actually delivered to the server
QTest::qWait(100);
diff --git a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp
index e809a46009..27a64842e9 100644
--- a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp
+++ b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp
@@ -31,18 +31,20 @@
**
****************************************************************************/
-#include <qtest.h>
-#include <QtCore/QProcess>
-#include <QtCore/QTimer>
-#include <QtCore/QFileInfo>
-#include <QtCore/QDir>
-#include <QtCore/QMutex>
-#include <QtCore/QLibraryInfo>
-
#include "debugutil_p.h"
-#include "qqmldebugclient.h"
#include "../../../shared/util.h"
+#include <private/qqmldebugclient_p.h>
+#include <private/qqmldebugconnection_p.h>
+
+#include <QtTest/qtest.h>
+#include <QtCore/qprocess.h>
+#include <QtCore/qtimer.h>
+#include <QtCore/qfileinfo.h>
+#include <QtCore/qdir.h>
+#include <QtCore/qmutex.h>
+#include <QtCore/qlibraryinfo.h>
+
class tst_QQmlDebuggingEnabler : public QQmlDataTest
{
Q_OBJECT
@@ -176,7 +178,7 @@ void tst_QQmlDebuggingEnabler::qmlscene()
QFETCH(QStringList, services);
connection = new QQmlDebugConnection();
- QList<QQmlDebugClient *> clients = connection->createOtherClients();
+ QList<QQmlDebugClient *> clients = QQmlDebugTest::createOtherClients(connection);
process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene",
this);
process->setMaximumBindErrors(1);
@@ -208,7 +210,7 @@ void tst_QQmlDebuggingEnabler::custom()
const int portTo = 5565;
connection = new QQmlDebugConnection();
- QList<QQmlDebugClient *> clients = connection->createOtherClients();
+ QList<QQmlDebugClient *> clients = QQmlDebugTest::createOtherClients(connection);
process = new QQmlDebugProcess(QCoreApplication::applicationDirPath() +
QLatin1String("/qqmldebuggingenablerserver"), this);
process->setMaximumBindErrors(portTo - portFrom);
diff --git a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.cpp b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.cpp
index e08461346f..f4fef7ff16 100644
--- a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.cpp
+++ b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.cpp
@@ -31,8 +31,10 @@
**
****************************************************************************/
-#include "debugutil_p.h"
-#include <QtCore/QCoreApplication>
+#include <QtCore/qcoreapplication.h>
+#include <QtCore/qlibraryinfo.h>
+#include <QtQml/qqmldebug.h>
+#include <QtQml/qqmlengine.h>
int main(int argc, char *argv[])
{
diff --git a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
index c22adbcc36..d6facc4200 100644
--- a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
+++ b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
@@ -31,20 +31,22 @@
**
****************************************************************************/
-#include <qtest.h>
-#include <QtCore/QProcess>
-#include <QtCore/QTimer>
-#include <QtCore/QFileInfo>
-#include <QtCore/QDir>
-#include <QtCore/QMutex>
-#include <QtCore/QLibraryInfo>
-#include <QtQml/QJSEngine>
-
//QQmlDebugTest
#include "debugutil_p.h"
-#include "qqmldebugclient.h"
#include "../../../shared/util.h"
+#include <private/qqmldebugclient_p.h>
+#include <private/qqmldebugconnection_p.h>
+
+#include <QtTest/qtest.h>
+#include <QtCore/qprocess.h>
+#include <QtCore/qtimer.h>
+#include <QtCore/qfileinfo.h>
+#include <QtCore/qdir.h>
+#include <QtCore/qmutex.h>
+#include <QtCore/qlibraryinfo.h>
+#include <QtQml/qjsengine.h>
+
#if defined (Q_OS_WINCE)
#undef IN
#undef OUT
@@ -831,7 +833,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();
+ QList<QQmlDebugClient *> others = QQmlDebugTest::createOtherClients(connection);
const char *args = 0;
if (blockMode)
diff --git a/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp b/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp
index 0343ea77ee..083e6de09e 100644
--- a/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp
+++ b/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp
@@ -31,18 +31,20 @@
**
****************************************************************************/
-#include <qtest.h>
-#include <QSignalSpy>
-#include <QTimer>
-#include <QHostAddress>
-#include <QDebug>
-#include <QThread>
-#include <ctime>
-
-#include "debugutil_p.h"
#include "qqmldebugtestservice.h"
+#include "debugutil_p.h"
#include <private/qqmldebugconnector_p.h>
+#include <private/qqmldebugconnection_p.h>
+
+#include <QtTest/qtest.h>
+#include <QtTest/qsignalspy.h>
+#include <QtNetwork/qhostaddress.h>
+#include <QtCore/qtimer.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qthread.h>
+
+#include <ctime>
QString fileName;
diff --git a/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp b/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
index 166a079201..80eb5fbb3c 100644
--- a/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
+++ b/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
@@ -30,22 +30,25 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include <qtest.h>
-#include <QSignalSpy>
-#include <QTimer>
-#include <QHostAddress>
-#include <QDebug>
-#include <QThread>
-#include <QLibraryInfo>
-#include <QtQml/qqmlengine.h>
-#include "../../../shared/util.h"
-#include "debugutil_p.h"
-#include "qqmldebugclient.h"
#include "qqmldebugtestservice.h"
+#include "debugutil_p.h"
+#include "../../../shared/util.h"
+
+#include <private/qqmldebugclient_p.h>
+#include <private/qqmldebugconnection_p.h>
#include <private/qqmldebugconnector_p.h>
+#include <QtTest/qtest.h>
+#include <QtTest/qsignalspy.h>
+#include <QtNetwork/qhostaddress.h>
+#include <QtQml/qqmlengine.h>
+#include <QtCore/qtimer.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qthread.h>
+#include <QtCore/qlibraryinfo.h>
+
#define PORT 3769
#define STR_PORT "3769"
diff --git a/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp b/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp
index 6c21ba27d7..961fe2f50c 100644
--- a/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp
+++ b/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp
@@ -31,13 +31,15 @@
**
****************************************************************************/
-#include <qtest.h>
-#include <QLibraryInfo>
-
#include "debugutil_p.h"
-#include "qqmldebugclient.h"
#include "../../../shared/util.h"
+#include <private/qqmldebugclient_p.h>
+#include <private/qqmldebugconnection_p.h>
+
+#include <QtTest/qtest.h>
+#include <QtCore/qlibraryinfo.h>
+
#define STR_PORT_FROM "13773"
#define STR_PORT_TO "13783"
@@ -167,7 +169,7 @@ 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();
+ QList<QQmlDebugClient *> others = QQmlDebugTest::createOtherClients(m_connection);
const int port = m_process->debugPort();
m_connection->connectToHost(QLatin1String("127.0.0.1"), port);
@@ -184,8 +186,8 @@ void tst_QQmlEngineControl::cleanup()
if (QTest::currentTestFailed()) {
qDebug() << "Process State:" << (m_process ? m_process->state() : QLatin1String("null"));
qDebug() << "Application Output:" << (m_process ? m_process->output() : QLatin1String("null"));
- qDebug() << "Connection State:" << (m_connection ? m_connection->stateString() : QLatin1String("null"));
- qDebug() << "Client State:" << (m_client ? m_client->stateString() : QLatin1String("null"));
+ qDebug() << "Connection State:" << QQmlDebugTest::connectionStateString(m_connection);
+ qDebug() << "Client State:" << QQmlDebugTest::clientStateString(m_client);
}
delete m_process;
m_process = 0;
diff --git a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp
index adf46c8dab..04b068161b 100644
--- a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp
+++ b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp
@@ -31,18 +31,20 @@
**
****************************************************************************/
-#include <qtest.h>
-#include <QSignalSpy>
-#include <QTimer>
-#include <QHostAddress>
-#include <QDebug>
-#include <QThread>
-#include <QtCore/QLibraryInfo>
-
-#include "../shared/debugutil_p.h"
-#include "../../../shared/util.h"
#include "qqmlinspectorclient.h"
#include "qqmlenginedebugclient.h"
+#include "../shared/debugutil_p.h"
+#include "../../../shared/util.h"
+
+#include <private/qqmldebugconnection_p.h>
+
+#include <QtTest/qtest.h>
+#include <QtTest/qsignalspy.h>
+#include <QtNetwork/qhostaddress.h>
+#include <QtCore/qtimer.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qthread.h>
+#include <QtCore/qlibraryinfo.h>
#define STR_PORT_FROM "3776"
#define STR_PORT_TO "3786"
@@ -111,7 +113,7 @@ 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();
+ QList<QQmlDebugClient *> others = QQmlDebugTest::createOtherClients(m_connection);
m_connection->connectToHost(QLatin1String("127.0.0.1"), m_process->debugPort());
QVERIFY(m_connection->waitForConnected());
diff --git a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
index 653af61be5..fe4000bbb4 100644
--- a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
+++ b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
@@ -30,31 +30,33 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include <qtest.h>
-#include <QSignalSpy>
-#include <QTimer>
-#include <QHostAddress>
-#include <QDebug>
-#include <QThread>
-#include <QModelIndex>
-#include <QtQml/qqmlengine.h>
-#include <QtQml/qqmlcontext.h>
-#include <QtQml/qqmlcomponent.h>
-#include <QtQml/qqmlexpression.h>
-#include <QtQml/qqmlproperty.h>
-#include <QtQuick/qquickitem.h>
+#include "qqmlenginedebugclient.h"
+#include "debugutil_p.h"
+#include "../../../shared/util.h"
#include <private/qqmlbinding_p.h>
#include <private/qqmlboundsignal_p.h>
#include <private/qqmldebugservice_p.h>
#include <private/qqmlmetatype_p.h>
#include <private/qqmlproperty_p.h>
+#include <private/qqmldebugconnection_p.h>
-#include "debugutil_p.h"
-#include "qqmlenginedebugclient.h"
+#include <QtTest/qtest.h>
+#include <QtTest/qsignalspy.h>
-#include "../../../shared/util.h"
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcontext.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQml/qqmlexpression.h>
+#include <QtQml/qqmlproperty.h>
+#include <QtQuick/qquickitem.h>
+
+#include <QtNetwork/qhostaddress.h>
+#include <QtCore/qtimer.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qthread.h>
+#include <QtCore/qabstractitemmodel.h>
#define QVERIFYOBJECT(statement) \
do {\
@@ -352,7 +354,7 @@ void tst_QQmlEngineDebugService::initTestCase()
bool ok = m_conn->waitForConnected();
QVERIFY(ok);
m_dbg = new QQmlEngineDebugClient(m_conn);
- QList<QQmlDebugClient *> others = m_conn->createOtherClients();
+ QList<QQmlDebugClient *> others = QQmlDebugTest::createOtherClients(m_conn);
QTRY_COMPARE(m_dbg->state(), QQmlEngineDebugClient::Enabled);
foreach (QQmlDebugClient *other, others)
QCOMPARE(other->state(), QQmlDebugClient::Unavailable);
diff --git a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
index 5d3583a5d2..d5aa1f41ad 100644
--- a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
+++ b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
@@ -30,17 +30,20 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include <qtest.h>
-#include <QSignalSpy>
-#include <QTimer>
-#include <QHostAddress>
-#include <QDebug>
-#include <QThread>
-#include <QtCore/QLibraryInfo>
+#include "qqmlinspectorclient.h"
#include "../shared/debugutil_p.h"
#include "../../../shared/util.h"
-#include "qqmlinspectorclient.h"
+
+#include <private/qqmldebugconnection_p.h>
+
+#include <QtTest/qtest.h>
+#include <QtTest/qsignalspy.h>
+#include <QtCore/qtimer.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qthread.h>
+#include <QtCore/qlibraryinfo.h>
+#include <QtNetwork/qhostaddress.h>
#define STR_PORT_FROM "3772"
#define STR_PORT_TO "3782"
@@ -91,7 +94,7 @@ 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();
+ QList<QQmlDebugClient *> others = QQmlDebugTest::createOtherClients(m_connection);
m_connection->connectToHost(QLatin1String("127.0.0.1"), m_process->debugPort());
QVERIFY(m_client);
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
index 17e3260026..86926e59ec 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
@@ -31,13 +31,15 @@
**
****************************************************************************/
-#include <qtest.h>
-#include <QLibraryInfo>
-
#include "debugutil_p.h"
-#include "qqmldebugclient.h"
#include "../../../shared/util.h"
+#include <private/qqmldebugclient_p.h>
+#include <private/qqmldebugconnection_p.h>
+
+#include <QtTest/qtest.h>
+#include <QtCore/qlibraryinfo.h>
+
#define STR_PORT_FROM "13773"
#define STR_PORT_TO "13783"
@@ -373,7 +375,7 @@ 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();
+ QList<QQmlDebugClient *> others = QQmlDebugTest::createOtherClients(m_connection);
const int port = m_process->debugPort();
m_connection->connectToHost(QLatin1String("127.0.0.1"), port);
@@ -555,8 +557,8 @@ void tst_QQmlProfilerService::cleanup()
qDebug() << " ";
qDebug() << "Process State:" << (m_process ? m_process->state() : QLatin1String("null"));
qDebug() << "Application Output:" << (m_process ? m_process->output() : QLatin1String("null"));
- qDebug() << "Connection State:" << (m_connection ? m_connection->stateString() : QLatin1String("null"));
- qDebug() << "Client State:" << m_client->stateString();
+ qDebug() << "Connection State:" << QQmlDebugTest::connectionStateString(m_connection);
+ qDebug() << "Client State:" << QQmlDebugTest::clientStateString(m_client);
}
delete m_process;
m_process = 0;
diff --git a/tests/auto/qml/debugger/shared/debugutil.cpp b/tests/auto/qml/debugger/shared/debugutil.cpp
index 51d706b818..54720fc848 100644
--- a/tests/auto/qml/debugger/shared/debugutil.cpp
+++ b/tests/auto/qml/debugger/shared/debugutil.cpp
@@ -33,10 +33,12 @@
#include "debugutil_p.h"
-#include <QEventLoop>
-#include <QTimer>
-#include <QFileInfo>
-#include <QDir>
+#include <private/qqmldebugconnection_p.h>
+
+#include <QtCore/qeventloop.h>
+#include <QtCore/qtimer.h>
+#include <QtCore/qfileinfo.h>
+#include <QtCore/qdir.h>
bool QQmlDebugTest::waitForSignal(QObject *receiver, const char *member, int timeout) {
QEventLoop loop;
@@ -51,6 +53,46 @@ bool QQmlDebugTest::waitForSignal(QObject *receiver, const char *member, int tim
return timer.isActive();
}
+QList<QQmlDebugClient *> QQmlDebugTest::createOtherClients(QQmlDebugConnection *connection)
+{
+ QList<QQmlDebugClient *> ret;
+ foreach (const QString &service, QQmlDebuggingEnabler::debuggerServices()) {
+ if (!connection->client(service))
+ ret << new QQmlDebugClient(service, connection);
+ }
+ foreach (const QString &service, QQmlDebuggingEnabler::inspectorServices()) {
+ if (!connection->client(service))
+ ret << new QQmlDebugClient(service, connection);
+ }
+ foreach (const QString &service, QQmlDebuggingEnabler::profilerServices()) {
+ if (!connection->client(service))
+ ret << new QQmlDebugClient(service, connection);
+ }
+ return ret;
+}
+
+QString QQmlDebugTest::clientStateString(const QQmlDebugClient *client)
+{
+ if (!client)
+ return QLatin1String("null");
+
+ switch (client->state()) {
+ case QQmlDebugClient::NotConnected: return QLatin1String("Not connected");
+ case QQmlDebugClient::Unavailable: return QLatin1String("Unavailable");
+ case QQmlDebugClient::Enabled: return QLatin1String("Enabled");
+ default: return QLatin1String("Invalid");
+ }
+
+}
+
+QString QQmlDebugTest::connectionStateString(const QQmlDebugConnection *connection)
+{
+ if (!connection)
+ return QLatin1String("null");
+
+ return connection->isConnected() ? QLatin1String("connected") : QLatin1String("not connected");
+}
+
QQmlDebugTestClient::QQmlDebugTestClient(const QString &s, QQmlDebugConnection *c)
: QQmlDebugClient(s, c)
{
diff --git a/tests/auto/qml/debugger/shared/debugutil.pri b/tests/auto/qml/debugger/shared/debugutil.pri
index 73ed647061..1983f3583e 100644
--- a/tests/auto/qml/debugger/shared/debugutil.pri
+++ b/tests/auto/qml/debugger/shared/debugutil.pri
@@ -1,8 +1,4 @@
-QT += packetprotocol-private
-
-HEADERS += $$PWD/debugutil_p.h \
- $$PWD/qqmldebugclient.h \
-
-SOURCES += $$PWD/debugutil.cpp \
- $$PWD/qqmldebugclient.cpp \
+QT += qmldebug-private
+HEADERS += $$PWD/debugutil_p.h
+SOURCES += $$PWD/debugutil.cpp
diff --git a/tests/auto/qml/debugger/shared/debugutil_p.h b/tests/auto/qml/debugger/shared/debugutil_p.h
index d544a89ff2..7ab817a509 100644
--- a/tests/auto/qml/debugger/shared/debugutil_p.h
+++ b/tests/auto/qml/debugger/shared/debugutil_p.h
@@ -32,8 +32,8 @@
**
****************************************************************************/
-#ifndef DEBUGUTIL_H
-#define DEBUGUTIL_H
+#ifndef DEBUGUTIL_P_H
+#define DEBUGUTIL_P_H
//
// W A R N I N G
@@ -46,21 +46,23 @@
// We mean it.
//
-#include <QEventLoop>
-#include <QTimer>
-#include <QThread>
-#include <QTest>
-#include <QProcess>
-#include <QMutex>
+#include <private/qqmldebugclient_p.h>
+#include <QtCore/qeventloop.h>
+#include <QtCore/qtimer.h>
+#include <QtCore/qthread.h>
+#include <QtCore/qprocess.h>
+#include <QtCore/qmutex.h>
+#include <QtTest/qtest.h>
#include <QtQml/qqmlengine.h>
-#include "qqmldebugclient.h"
-
class QQmlDebugTest
{
public:
static bool waitForSignal(QObject *receiver, const char *member, int timeout = 5000);
+ static QList<QQmlDebugClient *> createOtherClients(QQmlDebugConnection *connection);
+ static QString clientStateString(const QQmlDebugClient *client);
+ static QString connectionStateString(const QQmlDebugConnection *connection);
};
class QQmlDebugTestClient : public QQmlDebugClient
@@ -128,4 +130,4 @@ private:
int m_receivedBindErrors;
};
-#endif // DEBUGUTIL_H
+#endif // DEBUGUTIL_P_H
diff --git a/tests/auto/qml/debugger/shared/qqmldebugclient.cpp b/tests/auto/qml/debugger/shared/qqmldebugclient.cpp
deleted file mode 100644
index 00de8f9f7e..0000000000
--- a/tests/auto/qml/debugger/shared/qqmldebugclient.cpp
+++ /dev/null
@@ -1,539 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qqmldebugclient.h"
-
-#include <private/qpacketprotocol_p.h>
-#include <private/qpacket_p.h>
-
-#include <QtCore/qdebug.h>
-#include <QtCore/qeventloop.h>
-#include <QtCore/qstringlist.h>
-#include <QtCore/qtimer.h>
-#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");
-const QString clientId = QLatin1String("QDeclarativeDebugClient");
-
-class QQmlDebugClientPrivate
-{
-public:
- QQmlDebugClientPrivate();
-
- QString name;
- QQmlDebugConnection *connection;
-};
-
-class QQmlDebugConnectionPrivate : public QObject
-{
- Q_OBJECT
-public:
- QQmlDebugConnectionPrivate(QQmlDebugConnection *c);
- QQmlDebugConnection *q;
- QPacketProtocol *protocol;
- QIODevice *device;
- QLocalServer *server;
- QEventLoop handshakeEventLoop;
- QTimer handshakeTimer;
-
- bool gotHello;
- QHash <QString, float> serverPlugins;
- QHash<QString, QQmlDebugClient *> plugins;
- QStringList removedPlugins;
-
- void advertisePlugins();
- void connectDeviceSignals();
-
-public Q_SLOTS:
- void forwardStateChange(QLocalSocket::LocalSocketState state);
- void forwardError(QLocalSocket::LocalSocketError error);
-
- void newConnection();
- void connected();
- void readyRead();
- void deviceAboutToClose();
- void handshakeTimeout();
-};
-
-QQmlDebugConnectionPrivate::QQmlDebugConnectionPrivate(QQmlDebugConnection *c)
- : QObject(c), q(c), protocol(0), device(0), server(0), gotHello(false)
-{
- protocol = new QPacketProtocol(q, this);
- QObject::connect(c, SIGNAL(connected()), this, SLOT(connected()));
- QObject::connect(protocol, SIGNAL(readyRead()), this, SLOT(readyRead()));
-
- handshakeTimer.setSingleShot(true);
- handshakeTimer.setInterval(3000);
- connect(&handshakeTimer, SIGNAL(timeout()), SLOT(handshakeTimeout()));
-}
-
-void QQmlDebugConnectionPrivate::advertisePlugins()
-{
- if (!q->isConnected())
- return;
-
- QPacket pack;
- pack << serverId << 1 << plugins.keys();
- protocol->send(pack);
- q->flush();
-}
-
-void QQmlDebugConnectionPrivate::connected()
-{
- QPacket pack;
- pack << serverId << 0 << protocolVersion << plugins.keys()
- << q->m_dataStreamVersion;
- protocol->send(pack);
- q->flush();
-}
-
-void QQmlDebugConnectionPrivate::readyRead()
-{
- if (!gotHello) {
- QPacket pack = protocol->read();
- QString name;
-
- pack >> name;
-
- bool validHello = false;
- if (name == clientId) {
- int op = -1;
- pack >> op;
- if (op == 0) {
- int version = -1;
- pack >> version;
- if (version == protocolVersion) {
- QStringList pluginNames;
- QList<float> pluginVersions;
- pack >> pluginNames;
- if (!pack.atEnd())
- pack >> pluginVersions;
-
- const int pluginNamesSize = pluginNames.size();
- const int pluginVersionsSize = pluginVersions.size();
- for (int i = 0; i < pluginNamesSize; ++i) {
- float pluginVersion = 1.0;
- if (i < pluginVersionsSize)
- pluginVersion = pluginVersions.at(i);
- serverPlugins.insert(pluginNames.at(i), pluginVersion);
- }
-
- pack >> q->m_dataStreamVersion;
- validHello = true;
- }
- }
- }
-
- if (!validHello) {
- qWarning("QQmlDebugConnection: Invalid hello message");
- QObject::disconnect(protocol, SIGNAL(readyRead()), this, SLOT(readyRead()));
- return;
- }
- gotHello = true;
-
- QHash<QString, QQmlDebugClient *>::Iterator iter = plugins.begin();
- for (; iter != plugins.end(); ++iter) {
- QQmlDebugClient::State newState = QQmlDebugClient::Unavailable;
- if (serverPlugins.contains(iter.key()))
- newState = QQmlDebugClient::Enabled;
- iter.value()->stateChanged(newState);
- }
-
- handshakeTimer.stop();
- handshakeEventLoop.quit();
- }
-
- while (protocol->packetsAvailable()) {
- QPacket pack = protocol->read();
- QString name;
- pack >> name;
-
- if (name == clientId) {
- int op = -1;
- pack >> op;
-
- if (op == 1) {
- // Service Discovery
- QHash<QString, float> oldServerPlugins = serverPlugins;
- serverPlugins.clear();
-
- QStringList pluginNames;
- QList<float> pluginVersions;
- pack >> pluginNames;
- if (!pack.atEnd())
- pack >> pluginVersions;
-
- const int pluginNamesSize = pluginNames.size();
- const int pluginVersionsSize = pluginVersions.size();
- for (int i = 0; i < pluginNamesSize; ++i) {
- float pluginVersion = 1.0;
- if (i < pluginVersionsSize)
- pluginVersion = pluginVersions.at(i);
- serverPlugins.insert(pluginNames.at(i), pluginVersion);
- }
-
- QHash<QString, QQmlDebugClient *>::Iterator iter = plugins.begin();
- for (; iter != plugins.end(); ++iter) {
- const QString pluginName = iter.key();
- QQmlDebugClient::State newSate = QQmlDebugClient::Unavailable;
- if (serverPlugins.contains(pluginName))
- newSate = QQmlDebugClient::Enabled;
-
- if (oldServerPlugins.contains(pluginName)
- != serverPlugins.contains(pluginName)) {
- iter.value()->stateChanged(newSate);
- }
- }
- } else {
- qWarning() << "QQmlDebugConnection: Unknown control message id" << op;
- }
- } else {
- QByteArray message;
- pack >> message;
-
- QHash<QString, QQmlDebugClient *>::Iterator iter =
- plugins.find(name);
- if (iter == plugins.end()) {
- // 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);
- }
- }
- }
-}
-
-void QQmlDebugConnectionPrivate::deviceAboutToClose()
-{
- // This is nasty syntax but we want to emit our own aboutToClose signal (by calling QIODevice::close())
- // without calling the underlying device close fn as that would cause an infinite loop
- q->QIODevice::close();
-}
-
-void QQmlDebugConnectionPrivate::handshakeTimeout()
-{
- if (!gotHello) {
- qWarning() << "Qml Debug Client: Did not get handshake answer in time";
- handshakeEventLoop.quit();
- }
-}
-
-QQmlDebugConnection::QQmlDebugConnection(QObject *parent)
- : QIODevice(parent), d(new QQmlDebugConnectionPrivate(this)),
- m_dataStreamVersion(QDataStream::Qt_5_0)
-{
-}
-
-QQmlDebugConnection::~QQmlDebugConnection()
-{
- QHash<QString, QQmlDebugClient*>::iterator iter = d->plugins.begin();
- for (; iter != d->plugins.end(); ++iter) {
- iter.value()->d->connection = 0;
- iter.value()->stateChanged(QQmlDebugClient::NotConnected);
- }
-}
-
-void QQmlDebugConnection::setDataStreamVersion(int dataStreamVersion)
-{
- m_dataStreamVersion = dataStreamVersion;
-}
-
-int QQmlDebugConnection::dataStreamVersion()
-{
- return m_dataStreamVersion;
-}
-
-bool QQmlDebugConnection::isConnected() const
-{
- return state() == QAbstractSocket::ConnectedState;
-}
-
-qint64 QQmlDebugConnection::readData(char *data, qint64 maxSize)
-{
- return d->device->read(data, maxSize);
-}
-
-qint64 QQmlDebugConnection::writeData(const char *data, qint64 maxSize)
-{
- return d->device->write(data, maxSize);
-}
-
-qint64 QQmlDebugConnection::bytesAvailable() const
-{
- return d->device->bytesAvailable();
-}
-
-bool QQmlDebugConnection::isSequential() const
-{
- return true;
-}
-
-void QQmlDebugConnection::close()
-{
- if (isOpen()) {
- QIODevice::close();
- d->device->close();
- emit stateChanged(QAbstractSocket::UnconnectedState);
-
- QHash<QString, QQmlDebugClient*>::iterator iter = d->plugins.begin();
- for (; iter != d->plugins.end(); ++iter) {
- iter.value()->stateChanged(QQmlDebugClient::NotConnected);
- }
- }
-}
-
-bool QQmlDebugConnection::waitForConnected(int msecs)
-{
- QAbstractSocket *socket = qobject_cast<QAbstractSocket*>(d->device);
- if (!socket) {
- if (!d->server || (!d->server->hasPendingConnections() &&
- !d->server->waitForNewConnection(msecs)))
- return false;
- } else if (!socket->waitForConnected(msecs)) {
- return false;
- }
- // wait for handshake
- d->handshakeTimer.start();
- d->handshakeEventLoop.exec();
- return d->gotHello;
-}
-
-QString QQmlDebugConnection::stateString() const
-{
- QString state;
-
- if (isConnected())
- state = "Connected";
- else
- state = "Not connected";
-
- if (d->gotHello)
- state += ", got hello";
- else
- state += ", did not get hello!";
-
- return state;
-}
-
-QAbstractSocket::SocketState QQmlDebugConnection::state() const
-{
- QAbstractSocket *abstractSocket = qobject_cast<QAbstractSocket*>(d->device);
- if (abstractSocket)
- return abstractSocket->state();
-
- QLocalSocket *localSocket = qobject_cast<QLocalSocket*>(d->device);
- if (localSocket)
- return static_cast<QAbstractSocket::SocketState>(localSocket->state());
-
- return QAbstractSocket::UnconnectedState;
-}
-
-void QQmlDebugConnection::flush()
-{
- QAbstractSocket *socket = qobject_cast<QAbstractSocket*>(d->device);
- if (socket) {
- socket->flush();
- return;
- }
-}
-
-void QQmlDebugConnection::connectToHost(const QString &hostName, quint16 port)
-{
- QTcpSocket *socket = new QTcpSocket(d);
- socket->setProxy(QNetworkProxy::NoProxy);
- d->device = socket;
- d->connectDeviceSignals();
- d->gotHello = false;
- connect(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SIGNAL(stateChanged(QAbstractSocket::SocketState)));
- connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SIGNAL(error(QAbstractSocket::SocketError)));
- connect(socket, SIGNAL(connected()), this, SIGNAL(connected()));
- socket->connectToHost(hostName, port);
- QIODevice::open(ReadWrite | Unbuffered);
-}
-
-void QQmlDebugConnection::startLocalServer(const QString &fileName)
-{
- d->gotHello = false;
- d->server = new QLocalServer(d);
- // QueuedConnection so that waitForNewConnection() returns true.
- connect(d->server, SIGNAL(newConnection()), d, SLOT(newConnection()), Qt::QueuedConnection);
- d->server->listen(fileName);
- QIODevice::open(ReadWrite | Unbuffered);
-}
-
-void QQmlDebugConnectionPrivate::newConnection()
-{
- QLocalSocket *socket = server->nextPendingConnection();
- server->close();
- device = socket;
- connectDeviceSignals();
- connect(socket, SIGNAL(stateChanged(QLocalSocket::LocalSocketState)),
- this, SLOT(forwardStateChange(QLocalSocket::LocalSocketState)));
- connect(socket, SIGNAL(error(QLocalSocket::LocalSocketError)),
- this, SLOT(forwardError(QLocalSocket::LocalSocketError)));
- emit q->connected();
-}
-
-void QQmlDebugConnectionPrivate::connectDeviceSignals()
-{
- connect(device, SIGNAL(bytesWritten(qint64)), q, SIGNAL(bytesWritten(qint64)));
- connect(device, SIGNAL(readyRead()), q, SIGNAL(readyRead()));
- connect(device, SIGNAL(aboutToClose()), this, SLOT(deviceAboutToClose()));
-}
-
-void QQmlDebugConnectionPrivate::forwardStateChange(QLocalSocket::LocalSocketState state)
-{
- emit q->stateChanged(static_cast<QAbstractSocket::SocketState>(state));
-}
-
-void QQmlDebugConnectionPrivate::forwardError(QLocalSocket::LocalSocketError error)
-{
- emit q->error(static_cast<QAbstractSocket::SocketError>(error));
-}
-
-QQmlDebugClientPrivate::QQmlDebugClientPrivate()
- : connection(0)
-{
-}
-
-QQmlDebugClient::QQmlDebugClient(const QString &name,
- QQmlDebugConnection *parent)
- : QObject(parent),
- d(new QQmlDebugClientPrivate)
-{
- d->name = name;
- d->connection = parent;
-
- if (!d->connection)
- return;
-
- if (d->connection->d->plugins.contains(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();
- }
-}
-
-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;
-}
-
-QString QQmlDebugClient::name() const
-{
- return d->name;
-}
-
-float QQmlDebugClient::serviceVersion() const
-{
- if (d->connection->d->serverPlugins.contains(d->name))
- return d->connection->d->serverPlugins.value(d->name);
- return -1;
-}
-
-QQmlDebugClient::State QQmlDebugClient::state() const
-{
- if (!d->connection
- || !d->connection->isConnected()
- || !d->connection->d->gotHello)
- return NotConnected;
-
- if (d->connection->d->serverPlugins.contains(d->name))
- return Enabled;
-
- return Unavailable;
-}
-
-QString QQmlDebugClient::stateString() const
-{
- switch (state()) {
- case NotConnected: return QLatin1String("Not connected");
- case Unavailable: return QLatin1String("Unavailable");
- case Enabled: return QLatin1String("Enabled");
- }
- return QLatin1String("Invalid");
-}
-
-void QQmlDebugClient::sendMessage(const QByteArray &message)
-{
- if (state() != Enabled)
- return;
-
- QPacket pack;
- pack << d->name << message;
- d->connection->d->protocol->send(pack);
- 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)
-{
-}
-
-void QQmlDebugClient::messageReceived(const QByteArray &)
-{
-}
-
-#include <qqmldebugclient.moc>
diff --git a/tests/auto/qml/debugger/shared/qqmldebugclient.h b/tests/auto/qml/debugger/shared/qqmldebugclient.h
deleted file mode 100644
index 659f7c8631..0000000000
--- a/tests/auto/qml/debugger/shared/qqmldebugclient.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQMLDEBUGCLIENT_H
-#define QQMLDEBUGCLIENT_H
-
-#include <QtNetwork/qtcpsocket.h>
-
-class QQmlDebugClient;
-class QQmlDebugConnectionPrivate;
-class QQmlDebugConnection : public QIODevice
-{
- Q_OBJECT
- Q_DISABLE_COPY(QQmlDebugConnection)
-public:
- QQmlDebugConnection(QObject * = 0);
- ~QQmlDebugConnection();
-
- void connectToHost(const QString &hostName, quint16 port);
- void startLocalServer(const QString &fileName);
-
- void setDataStreamVersion(int dataStreamVersion);
- int dataStreamVersion();
-
- qint64 bytesAvailable() const;
- bool isConnected() const;
- QAbstractSocket::SocketState state() const;
- void flush();
- bool isSequential() const;
- void close();
- bool waitForConnected(int msecs = 30000);
-
- QString stateString() const;
- QList<QQmlDebugClient *> createOtherClients();
-
-signals:
- void connected();
- void stateChanged(QAbstractSocket::SocketState socketState);
- void error(QAbstractSocket::SocketError socketError);
-
-protected:
- qint64 readData(char *data, qint64 maxSize);
- qint64 writeData(const char *data, qint64 maxSize);
-
-private:
- QQmlDebugConnectionPrivate *d;
- int m_dataStreamVersion;
- friend class QQmlDebugClient;
- friend class QQmlDebugClientPrivate;
- friend class QQmlDebugConnectionPrivate;
-};
-
-class QQmlDebugClientPrivate;
-class QQmlDebugClient : public QObject
-{
- Q_OBJECT
- Q_DISABLE_COPY(QQmlDebugClient)
-
-public:
- enum State { NotConnected, Unavailable, Enabled };
-
- QQmlDebugClient(const QString &, QQmlDebugConnection *parent);
- ~QQmlDebugClient();
-
- QString name() const;
- float serviceVersion() const;
- State state() const;
- QString stateString() const;
-
- virtual void sendMessage(const QByteArray &);
-
-protected:
- virtual void stateChanged(State);
- virtual void messageReceived(const QByteArray &);
-
-private:
- QQmlDebugClientPrivate *d;
- friend class QQmlDebugConnection;
- friend class QQmlDebugConnectionPrivate;
-};
-
-#endif // QQMLDEBUGCLIENT_H
diff --git a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp
index 9b48b40c07..7db0d9055d 100644
--- a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp
+++ b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp
@@ -34,6 +34,8 @@
#include "qqmlenginedebugclient.h"
#include "qdatastream.h"
+#include <private/qqmldebugconnection_p.h>
+
struct QmlObjectData {
QUrl url;
int lineNumber;
diff --git a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.h b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.h
index 28adb8b159..60f5a7e66b 100644
--- a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.h
+++ b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.h
@@ -34,13 +34,11 @@
#ifndef QQMLENGINEDEBUGCLIENT_H
#define QQMLENGINEDEBUGCLIENT_H
-#include "qqmldebugclient.h"
+#include <private/qqmldebugclient_p.h>
#include <QtCore/qurl.h>
#include <QtCore/qvariant.h>
-class QQmlDebugConnection;
-
struct QmlDebugPropertyReference
{
QmlDebugPropertyReference()
diff --git a/tests/auto/qml/debugger/shared/qqmlinspectorclient.cpp b/tests/auto/qml/debugger/shared/qqmlinspectorclient.cpp
index a46bd9012b..0c7ab60f5e 100644
--- a/tests/auto/qml/debugger/shared/qqmlinspectorclient.cpp
+++ b/tests/auto/qml/debugger/shared/qqmlinspectorclient.cpp
@@ -34,6 +34,8 @@
#include "qqmlinspectorclient.h"
#include "qdatastream.h"
+#include <QtCore/qdebug.h>
+
void QQmlInspectorClient::setShowAppOnTop(bool showOnTop)
{
QByteArray message;
diff --git a/tests/auto/qml/debugger/shared/qqmlinspectorclient.h b/tests/auto/qml/debugger/shared/qqmlinspectorclient.h
index a8b42c8430..964dac7701 100644
--- a/tests/auto/qml/debugger/shared/qqmlinspectorclient.h
+++ b/tests/auto/qml/debugger/shared/qqmlinspectorclient.h
@@ -33,7 +33,7 @@
#ifndef QQMLINSPECTORCLIENT_H
#define QQMLINSPECTORCLIENT_H
-#include "qqmldebugclient.h"
+#include <private/qqmldebugclient_p.h>
class QQmlInspectorClient : public QQmlDebugClient
{