1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

Skip KWallet and GnomeKeyring tests when service not running

This commit is contained in:
David Rosca 2015-10-09 11:58:40 +02:00
parent 0f6720a32c
commit 2cdb0a0b32
3 changed files with 33 additions and 1 deletions

View File

@ -1,6 +1,6 @@
include($$PWD/../../src/defines.pri) include($$PWD/../../src/defines.pri)
QT += webenginewidgets network widgets printsupport sql script testlib QT += webenginewidgets network widgets printsupport sql script dbus testlib
TARGET = autotests TARGET = autotests

View File

@ -22,6 +22,8 @@
#include <QSqlDatabase> #include <QSqlDatabase>
#include <QSqlQuery> #include <QSqlQuery>
#include <QDebug> #include <QDebug>
#include <QDBusMessage>
#include <QDBusConnection>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include "qt_windows.h" #include "qt_windows.h"
@ -272,6 +274,20 @@ void DatabaseEncryptedPasswordBackendTest::cleanup()
#ifdef HAVE_KDE_PASSWORDS_PLUGIN #ifdef HAVE_KDE_PASSWORDS_PLUGIN
// KWalletPassswordBackendTest // KWalletPassswordBackendTest
void KWalletPassswordBackendTest::init()
{
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.freedesktop.DBus"),
QStringLiteral("/org/freedesktop/DBus"),
QStringLiteral("org.freedesktop.DBus"),
QStringLiteral("StartServiceByName"));
msg << "org.kde.kwalletd5";
msg << quint32(0);
QDBusMessage reply = QDBusConnection::sessionBus().call(msg);
if (reply.arguments().isEmpty() || reply.arguments().first().toInt() != 1)
QSKIP("This test requires org.kde.kwalletd5 service.");
}
void KWalletPasswordBackendTest::reloadBackend() void KWalletPasswordBackendTest::reloadBackend()
{ {
delete m_backend; delete m_backend;
@ -281,6 +297,20 @@ void KWalletPasswordBackendTest::reloadBackend()
#ifdef HAVE_GNOME_PASSWORDS_PLUGIN #ifdef HAVE_GNOME_PASSWORDS_PLUGIN
// GnomeKeyringPassswordBackendTest // GnomeKeyringPassswordBackendTest
void GnomeKeyringPasswordBackendTest::init()
{
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.freedesktop.DBus"),
QStringLiteral("/org/freedesktop/DBus"),
QStringLiteral("org.freedesktop.DBus"),
QStringLiteral("StartServiceByName"));
msg << "org.freedesktop.secrets";
msg << quint32(0);
QDBusMessage reply = QDBusConnection::sessionBus().call(msg);
if (reply.arguments().isEmpty() || reply.arguments().first().toInt() != 1)
QSKIP("This test requires org.freedesktop.secrets service.");
}
void GnomeKeyringPasswordBackendTest::reloadBackend() void GnomeKeyringPasswordBackendTest::reloadBackend()
{ {
delete m_backend; delete m_backend;

View File

@ -83,6 +83,7 @@ class KWalletPasswordBackendTest : public PasswordBackendTest
Q_OBJECT Q_OBJECT
protected: protected:
void init();
void reloadBackend(); void reloadBackend();
}; };
#endif #endif
@ -95,6 +96,7 @@ class GnomeKeyringPasswordBackendTest : public PasswordBackendTest
Q_OBJECT Q_OBJECT
protected: protected:
void init();
void reloadBackend(); void reloadBackend();
}; };
#endif #endif