Commit 713bc04a authored by Ulf Hermann's avatar Ulf Hermann

QmlProfiler: Add a test for clean shutdown of client manager

Change-Id: I0d6deea53302022c18c4aacef395393d60308b84
Reviewed-by: Christian Kandeler's avatarChristian Kandeler <christian.kandeler@qt.io>
parent 79a63ef1
......@@ -419,5 +419,42 @@ void QmlProfilerClientManagerTest::testInvalidData()
clientManager.clearConnection();
}
void QmlProfilerClientManagerTest::testStopRecording()
{
QString socketFile = LocalQmlProfilerRunner::findFreeSocket();
{
QmlProfilerClientManager clientManager;
clientManager.setRetryParams(10, 10);
QSignalSpy openedSpy(&clientManager, SIGNAL(connectionOpened()));
QSignalSpy closedSpy(&clientManager, SIGNAL(connectionClosed()));
QVERIFY(!clientManager.isConnected());
clientManager.setProfilerStateManager(&stateManager);
clientManager.setModelManager(&modelManager);
connect(&clientManager, &QmlProfilerClientManager::connectionFailed,
&clientManager, &QmlProfilerClientManager::retryConnect);
clientManager.setLocalSocket(socketFile);
clientManager.startLocalServer();
QScopedPointer<QLocalSocket> socket(new QLocalSocket(this));
socket->connectToServer(socketFile);
QVERIFY(socket->isOpen());
fakeDebugServer(socket.data());
QTRY_COMPARE(openedSpy.count(), 1);
QCOMPARE(closedSpy.count(), 0);
QVERIFY(clientManager.isConnected());
// We can't verify that it does anything useful, but at least it doesn't crash
clientManager.stopRecording();
}
// Delete while still connected, for added fun
}
} // namespace Internal
} // namespace QmlProfiler
......@@ -53,6 +53,7 @@ private slots:
void testResponsiveLocal();
void testInvalidData();
void testStopRecording();
private:
QmlProfilerClientManager clientManager;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment