aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmlprofiler/tests
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2016-08-04 18:02:15 +0200
committerUlf Hermann <ulf.hermann@qt.io>2016-08-05 08:43:31 +0000
commit713bc04ad4560123d97bb469d109a0885cf36373 (patch)
tree2f750bd5b47cd547a6167b2086d6d3d900d3eb0a /src/plugins/qmlprofiler/tests
parent79a63ef1ed9646ab4bb539834b5ac01d139e0bbe (diff)
QmlProfiler: Add a test for clean shutdown of client manager
Change-Id: I0d6deea53302022c18c4aacef395393d60308b84 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/qmlprofiler/tests')
-rw-r--r--src/plugins/qmlprofiler/tests/qmlprofilerclientmanager_test.cpp37
-rw-r--r--src/plugins/qmlprofiler/tests/qmlprofilerclientmanager_test.h1
2 files changed, 38 insertions, 0 deletions
diff --git a/src/plugins/qmlprofiler/tests/qmlprofilerclientmanager_test.cpp b/src/plugins/qmlprofiler/tests/qmlprofilerclientmanager_test.cpp
index 81419da7267..192c857236a 100644
--- a/src/plugins/qmlprofiler/tests/qmlprofilerclientmanager_test.cpp
+++ b/src/plugins/qmlprofiler/tests/qmlprofilerclientmanager_test.cpp
@@ -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
diff --git a/src/plugins/qmlprofiler/tests/qmlprofilerclientmanager_test.h b/src/plugins/qmlprofiler/tests/qmlprofilerclientmanager_test.h
index 2c105f29edf..f3f3ac2d8db 100644
--- a/src/plugins/qmlprofiler/tests/qmlprofilerclientmanager_test.h
+++ b/src/plugins/qmlprofiler/tests/qmlprofilerclientmanager_test.h
@@ -53,6 +53,7 @@ private slots:
void testResponsiveLocal();
void testInvalidData();
+ void testStopRecording();
private:
QmlProfilerClientManager clientManager;