QmlProfiler: Drop static accessors from QmlProfilerTool

It wasn't really a singleton even before. For testing purposes make the
client/state/model managers accessible.

Change-Id: Ie5efbc47a6b9119495f999e4e05877d4789da407
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Ulf Hermann
2018-01-09 14:50:12 +01:00
parent 7d039de7a8
commit e1ad7a1784
7 changed files with 89 additions and 67 deletions

View File

@@ -28,6 +28,7 @@
#include <debugger/analyzer/analyzermanager.h>
#include <projectexplorer/runnables.h>
#include <qmlprofiler/qmlprofilerruncontrol.h>
#include <qmlprofiler/qmlprofilertool.h>
#include <utils/url.h>
@@ -43,6 +44,7 @@ LocalQmlProfilerRunnerTest::LocalQmlProfilerRunnerTest(QObject *parent) : QObjec
void LocalQmlProfilerRunnerTest::testRunner()
{
QmlProfilerTool tool(nullptr);
QPointer<ProjectExplorer::RunControl> runControl;
QPointer<LocalQmlProfilerSupport> profiler;
ProjectExplorer::StandardRunnable debuggee;
@@ -64,7 +66,7 @@ void LocalQmlProfilerRunnerTest::testRunner()
runControl = new ProjectExplorer::RunControl(nullptr,
ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
runControl->setRunnable(debuggee);
profiler = new LocalQmlProfilerSupport(runControl, serverUrl);
profiler = new LocalQmlProfilerSupport(&tool, runControl, serverUrl);
auto connectRunner = [&]() {
connect(runControl, &ProjectExplorer::RunControl::aboutToStart, this, [&]() {
@@ -112,7 +114,7 @@ void LocalQmlProfilerRunnerTest::testRunner()
runControl = new ProjectExplorer::RunControl(nullptr,
ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
runControl->setRunnable(debuggee);
profiler = new LocalQmlProfilerSupport(runControl, serverUrl);
profiler = new LocalQmlProfilerSupport(&tool, runControl, serverUrl);
connectRunner();
runControl->initiateStart();
@@ -132,7 +134,7 @@ void LocalQmlProfilerRunnerTest::testRunner()
runControl = new ProjectExplorer::RunControl(nullptr,
ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
runControl->setRunnable(debuggee);
profiler = new LocalQmlProfilerSupport(runControl, serverUrl);
profiler = new LocalQmlProfilerSupport(&tool, runControl, serverUrl);
connectRunner();
runControl->initiateStart();