## Summary
pluginloadtest and sendfiletest are crashing. This patch fixes that by allowing Daemon::init() to be called from TestDaemon ## Test Plan ### Before: Both tests are crashing because it is not able to find any devices. It is not able to find any devices because the LanLinkProvider is not being added because Daemon::init() is not being called. ### After: pluginloadtest and sendfiletest pass
This commit is contained in:
parent
163f10c797
commit
24ab6d15cf
5 changed files with 24 additions and 1 deletions
|
@ -179,6 +179,11 @@ Device*Daemon::getDevice(const QString& deviceId)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QSet<LinkProvider*>& Daemon::getLinkProviders() const
|
||||||
|
{
|
||||||
|
return d->m_linkProviders;
|
||||||
|
}
|
||||||
|
|
||||||
QStringList Daemon::devices(bool onlyReachable, bool onlyTrusted) const
|
QStringList Daemon::devices(bool onlyReachable, bool onlyTrusted) const
|
||||||
{
|
{
|
||||||
QStringList ret;
|
QStringList ret;
|
||||||
|
|
|
@ -56,6 +56,8 @@ public:
|
||||||
|
|
||||||
Device* getDevice(const QString& deviceId);
|
Device* getDevice(const QString& deviceId);
|
||||||
|
|
||||||
|
const QSet<LinkProvider*>& getLinkProviders() const;
|
||||||
|
|
||||||
QStringList pairingRequests() const;
|
QStringList pairingRequests() const;
|
||||||
|
|
||||||
Q_SCRIPTABLE QString selfId() const;
|
Q_SCRIPTABLE QString selfId() const;
|
||||||
|
|
|
@ -46,6 +46,10 @@ class PluginLoadTest : public QObject
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void testPlugins() {
|
void testPlugins() {
|
||||||
|
if (!(m_daemon->getLinkProviders().size() > 0)) {
|
||||||
|
QFAIL("No links available, but loopback should have been provided by the test");
|
||||||
|
}
|
||||||
|
|
||||||
Device* d = nullptr;
|
Device* d = nullptr;
|
||||||
m_daemon->acquireDiscoveryMode(QStringLiteral("plugintest"));
|
m_daemon->acquireDiscoveryMode(QStringLiteral("plugintest"));
|
||||||
const QList<Device*> devicesList = m_daemon->devicesList();
|
const QList<Device*> devicesList = m_daemon->devicesList();
|
||||||
|
@ -57,6 +61,9 @@ class PluginLoadTest : public QObject
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (d == nullptr) {
|
||||||
|
QFAIL("Unable to determine device");
|
||||||
|
}
|
||||||
m_daemon->releaseDiscoveryMode(QStringLiteral("plugintest"));
|
m_daemon->releaseDiscoveryMode(QStringLiteral("plugintest"));
|
||||||
|
|
||||||
if (!d->loadedPlugins().contains(QStringLiteral("kdeconnect_remotecontrol"))) {
|
if (!d->loadedPlugins().contains(QStringLiteral("kdeconnect_remotecontrol"))) {
|
||||||
|
|
|
@ -51,6 +51,10 @@ class TestSendFile : public QObject
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void testSend() {
|
void testSend() {
|
||||||
|
if (!(m_daemon->getLinkProviders().size() > 0)) {
|
||||||
|
QFAIL("No links available, but loopback should have been provided by the test");
|
||||||
|
}
|
||||||
|
|
||||||
m_daemon->acquireDiscoveryMode(QStringLiteral("test"));
|
m_daemon->acquireDiscoveryMode(QStringLiteral("test"));
|
||||||
Device* d = nullptr;
|
Device* d = nullptr;
|
||||||
const QList<Device*> devicesList = m_daemon->devicesList();
|
const QList<Device*> devicesList = m_daemon->devicesList();
|
||||||
|
@ -61,8 +65,10 @@ class TestSendFile : public QObject
|
||||||
d = id;
|
d = id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (d == nullptr) {
|
||||||
|
QFAIL("Unable to determine device");
|
||||||
|
}
|
||||||
m_daemon->releaseDiscoveryMode(QStringLiteral("test"));
|
m_daemon->releaseDiscoveryMode(QStringLiteral("test"));
|
||||||
QVERIFY(d);
|
|
||||||
QCOMPARE(d->isReachable(), true);
|
QCOMPARE(d->isReachable(), true);
|
||||||
QCOMPARE(d->isTrusted(), true);
|
QCOMPARE(d->isTrusted(), true);
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,9 @@ public:
|
||||||
: Daemon(parent, true)
|
: Daemon(parent, true)
|
||||||
, m_nam(nullptr)
|
, m_nam(nullptr)
|
||||||
{
|
{
|
||||||
|
// Necessary to force the event loop to run because the test harness seems to behave differently
|
||||||
|
// and we need the QTimer::SingleShot in Daemon's constructor to fire
|
||||||
|
QCoreApplication::processEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
void addDevice(Device* device) {
|
void addDevice(Device* device) {
|
||||||
|
|
Loading…
Reference in a new issue