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

Proposed by Alberto Mardegan
Status: Merged
Approved by: David Barth
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
Online Accounts 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

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
269. By Alberto Mardegan

Connect to the signals when we actually have a request

270. By Alberto Mardegan

Check for null

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'client/OnlineAccountsClient/setup.cpp'
2--- client/OnlineAccountsClient/setup.cpp 2014-09-15 12:16:50 +0000
3+++ client/OnlineAccountsClient/setup.cpp 2015-06-18 14:06:12 +0000
4@@ -134,6 +134,7 @@
5 QDBusPendingReply<QVariantMap> reply = *watcher;
6 if (reply.isError()) {
7 qWarning() << "RequestAccess failed:" << reply.error();
8+ response.insert("errorName", reply.error().name());
9 } else {
10 // At the moment, we don't have any use for the reply.
11 response = reply.value();
12
13=== modified file 'plugins/module/WebView.qml'
14--- plugins/module/WebView.qml 2014-09-30 11:20:11 +0000
15+++ plugins/module/WebView.qml 2015-06-18 14:06:12 +0000
16@@ -7,7 +7,7 @@
17
18 property QtObject signonRequest
19
20- Component.onCompleted: {
21+ onSignonRequestChanged: if (signonRequest) {
22 signonRequest.authenticated.connect(onAuthenticated)
23 url = signonRequest.startUrl
24 }
25
26=== modified file 'tests/client/tst_client.cpp'
27--- tests/client/tst_client.cpp 2014-09-15 12:16:50 +0000
28+++ tests/client/tst_client.cpp 2015-06-18 14:06:12 +0000
29@@ -24,6 +24,7 @@
30
31 #include <OnlineAccountsClient/Setup>
32 #include <QDBusConnection>
33+#include <QDBusContext>
34 #include <QDebug>
35 #include <QFile>
36 #include <QProcessEnvironment>
37@@ -32,7 +33,7 @@
38
39 using namespace OnlineAccountsClient;
40
41-class Service: public QObject
42+class Service: public QObject, QDBusContext
43 {
44 Q_OBJECT
45 Q_CLASSINFO("D-Bus Interface",
46@@ -42,14 +43,21 @@
47 Service(): QObject() {}
48 QVariantMap options() const { return m_options; }
49
50+ void setError(const QString &name) { m_errorName = name; }
51+
52 public Q_SLOTS:
53 QVariantMap requestAccess(const QVariantMap &options) {
54 m_options = options;
55+ if (!m_errorName.isEmpty()) {
56+ sendErrorReply(m_errorName, "Some error");
57+ m_errorName = QString();
58+ }
59 return QVariantMap();
60 }
61
62 private:
63 QVariantMap m_options;
64+ QString m_errorName;
65 };
66
67 class SetupTest: public QObject
68@@ -67,6 +75,7 @@
69 void testExecWithProvider();
70 void testExecWithServiceType();
71 void testExecWithApplication();
72+ void testError();
73 void testWindowId();
74
75 private:
76@@ -170,6 +179,21 @@
77 uint(window.winId()));
78 }
79
80+void SetupTest::testError()
81+{
82+ m_service.setError("com.ubuntu.SomeError");
83+
84+ Setup setup;
85+
86+ QSignalSpy finished(&setup, SIGNAL(finished(QVariantMap)));
87+ setup.exec();
88+
89+ QVERIFY(finished.wait(10000));
90+ QCOMPARE(finished.count(), 1);
91+ QCOMPARE(finished.at(0).at(0).toMap().value("errorName").toString(),
92+ QString("com.ubuntu.SomeError"));
93+}
94+
95 QTEST_MAIN(SetupTest);
96
97 #include "tst_client.moc"

Subscribers

People subscribed via source and target branches