forked from qt-creator/qt-creator
QmlProfiler: Improve robustness of QmlProfilerTool test
The QmlProfilerClientManager will only report connectionClosed() if the connection was open before it dropped. If the connection never opens, that is the hello message never arrives, it will retry a few times, triggering the QTRY_VERIFY timeout. We don't want the retries to succeed, so close the server after the first connection. Furthermore we want the hello message to be transferred before dropping the connection, so check for isConnected(). Change-Id: Ie96c48b2aaf2748d082c4bef3efe85c261ca4812 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -50,6 +50,7 @@ void QmlProfilerToolTest::testAttachToWaitingApplication()
|
|||||||
connect(&server, &QTcpServer::newConnection, this, [&]() {
|
connect(&server, &QTcpServer::newConnection, this, [&]() {
|
||||||
connection.reset(server.nextPendingConnection());
|
connection.reset(server.nextPendingConnection());
|
||||||
fakeDebugServer(connection.data());
|
fakeDebugServer(connection.data());
|
||||||
|
server.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
QTimer timer;
|
QTimer timer;
|
||||||
@@ -68,6 +69,7 @@ void QmlProfilerToolTest::testAttachToWaitingApplication()
|
|||||||
|
|
||||||
QTRY_VERIFY(connection);
|
QTRY_VERIFY(connection);
|
||||||
QTRY_VERIFY(runControl->isRunning());
|
QTRY_VERIFY(runControl->isRunning());
|
||||||
|
QTRY_VERIFY(profilerTool->clientManager()->isConnected());
|
||||||
|
|
||||||
connection.reset();
|
connection.reset();
|
||||||
QTRY_VERIFY(runControl->isStopped());
|
QTRY_VERIFY(runControl->isStopped());
|
||||||
|
Reference in New Issue
Block a user