aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2017-11-08 17:39:14 +0100
committerUlf Hermann <ulf.hermann@qt.io>2017-11-09 10:54:48 +0000
commit5fabf9af64ea9a2e842434bb7711e9c0d16c30e3 (patch)
treea0f00098b7e38a4ef69a6dd3138ac9c538f64393 /src
parent1fa7ad21165591dfb0676cb4ddfab8a1c25b1f2f (diff)
QmlProfiler: Reset the serverRecording flag when the connection drops
Otherwise the run control will believe that the application is still running. Change-Id: I16ec9762362f526bd89eb21ceb82b89b295d7b5c Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp1
-rw-r--r--src/plugins/qmlprofiler/tests/qmlprofilerclientmanager_test.cpp24
-rw-r--r--src/plugins/qmlprofiler/tests/qmlprofilerclientmanager_test.h1
3 files changed, 26 insertions, 0 deletions
diff --git a/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp b/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp
index 0152d994e4..7f0677af7b 100644
--- a/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp
@@ -295,6 +295,7 @@ void QmlProfilerClientManager::qmlDebugConnectionClosed()
QTC_ASSERT(m_connection && m_qmlclientplugin, return);
QTC_ASSERT(!m_connection->isConnected(), return);
disconnectClient();
+ m_profilerState->setServerRecording(false);
emit connectionClosed();
}
diff --git a/src/plugins/qmlprofiler/tests/qmlprofilerclientmanager_test.cpp b/src/plugins/qmlprofiler/tests/qmlprofilerclientmanager_test.cpp
index 0318a6b618..3a26b61e09 100644
--- a/src/plugins/qmlprofiler/tests/qmlprofilerclientmanager_test.cpp
+++ b/src/plugins/qmlprofiler/tests/qmlprofilerclientmanager_test.cpp
@@ -427,5 +427,29 @@ void QmlProfilerClientManagerTest::testStopRecording()
// Delete while still connected, for added fun
}
+void QmlProfilerClientManagerTest::testConnectionDrop()
+{
+ QUrl socketUrl = urlFromLocalSocket();
+ QmlProfilerClientManager clientManager;
+
+ {
+ clientManager.setRetryParams(10, 10);
+ clientManager.setProfilerStateManager(&stateManager);
+ clientManager.setModelManager(&modelManager);
+ clientManager.connectToServer(socketUrl);
+
+ QScopedPointer<QLocalSocket> socket(new QLocalSocket(this));
+ socket->connectToServer(socketUrl.path());
+ QVERIFY(socket->isOpen());
+ fakeDebugServer(socket.data());
+
+ // Fake a trace. We want to test that this is reset when the connection drops.
+ stateManager.setServerRecording(true);
+ QTRY_VERIFY(clientManager.isConnected());
+ }
+
+ QTRY_VERIFY(!stateManager.serverRecording());
+}
+
} // namespace Internal
} // namespace QmlProfiler
diff --git a/src/plugins/qmlprofiler/tests/qmlprofilerclientmanager_test.h b/src/plugins/qmlprofiler/tests/qmlprofilerclientmanager_test.h
index f3f3ac2d8d..22c4cf32e1 100644
--- a/src/plugins/qmlprofiler/tests/qmlprofilerclientmanager_test.h
+++ b/src/plugins/qmlprofiler/tests/qmlprofilerclientmanager_test.h
@@ -54,6 +54,7 @@ private slots:
void testInvalidData();
void testStopRecording();
+ void testConnectionDrop();
private:
QmlProfilerClientManager clientManager;