bool ok = false;
QString hostAddress;
QString fileName;
+ QStringList services;
const QStringList lstjsDebugArguments = args.split(QLatin1Char(','));
QStringList::const_iterator argsItEnd = lstjsDebugArguments.cend();
} else if (strArgument.startsWith(QLatin1String("file:"))) {
fileName = strArgument.mid(5);
ok = !fileName.isEmpty();
+ } else if (strArgument.startsWith(QLatin1String("services:"))) {
+ services.append(strArgument.mid(9));
+ } else if (!services.isEmpty()) {
+ services.append(strArgument);
} else {
qWarning() << QString::fromLatin1("QML Debugger: Invalid argument '%1' "
"detected. Ignoring the same.")
}
if (ok) {
+ setServices(services);
m_blockingMode = block;
if (!fileName.isEmpty())
m_thread.setFileName(fileName);
struct QQmlDebugConnectorParams {
QString pluginKey;
+ QStringList services;
QString arguments;
QQmlDebugConnector *instance;
}
}
+void QQmlDebugConnector::setServices(const QStringList &services)
+{
+ QQmlDebugConnectorParams *params = qmlDebugConnectorParams();
+ if (params)
+ params->services = services;
+}
+
QString QQmlDebugConnector::commandLineArguments()
{
QQmlDebugConnectorParams *params = qmlDebugConnectorParams();
foreach (const QJsonObject &object, metaDataForQQmlDebugService()) {
foreach (const QJsonValue &key, object.value(QLatin1String("MetaData")).toObject()
.value(QLatin1String("Keys")).toArray()) {
- loadQQmlDebugService(key.toString());
+ QString keyString = key.toString();
+ if (params->services.isEmpty() || params->services.contains(keyString))
+ loadQQmlDebugService(keyString);
}
}
}
Q_OBJECT
public:
static void setPluginKey(const QString &key);
+ static void setServices(const QStringList &services);
static QQmlDebugConnector *instance();
virtual bool blockingMode() const = 0;
const char *BLOCKMODE = "-qmljsdebugger=port:3771,3800,block";
const char *NORMALMODE = "-qmljsdebugger=port:3771,3800";
+const char *BLOCKRESTRICTEDMODE = "-qmljsdebugger=port:3771,3800,block,services:V8Debugger";
+const char *NORMALRESTRICTEDMODE = "-qmljsdebugger=port:3771,3800,services:V8Debugger";
const char *TEST_QMLFILE = "test.qml";
const char *TEST_JSFILE = "test.js";
const char *TIMER_QMLFILE = "timer.qml";
{
Q_OBJECT
- bool init(const QString &qmlFile = QString(TEST_QMLFILE), bool blockMode = true);
+ void init(const QString &qmlFile = QString(TEST_QMLFILE), bool blockMode = true,
+ bool restrictServices = false);
private slots:
void initTestCase();
void cleanup();
+ void connect_data();
void connect();
void interrupt();
void getVersion();
// qDebug() << "Time Elapsed:" << t.elapsed();
}
-bool tst_QQmlDebugJS::init(const QString &qmlFile, bool blockMode)
+void tst_QQmlDebugJS::init(const QString &qmlFile, bool blockMode, bool restrictServices)
{
connection = new QQmlDebugConnection();
process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", this);
client = new QJSDebugClient(connection);
+ const char *args = 0;
if (blockMode)
- process->start(QStringList() << QLatin1String(BLOCKMODE) << testFile(qmlFile));
+ args = restrictServices ? BLOCKRESTRICTEDMODE : BLOCKMODE;
else
- process->start(QStringList() << QLatin1String(NORMALMODE) << testFile(qmlFile));
+ args = restrictServices ? NORMALRESTRICTEDMODE : NORMALMODE;
- if (!process->waitForSessionStart()) {
- qDebug() << "could not launch application, or did not get 'Waiting for connection'.";
- return false;
- }
+ process->start(QStringList() << QLatin1String(args) << testFile(qmlFile));
+
+ QVERIFY(process->waitForSessionStart());
const int port = process->debugPort();
connection->connectToHost("127.0.0.1", port);
- if (!connection->waitForConnected()) {
- qDebug() << "could not connect to host!";
- return false;
- }
+ QVERIFY(connection->waitForConnected());
- if (client->state() == QQmlDebugClient::Enabled)
- return true;
- return QQmlDebugTest::waitForSignal(client, SIGNAL(enabled()));
+ if (client->state() != QQmlDebugClient::Enabled)
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(enabled())));
}
void tst_QQmlDebugJS::cleanup()
connection = 0;
}
-void tst_QQmlDebugJS::connect()
+void tst_QQmlDebugJS::connect_data()
{
- //void connect()
+ QTest::addColumn<bool>("blockMode");
+ QTest::addColumn<bool>("restrictMode");
+ QTest::newRow("normal/unrestricted") << false << false;
+ QTest::newRow("block/unrestricted") << true << false;
+ QTest::newRow("normal/restricted") << false << true;
+ QTest::newRow("block/restricted") << true << true;
+}
- QVERIFY(init());
+void tst_QQmlDebugJS::connect()
+{
+ QFETCH(bool, blockMode);
+ QFETCH(bool, restrictMode);
+ init(QString(TEST_QMLFILE), blockMode, restrictMode);
client->connect();
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(connected())));
}
{
//void connect()
- QVERIFY(init());
+ init();
client->connect();
client->interrupt();
{
//void version()
- QVERIFY(init());
+ init();
client->connect();
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(connected())));
{
//void disconnect()
- QVERIFY(init());
+ init();
client->connect();
client->disconnect();
//void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1)
int sourceLine = 39;
- QVERIFY(init(ONCOMPLETED_QMLFILE));
+ init(ONCOMPLETED_QMLFILE);
client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
client->connect();
//void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1)
int sourceLine = 39;
- QVERIFY(init(CREATECOMPONENT_QMLFILE));
+ init(CREATECOMPONENT_QMLFILE);
client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
client->connect();
void tst_QQmlDebugJS::setBreakpointInScriptOnTimerCallback()
{
int sourceLine = 40;
- QVERIFY(init(TIMER_QMLFILE));
+ init(TIMER_QMLFILE);
client->connect();
//We can set the breakpoint after connect() here because the timer is repeating and if we miss
//void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1)
int sourceLine = 35;
- QVERIFY(init(LOADJSFILE_QMLFILE));
+ init(LOADJSFILE_QMLFILE);
client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(TEST_JSFILE), sourceLine, -1, true);
client->connect();
int sourceLine = 39;
int actualLine = 41;
- QVERIFY(init(BREAKPOINTRELOCATION_QMLFILE));
+ init(BREAKPOINTRELOCATION_QMLFILE);
client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(BREAKPOINTRELOCATION_QMLFILE), sourceLine, -1, true);
client->connect();
int sourceLine = 40;
int actualLine = 41;
- QVERIFY(init(BREAKPOINTRELOCATION_QMLFILE));
+ init(BREAKPOINTRELOCATION_QMLFILE);
client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(BREAKPOINTRELOCATION_QMLFILE), sourceLine, -1, true);
client->connect();
//void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1)
int sourceLine = 44;
- QVERIFY(init(BREAKPOINTRELOCATION_QMLFILE));
+ init(BREAKPOINTRELOCATION_QMLFILE);
client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(BREAKPOINTRELOCATION_QMLFILE), sourceLine, -1, true);
client->connect();
{
int out = 10;
int sourceLine = 42;
- QVERIFY(init(CONDITION_QMLFILE));
+ init(CONDITION_QMLFILE);
client->connect();
//The breakpoint is in a timer loop so we can set it after connect().
void tst_QQmlDebugJS::setBreakpointInScriptThatQuits()
{
- QVERIFY(init(QUIT_QMLFILE));
+ init(QUIT_QMLFILE);
int sourceLine = 41;
//void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1)
- QVERIFY(init(TIMER_QMLFILE));
+ init(TIMER_QMLFILE);
client->setBreakpoint(QLatin1String(EVENT), QLatin1String("triggered"), -1, -1, true);
client->connect();
int sourceLine1 = 42;
int sourceLine2 = 43;
- QVERIFY(init(CHANGEBREAKPOINT_QMLFILE));
+ init(CHANGEBREAKPOINT_QMLFILE);
client->connect();
//The breakpoints are in a timer loop so we can set them after connect().
{
//void setExceptionBreak(QString type, bool enabled = false);
- QVERIFY(init(EXCEPTION_QMLFILE));
+ init(EXCEPTION_QMLFILE);
client->setExceptionBreak(QJSDebugClient::All,true);
client->connect();
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
//void continueDebugging(StepAction stepAction, int stepCount = 1);
int sourceLine = 42;
- QVERIFY(init(STEPACTION_QMLFILE));
+ init(STEPACTION_QMLFILE);
client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(STEPACTION_QMLFILE), sourceLine, -1, true);
client->connect();
int sourceLine = 46;
int actualLine = 42;
- QVERIFY(init(STEPACTION_QMLFILE));
+ init(STEPACTION_QMLFILE);
client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(STEPACTION_QMLFILE), sourceLine, 1, true);
client->connect();
int sourceLine = 42;
int actualLine = 46;
- QVERIFY(init(STEPACTION_QMLFILE));
+ init(STEPACTION_QMLFILE);
client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(STEPACTION_QMLFILE), sourceLine, -1, true);
client->connect();
int sourceLine1 = 46;
int sourceLine2 = 43;
- QVERIFY(init(STEPACTION_QMLFILE));
+ init(STEPACTION_QMLFILE);
client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(STEPACTION_QMLFILE), sourceLine1, -1, true);
client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(STEPACTION_QMLFILE), sourceLine2, -1, true);
//void backtrace(int fromFrame = -1, int toFrame = -1, bool bottom = false);
int sourceLine = 39;
- QVERIFY(init(ONCOMPLETED_QMLFILE));
+ init(ONCOMPLETED_QMLFILE);
client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
client->connect();
//void frame(int number = -1);
int sourceLine = 39;
- QVERIFY(init(ONCOMPLETED_QMLFILE));
+ init(ONCOMPLETED_QMLFILE);
client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
client->connect();
//void scope(int number = -1, int frameNumber = -1);
int sourceLine = 39;
- QVERIFY(init(ONCOMPLETED_QMLFILE));
+ init(ONCOMPLETED_QMLFILE);
client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
client->connect();
{
//void evaluate(QString expr, bool global = false, bool disableBreak = false, int frame = -1, const QVariantMap &addContext = QVariantMap());
- QVERIFY(init());
+ init();
client->connect();
client->evaluate(QLatin1String("console.log('Hello World')"), true);
//void evaluate(QString expr, bool global = false, bool disableBreak = false, int frame = -1, const QVariantMap &addContext = QVariantMap());
int sourceLine = 47;
- QVERIFY(init(ONCOMPLETED_QMLFILE));
+ init(ONCOMPLETED_QMLFILE);
client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
client->connect();
{
//void scripts(int types = -1, QList<int> ids = QList<int>(), bool includeSource = false, QVariant filter = QVariant());
- QVERIFY(init());
+ init();
client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QString(TEST_QMLFILE), 40, -1, true);
client->connect();
QQmlDebugConnection *m_connection;
QQmlEngineControlClient *m_client;
- void connect(const QString &testFile);
+ void connect(const QString &testFile, bool restrictServices);
+ void engine_data();
private slots:
void cleanup();
+ void startEngine_data();
void startEngine();
+ void stopEngine_data();
void stopEngine();
};
QVERIFY(stream.atEnd());
}
-void tst_QQmlEngineControl::connect(const QString &testFile)
+void tst_QQmlEngineControl::connect(const QString &testFile, bool restrictServices)
{
const QString executable = QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene";
QStringList arguments;
- arguments << QString("-qmljsdebugger=port:" STR_PORT_FROM "," STR_PORT_TO ",block");
+ arguments << QString::fromLatin1("-qmljsdebugger=port:%1,%2,block%3")
+ .arg(STR_PORT_FROM).arg(STR_PORT_TO)
+ .arg(restrictServices ? QStringLiteral(",services:EngineControl") : QString());
arguments << QQmlDataTest::instance()->testFile(testFile);
const int port = m_process->debugPort();
m_connection->connectToHost(QLatin1String("127.0.0.1"), port);
+
+ QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
}
void tst_QQmlEngineControl::cleanup()
m_connection = 0;
}
+void tst_QQmlEngineControl::engine_data()
+{
+ QTest::addColumn<bool>("restrictMode");
+ QTest::newRow("unrestricted") << false;
+ QTest::newRow("restricted") << true;
+}
+
+void tst_QQmlEngineControl::startEngine_data()
+{
+ engine_data();
+}
+
void tst_QQmlEngineControl::startEngine()
{
- connect("test.qml");
- QVERIFY(m_client);
- QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
+ QFETCH(bool, restrictMode);
+
+ connect("test.qml", restrictMode);
QTRY_VERIFY(!m_client->startingEngines.empty());
m_client->command(QQmlEngineControlClient::StartWaitingEngine, m_client->startingEngines.last());
"No engine start message received in time.");
}
+void tst_QQmlEngineControl::stopEngine_data()
+{
+ engine_data();
+}
+
void tst_QQmlEngineControl::stopEngine()
{
- connect("exit.qml");
- QVERIFY(m_client);
- QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
+ QFETCH(bool, restrictMode);
+
+ connect("exit.qml", restrictMode);
QTRY_VERIFY(!m_client->startingEngines.empty());
m_client->command(QQmlEngineControlClient::StartWaitingEngine, m_client->startingEngines.last());
private:
+ void init(bool restrictServices);
QmlDebugObjectReference findRootObject();
QQmlDebugProcess *m_process;
QQmlEngineDebugClient *m_engineDebugClient;
private slots:
- void init();
void cleanup();
+ void connect_data();
void connect();
void clearObjectReferenceHashonReloadQml();
};
}
-void tst_QQmlEngineDebugInspectorIntegration::init()
+void tst_QQmlEngineDebugInspectorIntegration::init(bool restrictServices)
{
- const QString argument = "-qmljsdebugger=port:" STR_PORT_FROM "," STR_PORT_TO ",block";
+ const QString argument = QString::fromLatin1("-qmljsdebugger=port:%1,%2,block%3")
+ .arg(STR_PORT_FROM).arg(STR_PORT_TO)
+ .arg(restrictServices ? QStringLiteral(",services:QmlDebugger,QmlInspector") :
+ QString());
// ### Still using qmlscene because of QTBUG-33376
m_process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath)
m_inspectorClient = new QQmlInspectorClient(m_connection);
m_engineDebugClient = new QQmlEngineDebugClient(m_connection);
- const int port = m_process->debugPort();
- m_connection->connectToHost(QLatin1String("127.0.0.1"), port);
- bool ok = m_connection->waitForConnected();
- QVERIFY(ok);
+ m_connection->connectToHost(QLatin1String("127.0.0.1"), m_process->debugPort());
+ QVERIFY(m_connection->waitForConnected());
}
void tst_QQmlEngineDebugInspectorIntegration::cleanup()
delete m_inspectorClient;
}
+void tst_QQmlEngineDebugInspectorIntegration::connect_data()
+{
+ QTest::addColumn<bool>("restrictMode");
+ QTest::newRow("unrestricted") << false;
+ QTest::newRow("restricted") << true;
+}
+
void tst_QQmlEngineDebugInspectorIntegration::connect()
{
+ QFETCH(bool, restrictMode);
+ init(restrictMode);
QTRY_COMPARE(m_inspectorClient->state(), QQmlDebugClient::Enabled);
QTRY_COMPARE(m_engineDebugClient->state(), QQmlDebugClient::Enabled);
}
void tst_QQmlEngineDebugInspectorIntegration::clearObjectReferenceHashonReloadQml()
{
+ init(true);
QTRY_COMPARE(m_engineDebugClient->state(), QQmlDebugClient::Enabled);
bool success = false;
QmlDebugObjectReference rootObject = findRootObject();
char **_argv = new char*[_argc];
for (int i = 0; i < argc; ++i)
_argv[i] = argv[i];
- char arg[] = "-qmljsdebugger=port:3768";
+ char arg[] = "-qmljsdebugger=port:3768,services:QmlDebugger";
_argv[_argc - 1] = arg;
QGuiApplication app(_argc, _argv);
}
private:
- void startQmlsceneProcess(const char *qmlFile);
+ void startQmlsceneProcess(const char *qmlFile, bool restrictMode = true);
private:
QQmlDebugProcess *m_process;
QQmlInspectorClient *m_client;
private slots:
- void init();
void cleanup();
+ void connect_data();
void connect();
void showAppOnTop();
void reloadQml();
void reloadQmlWindow();
};
-void tst_QQmlInspector::startQmlsceneProcess(const char * /* qmlFile */)
+void tst_QQmlInspector::startQmlsceneProcess(const char * /* qmlFile */, bool restrictServices)
{
- const QString argument = "-qmljsdebugger=port:" STR_PORT_FROM "," STR_PORT_TO ",block";
+ const QString argument = QString::fromLatin1("-qmljsdebugger=port:%1,%2,block%3")
+ .arg(STR_PORT_FROM).arg(STR_PORT_TO)
+ .arg(restrictServices ? QStringLiteral(",services:QmlInspector") : QString());
// ### This should be using qml instead of qmlscene, but can't because of QTBUG-33376 (same as the XFAIL testcase)
m_process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", this);
QVERIFY2(m_process->waitForSessionStart(),
"Could not launch application, or did not get 'Waiting for connection'.");
- QQmlDebugConnection *m_connection = new QQmlDebugConnection();
+ m_connection = new QQmlDebugConnection();
m_client = new QQmlInspectorClient(m_connection);
- const int port = m_process->debugPort();
- m_connection->connectToHost(QLatin1String("127.0.0.1"), port);
-}
+ m_connection->connectToHost(QLatin1String("127.0.0.1"), m_process->debugPort());
+ QVERIFY(m_client);
+ QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
-void tst_QQmlInspector::init()
-{
}
void tst_QQmlInspector::cleanup()
qDebug() << "Process State:" << m_process->state();
qDebug() << "Application Output:" << m_process->output();
}
- delete m_process;
- delete m_connection;
delete m_client;
+ m_client = 0;
+ delete m_connection;
+ m_connection = 0;
+ delete m_process;
+ m_process = 0;
+}
+
+void tst_QQmlInspector::connect_data()
+{
+ QTest::addColumn<bool>("restrictMode");
+ QTest::newRow("unrestricted") << false;
+ QTest::newRow("restricted") << true;
}
void tst_QQmlInspector::connect()
{
- startQmlsceneProcess("qtquick2.qml");
- QVERIFY(m_client);
- QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
+ QFETCH(bool, restrictMode);
+ startQmlsceneProcess("qtquick2.qml", restrictMode);
}
void tst_QQmlInspector::showAppOnTop()
CheckAll = CheckMessageType | CheckDetailType | CheckLine | CheckColumn | CheckDataEndsWith
};
- void connect(bool block, const QString &testFile);
+ void connect(bool block, const QString &testFile, bool restrictServices = true);
void checkTraceReceived();
void checkJsHeap();
bool verify(MessageListType type, int expectedPosition, const QQmlProfilerData &expected,
private slots:
void cleanup();
- void blockingConnectWithTraceEnabled();
- void blockingConnectWithTraceDisabled();
- void nonBlockingConnect();
+ void connect_data();
+ void connect();
void pixmapCacheData();
void scenegraphData();
void profileOnExit();
qmlMessages.append(data);
}
-void tst_QQmlProfilerService::connect(bool block, const QString &testFile)
+void tst_QQmlProfilerService::connect(bool block, const QString &testFile, bool restrictServices)
{
// ### Still using qmlscene due to QTBUG-33377
const QString executable = QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene";
QStringList arguments;
- if (block)
- arguments << QString("-qmljsdebugger=port:" STR_PORT_FROM "," STR_PORT_TO ",block");
- else
- arguments << QString("-qmljsdebugger=port:" STR_PORT_FROM "," STR_PORT_TO );
-
- arguments << QQmlDataTest::instance()->testFile(testFile);
+ arguments << QString::fromLatin1("-qmljsdebugger=port:%1,%2%3%4")
+ .arg(STR_PORT_FROM).arg(STR_PORT_TO)
+ .arg(block ? QStringLiteral(",block") : QString())
+ .arg(restrictServices ? QStringLiteral(",services:CanvasFrameRate") : QString())
+ << QQmlDataTest::instance()->testFile(testFile);
m_process = new QQmlDebugProcess(executable, this);
m_process->start(QStringList() << arguments);
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);
}
void tst_QQmlProfilerService::checkTraceReceived()
m_connection = 0;
}
-void tst_QQmlProfilerService::blockingConnectWithTraceEnabled()
+void tst_QQmlProfilerService::connect_data()
{
- connect(true, "test.qml");
- QVERIFY(m_client);
- QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
-
- m_client->setTraceState(true);
- m_client->setTraceState(false);
- checkTraceReceived();
- checkJsHeap();
+ QTest::addColumn<bool>("blockMode");
+ QTest::addColumn<bool>("restrictMode");
+ QTest::addColumn<bool>("traceEnabled");
+ QTest::newRow("normal/unrestricted/disabled") << false << false << false;
+ QTest::newRow("block/unrestricted/disabled") << true << false << false;
+ QTest::newRow("normal/restricted/disabled") << false << true << false;
+ QTest::newRow("block/restricted/disabled") << true << true << false;
+ QTest::newRow("normal/unrestricted/enabled") << false << false << true;
+ QTest::newRow("block/unrestricted/enabled") << true << false << true;
+ QTest::newRow("normal/restricted/enabled") << false << true << true;
+ QTest::newRow("block/restricted/enabled") << true << true << true;
}
-void tst_QQmlProfilerService::blockingConnectWithTraceDisabled()
+void tst_QQmlProfilerService::connect()
{
- connect(true, "test.qml");
- QVERIFY(m_client);
- QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
+ QFETCH(bool, blockMode);
+ QFETCH(bool, restrictMode);
+ QFETCH(bool, traceEnabled);
- m_client->setTraceState(false);
- m_client->setTraceState(true);
- m_client->setTraceState(false);
- checkTraceReceived();
- checkJsHeap();
-}
-
-void tst_QQmlProfilerService::nonBlockingConnect()
-{
- connect(false, "test.qml");
- QVERIFY(m_client);
- QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
+ connect(blockMode, "test.qml", restrictMode);
+ // if the engine is waiting, then the first message determines if it starts with trace enabled
+ if (!traceEnabled)
+ m_client->setTraceState(false);
m_client->setTraceState(true);
m_client->setTraceState(false);
checkTraceReceived();
void tst_QQmlProfilerService::pixmapCacheData()
{
connect(true, "pixmapCacheTest.qml");
- QVERIFY(m_client);
- QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
m_client->setTraceState(true);
QVERIFY(QQmlDebugTest::waitForSignal(m_process, SIGNAL(readyReadStandardOutput())));
void tst_QQmlProfilerService::scenegraphData()
{
connect(true, "scenegraphTest.qml");
- QVERIFY(m_client);
- QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
m_client->setTraceState(true);
void tst_QQmlProfilerService::profileOnExit()
{
connect(true, "exit.qml");
- QVERIFY(m_client);
- QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
m_client->setTraceState(true);
void tst_QQmlProfilerService::controlFromJS()
{
connect(true, "controlFromJS.qml");
- QVERIFY(m_client);
- QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
m_client->setTraceState(false);
checkTraceReceived();
void tst_QQmlProfilerService::signalSourceLocation()
{
connect(true, "signalSourceLocation.qml");
- QVERIFY(m_client);
- QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
m_client->setTraceState(true);
while (!(m_process->output().contains(QLatin1String("500"))))
void tst_QQmlProfilerService::javascript()
{
connect(true, "javascript.qml");
- QVERIFY(m_client);
- QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
m_client->setTraceState(true);
while (!(m_process->output().contains(QLatin1String("done"))))
void tst_QQmlProfilerService::flushInterval()
{
connect(true, "timer.qml");
- QVERIFY(m_client);
- QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
m_client->setTraceState(true, 1);
if (m_runMode == LaunchMode) {
m_process = new QProcess(this);
QStringList arguments;
- arguments << QString::fromLatin1("-qmljsdebugger=port:%1,block").arg(m_port);
+ arguments << QString::fromLatin1("-qmljsdebugger=port:%1,block,services:CanvasFrameRate")
+ .arg(m_port);
arguments << m_programArguments;
m_process->setProcessChannelMode(QProcess::MergedChannels);