Merge lp:~mardy/ubuntu-system-settings-online-accounts/lp1441873 into lp:ubuntu-system-settings-online-accounts

Proposed by Alberto Mardegan on 2015-05-12
Status: Merged
Approved by: David Barth on 2015-06-09
Approved revision: 268
Merged at revision: 275
Proposed branch: lp:~mardy/ubuntu-system-settings-online-accounts/lp1441873
Merge into: lp:ubuntu-system-settings-online-accounts
Diff against target: 97 lines (+27/-2)
3 files modified
client/OnlineAccountsClient/setup.cpp (+1/-0)
plugins/module/WebView.qml (+1/-1)
tests/client/tst_client.cpp (+25/-1)
To merge this branch: bzr merge lp:~mardy/ubuntu-system-settings-online-accounts/lp1441873
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve on 2015-05-12
Online Accounts 2015-05-12 Pending
Review via email: mp+258874@code.launchpad.net

Commit message

Return the error name to the client

Description of the change

Return the error name to the client

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'client/OnlineAccountsClient/setup.cpp'
--- client/OnlineAccountsClient/setup.cpp 2014-09-15 12:16:50 +0000
+++ client/OnlineAccountsClient/setup.cpp 2015-06-18 14:06:12 +0000
@@ -134,6 +134,7 @@
134 QDBusPendingReply<QVariantMap> reply = *watcher;134 QDBusPendingReply<QVariantMap> reply = *watcher;
135 if (reply.isError()) {135 if (reply.isError()) {
136 qWarning() << "RequestAccess failed:" << reply.error();136 qWarning() << "RequestAccess failed:" << reply.error();
137 response.insert("errorName", reply.error().name());
137 } else {138 } else {
138 // At the moment, we don't have any use for the reply.139 // At the moment, we don't have any use for the reply.
139 response = reply.value();140 response = reply.value();
140141
=== modified file 'plugins/module/WebView.qml'
--- plugins/module/WebView.qml 2014-09-30 11:20:11 +0000
+++ plugins/module/WebView.qml 2015-06-18 14:06:12 +0000
@@ -7,7 +7,7 @@
77
8 property QtObject signonRequest8 property QtObject signonRequest
99
10 Component.onCompleted: {10 onSignonRequestChanged: if (signonRequest) {
11 signonRequest.authenticated.connect(onAuthenticated)11 signonRequest.authenticated.connect(onAuthenticated)
12 url = signonRequest.startUrl12 url = signonRequest.startUrl
13 }13 }
1414
=== modified file 'tests/client/tst_client.cpp'
--- tests/client/tst_client.cpp 2014-09-15 12:16:50 +0000
+++ tests/client/tst_client.cpp 2015-06-18 14:06:12 +0000
@@ -24,6 +24,7 @@
2424
25#include <OnlineAccountsClient/Setup>25#include <OnlineAccountsClient/Setup>
26#include <QDBusConnection>26#include <QDBusConnection>
27#include <QDBusContext>
27#include <QDebug>28#include <QDebug>
28#include <QFile>29#include <QFile>
29#include <QProcessEnvironment>30#include <QProcessEnvironment>
@@ -32,7 +33,7 @@
3233
33using namespace OnlineAccountsClient;34using namespace OnlineAccountsClient;
3435
35class Service: public QObject36class Service: public QObject, QDBusContext
36{37{
37 Q_OBJECT38 Q_OBJECT
38 Q_CLASSINFO("D-Bus Interface",39 Q_CLASSINFO("D-Bus Interface",
@@ -42,14 +43,21 @@
42 Service(): QObject() {}43 Service(): QObject() {}
43 QVariantMap options() const { return m_options; }44 QVariantMap options() const { return m_options; }
4445
46 void setError(const QString &name) { m_errorName = name; }
47
45public Q_SLOTS:48public Q_SLOTS:
46 QVariantMap requestAccess(const QVariantMap &options) {49 QVariantMap requestAccess(const QVariantMap &options) {
47 m_options = options;50 m_options = options;
51 if (!m_errorName.isEmpty()) {
52 sendErrorReply(m_errorName, "Some error");
53 m_errorName = QString();
54 }
48 return QVariantMap();55 return QVariantMap();
49 }56 }
5057
51private:58private:
52 QVariantMap m_options;59 QVariantMap m_options;
60 QString m_errorName;
53};61};
5462
55class SetupTest: public QObject63class SetupTest: public QObject
@@ -67,6 +75,7 @@
67 void testExecWithProvider();75 void testExecWithProvider();
68 void testExecWithServiceType();76 void testExecWithServiceType();
69 void testExecWithApplication();77 void testExecWithApplication();
78 void testError();
70 void testWindowId();79 void testWindowId();
7180
72private:81private:
@@ -170,6 +179,21 @@
170 uint(window.winId()));179 uint(window.winId()));
171}180}
172181
182void SetupTest::testError()
183{
184 m_service.setError("com.ubuntu.SomeError");
185
186 Setup setup;
187
188 QSignalSpy finished(&setup, SIGNAL(finished(QVariantMap)));
189 setup.exec();
190
191 QVERIFY(finished.wait(10000));
192 QCOMPARE(finished.count(), 1);
193 QCOMPARE(finished.at(0).at(0).toMap().value("errorName").toString(),
194 QString("com.ubuntu.SomeError"));
195}
196
173QTEST_MAIN(SetupTest);197QTEST_MAIN(SetupTest);
174198
175#include "tst_client.moc"199#include "tst_client.moc"

Subscribers

People subscribed via source and target branches