aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/debugger/qqmlenginecontrol
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/auto/qml/debugger/qqmlenginecontrol
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/auto/qml/debugger/qqmlenginecontrol')
-rw-r--r--tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp42
1 files changed, 33 insertions, 9 deletions
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());