aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2015-08-05 17:27:08 +0200
committerUlf Hermann <ulf.hermann@theqtcompany.com>2015-08-13 08:30:47 +0000
commitfbdc01f141a4ec4e6fc78ea69d86ff7aa128bf72 (patch)
tree4529687ecc253a463abdd568f717143ec966dbb0 /tests
parentfc3403502fed19e0b8ab5a85b0c3aa2587e22475 (diff)
Allow specification of loadable debug services via command line
We don't want to load the debugger when profiling and vice versa. This makes it easier to prevent unwanted services from getting loaded. Task-number: QTBUG-47623 Change-Id: I28893b6218110274a6d30b27805d89dbb443add3 Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp96
-rw-r--r--tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp42
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp26
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp2
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp39
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp81
6 files changed, 161 insertions, 125 deletions
diff --git a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
index ed424b5a67..7dbe35807d 100644
--- a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
+++ b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
@@ -120,6 +120,8 @@ const char *UNCAUGHT = "uncaught";
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";
@@ -157,7 +159,8 @@ class tst_QQmlDebugJS : public QQmlDataTest
{
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();
@@ -165,6 +168,7 @@ private slots:
void cleanup();
+ void connect_data();
void connect();
void interrupt();
void getVersion();
@@ -822,33 +826,29 @@ void tst_QQmlDebugJS::cleanupTestCase()
// 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()
@@ -874,11 +874,21 @@ 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())));
}
@@ -887,7 +897,7 @@ void tst_QQmlDebugJS::interrupt()
{
//void connect()
- QVERIFY(init());
+ init();
client->connect();
client->interrupt();
@@ -898,7 +908,7 @@ void tst_QQmlDebugJS::getVersion()
{
//void version()
- QVERIFY(init());
+ init();
client->connect();
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(connected())));
@@ -923,7 +933,7 @@ void tst_QQmlDebugJS::disconnect()
{
//void disconnect()
- QVERIFY(init());
+ init();
client->connect();
client->disconnect();
@@ -935,7 +945,7 @@ void tst_QQmlDebugJS::setBreakpointInScriptOnCompleted()
//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();
@@ -955,7 +965,7 @@ void tst_QQmlDebugJS::setBreakpointInScriptOnComponentCreated()
//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();
@@ -973,7 +983,7 @@ void tst_QQmlDebugJS::setBreakpointInScriptOnComponentCreated()
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
@@ -995,7 +1005,7 @@ void tst_QQmlDebugJS::setBreakpointInScriptInDifferentFile()
//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();
@@ -1016,7 +1026,7 @@ void tst_QQmlDebugJS::setBreakpointInScriptOnComment()
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();
@@ -1038,7 +1048,7 @@ void tst_QQmlDebugJS::setBreakpointInScriptOnEmptyLine()
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();
@@ -1059,7 +1069,7 @@ void tst_QQmlDebugJS::setBreakpointInScriptOnOptimizedBinding()
//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();
@@ -1078,7 +1088,7 @@ void tst_QQmlDebugJS::setBreakpointInScriptWithCondition()
{
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().
@@ -1112,7 +1122,7 @@ void tst_QQmlDebugJS::setBreakpointInScriptWithCondition()
void tst_QQmlDebugJS::setBreakpointInScriptThatQuits()
{
- QVERIFY(init(QUIT_QMLFILE));
+ init(QUIT_QMLFILE);
int sourceLine = 41;
@@ -1153,7 +1163,7 @@ void tst_QQmlDebugJS::setBreakpointOnEvent()
//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();
@@ -1174,7 +1184,7 @@ void tst_QQmlDebugJS::clearBreakpoint()
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().
@@ -1219,7 +1229,7 @@ void tst_QQmlDebugJS::setExceptionBreak()
{
//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())));
@@ -1230,7 +1240,7 @@ void tst_QQmlDebugJS::stepNext()
//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();
@@ -1254,7 +1264,7 @@ void tst_QQmlDebugJS::stepIn()
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();
@@ -1278,7 +1288,7 @@ void tst_QQmlDebugJS::stepOut()
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();
@@ -1302,7 +1312,7 @@ void tst_QQmlDebugJS::continueDebugging()
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);
@@ -1326,7 +1336,7 @@ void tst_QQmlDebugJS::backtrace()
//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();
@@ -1341,7 +1351,7 @@ void tst_QQmlDebugJS::getFrameDetails()
//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();
@@ -1356,7 +1366,7 @@ void tst_QQmlDebugJS::getScopeDetails()
//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();
@@ -1371,7 +1381,7 @@ void tst_QQmlDebugJS::evaluateInGlobalScope()
{
//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);
@@ -1393,7 +1403,7 @@ void tst_QQmlDebugJS::evaluateInLocalScope()
//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();
@@ -1427,7 +1437,7 @@ void tst_QQmlDebugJS::getScripts()
{
//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();
diff --git a/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp b/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp
index f6cf9dae60..11fa56d710 100644
--- a/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp
+++ b/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp
@@ -103,12 +103,15 @@ private:
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();
};
@@ -148,11 +151,13 @@ void QQmlEngineControlClient::messageReceived(const QByteArray &message)
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);
@@ -165,6 +170,8 @@ void tst_QQmlEngineControl::connect(const QString &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()
@@ -183,11 +190,23 @@ 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());
@@ -196,11 +215,16 @@ void tst_QQmlEngineControl::startEngine()
"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());
diff --git a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp
index 8d119a30d7..0285bae189 100644
--- a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp
+++ b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp
@@ -61,6 +61,7 @@ public:
private:
+ void init(bool restrictServices);
QmlDebugObjectReference findRootObject();
QQmlDebugProcess *m_process;
@@ -68,9 +69,9 @@ private:
QQmlEngineDebugClient *m_engineDebugClient;
private slots:
- void init();
void cleanup();
+ void connect_data();
void connect();
void clearObjectReferenceHashonReloadQml();
};
@@ -93,9 +94,12 @@ QmlDebugObjectReference tst_QQmlEngineDebugInspectorIntegration::findRootObject(
}
-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)
@@ -108,10 +112,8 @@ void tst_QQmlEngineDebugInspectorIntegration::init()
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()
@@ -125,14 +127,24 @@ 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();
diff --git a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
index 2db544d661..bc3220ad8c 100644
--- a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
+++ b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
@@ -1225,7 +1225,7 @@ int main(int argc, char *argv[])
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);
diff --git a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
index 3769b1b9c4..70833f5e2c 100644
--- a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
+++ b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
@@ -60,7 +60,7 @@ public:
}
private:
- void startQmlsceneProcess(const char *qmlFile);
+ void startQmlsceneProcess(const char *qmlFile, bool restrictMode = true);
private:
QQmlDebugProcess *m_process;
@@ -68,18 +68,20 @@ private:
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);
@@ -87,15 +89,13 @@ void tst_QQmlInspector::startQmlsceneProcess(const char * /* qmlFile */)
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()
@@ -104,16 +104,25 @@ 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()
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
index 744830b55b..0e63e18952 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
@@ -197,7 +197,7 @@ private:
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,
@@ -206,9 +206,8 @@ private:
private slots:
void cleanup();
- void blockingConnectWithTraceEnabled();
- void blockingConnectWithTraceDisabled();
- void nonBlockingConnect();
+ void connect_data();
+ void connect();
void pixmapCacheData();
void scenegraphData();
void profileOnExit();
@@ -357,17 +356,16 @@ void QQmlProfilerClient::messageReceived(const QByteArray &message)
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);
@@ -378,6 +376,8 @@ void tst_QQmlProfilerService::connect(bool block, const QString &testFile)
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()
@@ -560,37 +560,32 @@ void tst_QQmlProfilerService::cleanup()
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();
@@ -600,8 +595,6 @@ void tst_QQmlProfilerService::nonBlockingConnect()
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())));
@@ -639,8 +632,6 @@ void tst_QQmlProfilerService::pixmapCacheData()
void tst_QQmlProfilerService::scenegraphData()
{
connect(true, "scenegraphTest.qml");
- QVERIFY(m_client);
- QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
m_client->setTraceState(true);
@@ -693,8 +684,6 @@ void tst_QQmlProfilerService::scenegraphData()
void tst_QQmlProfilerService::profileOnExit()
{
connect(true, "exit.qml");
- QVERIFY(m_client);
- QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
m_client->setTraceState(true);
@@ -705,8 +694,6 @@ void tst_QQmlProfilerService::profileOnExit()
void tst_QQmlProfilerService::controlFromJS()
{
connect(true, "controlFromJS.qml");
- QVERIFY(m_client);
- QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
m_client->setTraceState(false);
checkTraceReceived();
@@ -716,8 +703,6 @@ void tst_QQmlProfilerService::controlFromJS()
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"))))
@@ -741,8 +726,6 @@ void tst_QQmlProfilerService::signalSourceLocation()
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"))))
@@ -772,8 +755,6 @@ void tst_QQmlProfilerService::javascript()
void tst_QQmlProfilerService::flushInterval()
{
connect(true, "timer.qml");
- QVERIFY(m_client);
- QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
m_client->setTraceState(true, 1);