Commit 5c05f5df authored by Aurindam Jana's avatar Aurindam Jana Committed by Qt by Nokia

QmlDebuggingTests: Separate out public and private tests

Remove dependencies on quick-private from all
possible debugging auto tests and list them under public
tests.

Change-Id: I688b5b36fdf3d6fbcb6cef2a975ecd1bf679af2b
Reviewed-by: default avatarKai Koehne <kai.koehne@nokia.com>
parent c975f80d
......@@ -9,10 +9,14 @@ DESTDIR = $$QT.qml.plugins/qmltooling
QTDIR_build:REQUIRES += "contains(QT_CONFIG, qml)"
SOURCES += \
qtcpserverconnection.cpp
qtcpserverconnection.cpp \
../shared/qpacketprotocol.cpp
HEADERS += \
qtcpserverconnection.h
qtcpserverconnection.h \
../shared/qpacketprotocol.h
INCLUDEPATH += ../shared
OTHER_FILES += qtcpserverconnection.json
......
......@@ -40,13 +40,13 @@
****************************************************************************/
#include "qtcpserverconnection.h"
#include "qpacketprotocol.h"
#include <QtCore/qplugin.h>
#include <QtNetwork/qtcpserver.h>
#include <QtNetwork/qtcpsocket.h>
#include <private/qqmldebugserver_p.h>
#include <private/qpacketprotocol_p.h>
QT_BEGIN_NAMESPACE
......
......@@ -39,7 +39,7 @@
**
****************************************************************************/
#include "qpacketprotocol_p.h"
#include "qpacketprotocol.h"
#include <QtCore/QBuffer>
#include <QtCore/QElapsedTimer>
......
......@@ -42,34 +42,18 @@
#ifndef QPACKETPROTOCOL_H
#define QPACKETPROTOCOL_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <QtCore/qobject.h>
#include <QtCore/qdatastream.h>
#include <private/qtqmlglobal_p.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
class QIODevice;
class QBuffer;
class QPacket;
class QPacketAutoSend;
class QPacketProtocolPrivate;
class Q_QML_PRIVATE_EXPORT QPacketProtocol : public QObject
class QPacketProtocol : public QObject
{
Q_OBJECT
public:
......@@ -101,7 +85,7 @@ private:
};
class Q_QML_PRIVATE_EXPORT QPacket : public QDataStream
class QPacket : public QDataStream
{
public:
QPacket();
......@@ -119,7 +103,7 @@ protected:
QBuffer *buf;
};
class Q_QML_PRIVATE_EXPORT QPacketAutoSend : public QPacket
class QPacketAutoSend : public QPacket
{
public:
virtual ~QPacketAutoSend();
......@@ -132,6 +116,4 @@ private:
QT_END_NAMESPACE
QT_END_HEADER
#endif
SOURCES += \
$$PWD/qpacketprotocol.cpp \
$$PWD/qqmldebugservice.cpp \
$$PWD/qqmlprofilerservice.cpp \
$$PWD/qqmldebugserver.cpp \
......@@ -10,7 +9,6 @@ SOURCES += \
$$PWD/qdebugmessageservice.cpp
HEADERS += \
$$PWD/qpacketprotocol_p.h \
$$PWD/qqmldebugservice_p.h \
$$PWD/qqmldebugservice_p_p.h \
$$PWD/qqmlprofilerservice_p.h \
......
TEMPLATE = subdirs
PRIVATETESTS += \
PUBLICTESTS += \
qqmlenginedebugservice \
qqmldebugclient \
qqmldebugservice \
qqmldebugjs \
qqmlinspector \
qqmlprofilerservice \
......@@ -11,6 +9,12 @@ PRIVATETESTS += \
qv8profilerservice \
qdebugmessageservice
PRIVATETESTS += \
qqmldebugclient \
qqmldebugservice
SUBDIRS += $$PUBLICTESTS
contains(QT_CONFIG, private_tests) {
SUBDIRS += $$PRIVATETESTS
}
CONFIG += testcase
TARGET = tst_qdebugmessageservice
QT += network qml-private testlib
QT += qml network testlib
macx:CONFIG -= app_bundle
SOURCES += tst_qdebugmessageservice.cpp
......
......@@ -8,4 +8,4 @@ INCLUDEPATH += ../shared
include(../shared/debugutil.pri)
CONFIG += parallel_test
QT += qml-private network testlib
QT += qml network testlib
......@@ -46,7 +46,7 @@
#include <QDebug>
#include <QBuffer>
#include <private/qpacketprotocol_p.h>
#include "../../../../../src/plugins/qmltooling/shared/qpacketprotocol.h"
#include "debugutil_p.h"
......
......@@ -2,7 +2,10 @@ CONFIG += testcase
TARGET = tst_qqmldebugclient
macx:CONFIG -= app_bundle
SOURCES += tst_qqmldebugclient.cpp
HEADERS += ../shared/qqmldebugtestservice.h
SOURCES += tst_qqmldebugclient.cpp \
../shared/qqmldebugtestservice.cpp
INCLUDEPATH += ../shared
include(../shared/debugutil.pri)
......
......@@ -48,6 +48,7 @@
#include <QtQml/qqmlengine.h>
#include "debugutil_p.h"
#include "qqmldebugtestservice.h"
#define PORT 13770
#define STR_PORT "13770"
......
CONFIG += testcase
TARGET = tst_qqmldebugjs
QT += qml-private testlib
QT += qml testlib
macx:CONFIG -= app_bundle
SOURCES += tst_qqmldebugjs.cpp
......
......@@ -2,7 +2,11 @@ CONFIG += testcase
TARGET = tst_qqmldebugservice
macx:CONFIG -= app_bundle
SOURCES += tst_qqmldebugservice.cpp
HEADERS += ../shared/qqmldebugtestservice.h
SOURCES += tst_qqmldebugservice.cpp \
../shared/qqmldebugtestservice.cpp
INCLUDEPATH += ../shared
include(../../../shared/util.pri)
include(../shared/debugutil.pri)
......
......@@ -47,11 +47,10 @@
#include <QtQml/qqmlengine.h>
#include <private/qqmldebugservice_p.h>
#include "../../../shared/util.h"
#include "debugutil_p.h"
#include "qqmldebugclient.h"
#include "qqmldebugtestservice.h"
#define PORT 13769
#define STR_PORT "13769"
......
......@@ -9,4 +9,4 @@ include(../shared/debugutil.pri)
CONFIG += parallel_test declarative_debug
QT += qml-private testlib
QT += qml testlib
......@@ -12,4 +12,4 @@ OTHER_FILES += data/test.qml
CONFIG += parallel_test declarative_debug
QT += core-private v8-private qml-private testlib
QT += core qml testlib
......@@ -42,7 +42,6 @@
#include <qtest.h>
#include <QLibraryInfo>
#include "QtQml/private/qqmlprofilerservice_p.h"
#include "debugutil_p.h"
#include "qqmldebugclient.h"
#include "../../../shared/util.h"
......@@ -50,11 +49,59 @@
#define PORT 13773
#define STR_PORT "13773"
struct QQmlProfilerData
{
qint64 time;
int messageType;
int detailType;
//###
QString detailData; //used by RangeData and RangeLocation
int line; //used by RangeLocation
int column; //used by RangeLocation
int framerate; //used by animation events
int animationcount; //used by animation events
QByteArray toByteArray() const;
};
class QQmlProfilerClient : public QQmlDebugClient
{
Q_OBJECT
public:
enum Message {
Event,
RangeStart,
RangeData,
RangeLocation,
RangeEnd,
Complete, // end of transmission
MaximumMessage
};
enum EventType {
FramePaint,
Mouse,
Key,
AnimationFrame,
EndTrace,
StartTrace,
MaximumEventType
};
enum RangeType {
Painting,
Compiling,
Creating,
Binding, //running a binding
HandlingSignal, //running a signal handler
MaximumRangeType
};
QQmlProfilerClient(QQmlDebugConnection *connection)
: QQmlDebugClient(QLatin1String("CanvasFrameRate"), connection)
{
......@@ -123,21 +170,21 @@ void QQmlProfilerClient::messageReceived(const QByteArray &message)
QVERIFY(data.time >= -1);
switch (data.messageType) {
case (QQmlProfilerService::Event): {
case (QQmlProfilerClient::Event): {
stream >> data.detailType;
switch (data.detailType) {
case QQmlProfilerService::AnimationFrame: {
case QQmlProfilerClient::AnimationFrame: {
stream >> data.framerate >> data.animationcount;
QVERIFY(data.framerate != -1);
QVERIFY(data.animationcount != -1);
break;
}
case QQmlProfilerService::FramePaint:
case QQmlProfilerService::Mouse:
case QQmlProfilerService::Key:
case QQmlProfilerService::StartTrace:
case QQmlProfilerService::EndTrace:
case QQmlProfilerClient::FramePaint:
case QQmlProfilerClient::Mouse:
case QQmlProfilerClient::Key:
case QQmlProfilerClient::StartTrace:
case QQmlProfilerClient::EndTrace:
break;
default: {
QString failMsg = QString("Unknown event type:") + data.detailType;
......@@ -147,28 +194,28 @@ void QQmlProfilerClient::messageReceived(const QByteArray &message)
}
break;
}
case QQmlProfilerService::Complete: {
case QQmlProfilerClient::Complete: {
emit complete();
return;
}
case QQmlProfilerService::RangeStart: {
case QQmlProfilerClient::RangeStart: {
stream >> data.detailType;
QVERIFY(data.detailType >= 0 && data.detailType < QQmlProfilerService::MaximumRangeType);
QVERIFY(data.detailType >= 0 && data.detailType < QQmlProfilerClient::MaximumRangeType);
break;
}
case QQmlProfilerService::RangeEnd: {
case QQmlProfilerClient::RangeEnd: {
stream >> data.detailType;
QVERIFY(data.detailType >= 0 && data.detailType < QQmlProfilerService::MaximumRangeType);
QVERIFY(data.detailType >= 0 && data.detailType < QQmlProfilerClient::MaximumRangeType);
break;
}
case QQmlProfilerService::RangeData: {
case QQmlProfilerClient::RangeData: {
stream >> data.detailType >> data.detailData;
QVERIFY(data.detailType >= 0 && data.detailType < QQmlProfilerService::MaximumRangeType);
QVERIFY(data.detailType >= 0 && data.detailType < QQmlProfilerClient::MaximumRangeType);
break;
}
case QQmlProfilerService::RangeLocation: {
case QQmlProfilerClient::RangeLocation: {
stream >> data.detailType >> data.detailData >> data.line >> data.column;
QVERIFY(data.detailType >= 0 && data.detailType < QQmlProfilerService::MaximumRangeType);
QVERIFY(data.detailType >= 0 && data.detailType < QQmlProfilerClient::MaximumRangeType);
QVERIFY(data.line >= -2);
break;
}
......@@ -229,12 +276,12 @@ void tst_QQmlProfilerService::blockingConnectWithTraceEnabled()
QVERIFY(m_client->traceMessages.count());
// must start with "StartTrace"
QCOMPARE(m_client->traceMessages.first().messageType, (int)QQmlProfilerService::Event);
QCOMPARE(m_client->traceMessages.first().detailType, (int)QQmlProfilerService::StartTrace);
QCOMPARE(m_client->traceMessages.first().messageType, (int)QQmlProfilerClient::Event);
QCOMPARE(m_client->traceMessages.first().detailType, (int)QQmlProfilerClient::StartTrace);
// must end with "EndTrace"
QCOMPARE(m_client->traceMessages.last().messageType, (int)QQmlProfilerService::Event);
QCOMPARE(m_client->traceMessages.last().detailType, (int)QQmlProfilerService::EndTrace);
QCOMPARE(m_client->traceMessages.last().messageType, (int)QQmlProfilerClient::Event);
QCOMPARE(m_client->traceMessages.last().detailType, (int)QQmlProfilerClient::EndTrace);
}
void tst_QQmlProfilerService::blockingConnectWithTraceDisabled()
......@@ -254,12 +301,12 @@ void tst_QQmlProfilerService::blockingConnectWithTraceDisabled()
QVERIFY(m_client->traceMessages.count());
// must start with "StartTrace"
QCOMPARE(m_client->traceMessages.first().messageType, (int)QQmlProfilerService::Event);
QCOMPARE(m_client->traceMessages.first().detailType, (int)QQmlProfilerService::StartTrace);
QCOMPARE(m_client->traceMessages.first().messageType, (int)QQmlProfilerClient::Event);
QCOMPARE(m_client->traceMessages.first().detailType, (int)QQmlProfilerClient::StartTrace);
// must end with "EndTrace"
QCOMPARE(m_client->traceMessages.last().messageType, (int)QQmlProfilerService::Event);
QCOMPARE(m_client->traceMessages.last().detailType, (int)QQmlProfilerService::EndTrace);
QCOMPARE(m_client->traceMessages.last().messageType, (int)QQmlProfilerClient::Event);
QCOMPARE(m_client->traceMessages.last().detailType, (int)QQmlProfilerClient::EndTrace);
}
void tst_QQmlProfilerService::nonBlockingConnect()
......@@ -276,12 +323,12 @@ void tst_QQmlProfilerService::nonBlockingConnect()
}
// must start with "StartTrace"
QCOMPARE(m_client->traceMessages.first().messageType, (int)QQmlProfilerService::Event);
QCOMPARE(m_client->traceMessages.first().detailType, (int)QQmlProfilerService::StartTrace);
QCOMPARE(m_client->traceMessages.first().messageType, (int)QQmlProfilerClient::Event);
QCOMPARE(m_client->traceMessages.first().detailType, (int)QQmlProfilerClient::StartTrace);
// must end with "EndTrace"
QCOMPARE(m_client->traceMessages.last().messageType, (int)QQmlProfilerService::Event);
QCOMPARE(m_client->traceMessages.last().detailType, (int)QQmlProfilerService::EndTrace);
QCOMPARE(m_client->traceMessages.last().messageType, (int)QQmlProfilerClient::Event);
QCOMPARE(m_client->traceMessages.last().detailType, (int)QQmlProfilerClient::EndTrace);
}
void tst_QQmlProfilerService::profileOnExit()
......@@ -298,12 +345,12 @@ void tst_QQmlProfilerService::profileOnExit()
}
// must start with "StartTrace"
QCOMPARE(m_client->traceMessages.first().messageType, (int)QQmlProfilerService::Event);
QCOMPARE(m_client->traceMessages.first().detailType, (int)QQmlProfilerService::StartTrace);
QCOMPARE(m_client->traceMessages.first().messageType, (int)QQmlProfilerClient::Event);
QCOMPARE(m_client->traceMessages.first().detailType, (int)QQmlProfilerClient::StartTrace);
// must end with "EndTrace"
QCOMPARE(m_client->traceMessages.last().messageType, (int)QQmlProfilerService::Event);
QCOMPARE(m_client->traceMessages.last().detailType, (int)QQmlProfilerService::EndTrace);
QCOMPARE(m_client->traceMessages.last().messageType, (int)QQmlProfilerClient::Event);
QCOMPARE(m_client->traceMessages.last().detailType, (int)QQmlProfilerClient::EndTrace);
}
QTEST_MAIN(tst_QQmlProfilerService)
......
......@@ -12,4 +12,4 @@ OTHER_FILES += data/test.qml
CONFIG += parallel_test declarative_debug
QT += qml-private testlib
QT += qml testlib
......@@ -42,7 +42,6 @@
#include <qtest.h>
#include <QLibraryInfo>
#include "QtQml/private/qv8profilerservice_p.h"
#include "debugutil_p.h"
#include "qqmldebugclient.h"
#include "../../../shared/util.h"
......@@ -50,11 +49,34 @@
#define PORT 13774
#define STR_PORT "13774"
struct QV8ProfilerData
{
int messageType;
QString filename;
QString functionname;
int lineNumber;
double totalTime;
double selfTime;
int treeLevel;
QByteArray toByteArray() const;
};
class QV8ProfilerClient : public QQmlDebugClient
{
Q_OBJECT
public:
enum MessageType {
V8Entry,
V8Complete,
V8SnapshotChunk,
V8SnapshotComplete,
V8Started,
V8MaximumMessage
};
QV8ProfilerClient(QQmlDebugConnection *connection)
: QQmlDebugClient(QLatin1String("V8Profiler"), connection)
{
......@@ -139,28 +161,28 @@ void QV8ProfilerClient::messageReceived(const QByteArray &message)
stream >> messageType;
QVERIFY(messageType >= 0);
QVERIFY(messageType < QV8ProfilerService::V8MaximumMessage);
QVERIFY(messageType < QV8ProfilerClient::V8MaximumMessage);
switch (messageType) {
case QV8ProfilerService::V8Entry: {
case QV8ProfilerClient::V8Entry: {
QV8ProfilerData entry;
stream >> entry.filename >> entry.functionname >> entry.lineNumber >> entry.totalTime >> entry.selfTime >> entry.treeLevel;
traceMessages.append(entry);
break;
}
case QV8ProfilerService::V8Complete:
case QV8ProfilerClient::V8Complete:
emit complete();
break;
case QV8ProfilerService::V8SnapshotChunk: {
case QV8ProfilerClient::V8SnapshotChunk: {
QByteArray json;
stream >> json;
snapshotMessages.append(json);
break;
}
case QV8ProfilerService::V8SnapshotComplete:
case QV8ProfilerClient::V8SnapshotComplete:
emit snapshot();
break;
case QV8ProfilerService::V8Started:
case QV8ProfilerClient::V8Started:
emit started();
break;
default:
......
......@@ -55,23 +55,6 @@ bool QQmlDebugTest::waitForSignal(QObject *receiver, const char *member, int tim
return timer.isActive();
}
QQmlDebugTestService::QQmlDebugTestService(const QString &s, float version, QObject *parent)
: QQmlDebugService(s, version, parent)
{
registerService();
}
void QQmlDebugTestService::messageReceived(const QByteArray &ba)
{
sendMessage(ba);
}
void QQmlDebugTestService::stateChanged(State)
{
emit stateHasChanged();
}
QQmlDebugTestClient::QQmlDebugTestClient(const QString &s, QQmlDebugConnection *c)
: QQmlDebugClient(s, c)
{
......
QT += core-private
HEADERS += $$PWD/debugutil_p.h \
$$PWD/qqmldebugclient.h \
$$PWD/qqmlenginedebug_p.h
$$PWD/qqmlenginedebug_p.h \
$$PWD/../../../../../src/plugins/qmltooling/shared/qpacketprotocol.h
SOURCES += $$PWD/debugutil.cpp \
$$PWD/qqmldebugclient.cpp \
$$PWD/qqmlenginedebug.cpp
$$PWD/qqmlenginedebug.cpp \
$$PWD/../../../../../src/plugins/qmltooling/shared/qpacketprotocol.cpp
......@@ -52,7 +52,6 @@
#include <QtQml/qqmlengine.h>
#include "qqmldebugclient.h"
#include <private/qqmldebugservice_p.h>
class QQmlDebugTest
{
......@@ -60,20 +59,6 @@ public:
static bool waitForSignal(QObject *receiver, const char *member, int timeout = 5000);
};
class QQmlDebugTestService : public QQmlDebugService
{
Q_OBJECT
public:
QQmlDebugTestService(const QString &s, float version = 1, QObject *parent = 0);
signals:
void stateHasChanged();
protected:
virtual void messageReceived(const QByteArray &ba);
virtual void stateChanged(State state);
};
class QQmlDebugTestClient : public QQmlDebugClient
{
Q_OBJECT
......
......@@ -40,8 +40,7 @@
****************************************************************************/
#include "qqmldebugclient.h"
#include <private/qpacketprotocol_p.h>
#include "../../../../../src/plugins/qmltooling/shared/qpacketprotocol.h"
#include <QtCore/qdebug.h>
#include <QtCore/qstringlist.h>
......
......@@ -44,8 +44,6 @@
#include <QtNetwork/qtcpsocket.h>
#include <private/qtqmlglobal_p.h>
class QQmlDebugConnectionPrivate;
class QQmlDebugConnection : public QIODevice
{
......@@ -84,7 +82,6 @@ class QQmlDebugClientPrivate;
class QQmlDebugClient : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QQmlDebugClient)
Q_DISABLE_COPY(QQmlDebugClient)
public:
......
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qqmldebugtestservice.h"
QQmlDebugTestService::QQmlDebugTestService(const QString &s, float version, QObject *parent)
: QQmlDebugService(s, version, parent)
{
registerService();
}
void QQmlDebugTestService::messageReceived(const QByteArray &ba)
{
sendMessage(ba);
}
void QQmlDebugTestService::stateChanged(State)
{
emit stateHasChanged();
}
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation