Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'jb27876' into 'master'
[libsignon] Don't emit QObject::destroyed() within Identity::destroy() See merge request mer-core/libsignon!6
- Loading branch information
Showing
12 changed files
with
226 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
rpm/0005-Guard-PendingCall-against-deletion-by-connected-slot.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
rpm/0006-Always-use-P2P-DBus-if-enabled.-Contributes-to-JB-42.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
rpm/0008-Initialize-secrets-db-on-start.-Fixes-JB-34557.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
rpm/0009-Treat-empty-ACL-as-synonym-for-.-Contributes-to-JB-2.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
196 changes: 196 additions & 0 deletions
196
rpm/0010-Use-P2P-DBus-server-for-tests-if-built-in-ENABLE_P2P.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,196 @@ | ||
From 3e61cde4207e67405833c64c0b3ad205752f7896 Mon Sep 17 00:00:00 2001 | ||
From: Chris Adams <chris.adams@jollamobile.com> | ||
Date: Wed, 20 May 2020 16:05:15 +1000 | ||
Subject: [PATCH 10/10] Use P2P DBus server for tests if built in ENABLE_P2P | ||
mode | ||
|
||
Also increase timeout of timeouts test, to allow dbus timeout | ||
to trigger first (required for successful notification of identity | ||
removal from daemon). | ||
--- | ||
.../libsignon-qt-tests/libsignon-qt-tests.pro | 5 +++ | ||
tests/libsignon-qt-tests/signon-ui.cpp | 40 ++++++++++++++----- | ||
tests/libsignon-qt-tests/signon-ui.h | 10 ++--- | ||
tests/libsignon-qt-tests/ssotestclient.cpp | 7 ++++ | ||
tests/signond-tests/timeouts.cpp | 7 +++- | ||
5 files changed, 52 insertions(+), 17 deletions(-) | ||
|
||
diff --git a/tests/libsignon-qt-tests/libsignon-qt-tests.pro b/tests/libsignon-qt-tests/libsignon-qt-tests.pro | ||
index 43f2d59..7d8afed 100644 | ||
--- a/tests/libsignon-qt-tests/libsignon-qt-tests.pro | ||
+++ b/tests/libsignon-qt-tests/libsignon-qt-tests.pro | ||
@@ -15,6 +15,11 @@ LIBS *= -lsignon-qt5 | ||
QMAKE_LIBDIR += $${TOP_BUILD_DIR}/lib/SignOn | ||
QMAKE_RPATHDIR = $${QMAKE_LIBDIR} | ||
|
||
+CONFIG(enable-p2p) { | ||
+ DEFINES += ENABLE_P2P | ||
+ PKGCONFIG += dbus-1 | ||
+} | ||
+ | ||
SOURCES += \ | ||
testauthsession.cpp \ | ||
testthread.cpp \ | ||
diff --git a/tests/libsignon-qt-tests/signon-ui.cpp b/tests/libsignon-qt-tests/signon-ui.cpp | ||
index 6b665d2..73e3117 100644 | ||
--- a/tests/libsignon-qt-tests/signon-ui.cpp | ||
+++ b/tests/libsignon-qt-tests/signon-ui.cpp | ||
@@ -31,22 +31,43 @@ | ||
static const char serviceName[] = "com.nokia.singlesignonui"; | ||
static const char objectPath[] = "/SignonUi"; | ||
|
||
+#ifdef ENABLE_P2P | ||
+SignOnUI::SignOnUI(QDBusServer *p2pBus, QObject *parent): | ||
+ QObject(parent), | ||
+ QDBusContext(), | ||
+ m_replyPassword("SSOUI default password"), | ||
+ m_delay(0) | ||
+{ | ||
+ QObject::connect(p2pBus, &QDBusServer::newConnection, | ||
+ this, [this] (const QDBusConnection &connection) { | ||
+ QDBusConnection clientConnection(connection); | ||
+ clientConnection.registerObject( | ||
+ QLatin1String(objectPath), | ||
+ QLatin1String(serviceName), | ||
+ this, | ||
+ QDBusConnection::ExportAllContents); | ||
+ clientConnection.registerService(QLatin1String(serviceName)); | ||
+ }); | ||
+} | ||
+#else | ||
SignOnUI::SignOnUI(QDBusConnection connection, QObject *parent): | ||
QObject(parent), | ||
QDBusContext(), | ||
- m_connection(connection), | ||
m_replyPassword("SSOUI default password"), | ||
m_delay(0) | ||
{ | ||
connection.registerObject(QLatin1String(objectPath), this, | ||
QDBusConnection::ExportAllContents); | ||
connection.registerService(QLatin1String(serviceName)); | ||
+ connect(this, &QObject::destroyed, [&connection] { | ||
+ connection.unregisterService(QLatin1String(serviceName)); | ||
+ connection.unregisterObject(QLatin1String(objectPath)); | ||
+ }); | ||
} | ||
+#endif | ||
|
||
SignOnUI::~SignOnUI() | ||
{ | ||
- m_connection.unregisterService(QLatin1String(serviceName)); | ||
- m_connection.unregisterObject(QLatin1String(objectPath)); | ||
} | ||
|
||
QVariantMap SignOnUI::clientData() const | ||
@@ -89,11 +110,15 @@ QVariantMap SignOnUI::queryDialog(const QVariantMap ¶meters) | ||
} | ||
result.insert(SSOUI_KEY_ERROR, SignOn::QUERY_ERROR_NONE); | ||
|
||
- m_reply = message().createReply(result); | ||
+ QDBusMessage reply = message().createReply(result); | ||
|
||
setDelayedReply(true); | ||
|
||
- QTimer::singleShot(m_delay, this, SLOT(processQueryDialog())); | ||
+ QDBusConnection conn(connection()); | ||
+ QTimer::singleShot(m_delay, this, [conn, reply] { | ||
+ conn.send(reply); | ||
+ }); | ||
+ | ||
return QVariantMap(); | ||
} | ||
|
||
@@ -102,8 +127,3 @@ QVariantMap SignOnUI::refreshDialog(const QVariantMap ¶meters) | ||
qDebug() << Q_FUNC_INFO << parameters; | ||
return parameters; | ||
} | ||
- | ||
-void SignOnUI::processQueryDialog() | ||
-{ | ||
- m_connection.send(m_reply); | ||
-} | ||
diff --git a/tests/libsignon-qt-tests/signon-ui.h b/tests/libsignon-qt-tests/signon-ui.h | ||
index b242189..8d0b95b 100644 | ||
--- a/tests/libsignon-qt-tests/signon-ui.h | ||
+++ b/tests/libsignon-qt-tests/signon-ui.h | ||
@@ -25,6 +25,7 @@ | ||
|
||
#include "SignOn/signonerror.h" | ||
|
||
+#include <QDBusServer> | ||
#include <QDBusConnection> | ||
#include <QDBusContext> | ||
#include <QDBusMessage> | ||
@@ -37,7 +38,11 @@ class SignOnUI: public QObject, protected QDBusContext | ||
Q_CLASSINFO("D-Bus Interface", "com.nokia.singlesignonui") | ||
|
||
public: | ||
+#ifdef ENABLE_P2P | ||
+ SignOnUI(QDBusServer *p2pBus, QObject *parent = 0); | ||
+#else | ||
SignOnUI(QDBusConnection connection, QObject *parent = 0); | ||
+#endif | ||
~SignOnUI(); | ||
|
||
/*! | ||
@@ -80,12 +85,7 @@ public Q_SLOTS: | ||
QVariantMap queryDialog(const QVariantMap ¶meters); | ||
QVariantMap refreshDialog(const QVariantMap &newParameters); | ||
|
||
-private Q_SLOTS: | ||
- void processQueryDialog(); | ||
- | ||
private: | ||
- QDBusMessage m_reply; | ||
- QDBusConnection m_connection; | ||
QVariantMap m_parameters; | ||
QString m_replyPassword; | ||
int m_delay; | ||
diff --git a/tests/libsignon-qt-tests/ssotestclient.cpp b/tests/libsignon-qt-tests/ssotestclient.cpp | ||
index 3ad9de3..a89d9ab 100644 | ||
--- a/tests/libsignon-qt-tests/ssotestclient.cpp | ||
+++ b/tests/libsignon-qt-tests/ssotestclient.cpp | ||
@@ -31,6 +31,7 @@ | ||
#include <QTest> | ||
#include <QThread> | ||
#include <QDir> | ||
+#include <QStandardPaths> | ||
|
||
using namespace SignOn; | ||
|
||
@@ -1660,7 +1661,13 @@ int main(int argc, char *argv[]) | ||
{ | ||
QCoreApplication app(argc, argv); | ||
|
||
+#ifdef ENABLE_P2P | ||
+ QDBusServer p2pBus(QStringLiteral("unix:path=%1/signonui-socket").arg(QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation))); | ||
+ SignOnUI signOnUI(&p2pBus); | ||
+#else | ||
SignOnUI signOnUI(QDBusConnection::sessionBus()); | ||
+#endif // ENABLE_P2P | ||
+ | ||
int ret; | ||
|
||
SsoTestClient ssoTestClient(&signOnUI); | ||
diff --git a/tests/signond-tests/timeouts.cpp b/tests/signond-tests/timeouts.cpp | ||
index dae8e4b..fb00acd 100644 | ||
--- a/tests/signond-tests/timeouts.cpp | ||
+++ b/tests/signond-tests/timeouts.cpp | ||
@@ -33,9 +33,12 @@ | ||
using namespace SignOn; | ||
|
||
/* | ||
- * test timeout 20 seconds | ||
+ * test timeout 70 seconds (greater than dbus timeout) | ||
+ * as SignonIdentity will attempt to perform a call | ||
+ * to SignOnUI service within ::remove(), which will | ||
+ * timeout as no SignOnUI service exists for this test. | ||
* */ | ||
-#define test_timeout 20000 | ||
+#define test_timeout 70000 | ||
|
||
|
||
void TimeoutsTest::initTestCase() | ||
-- | ||
2.17.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters