Merge lp:~diegosarmentero/clickmanager-plugin/sign-url into lp:clickmanager-plugin
- sign-url
- Merge into trunk
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Approved by: | Diego Sarmentero | ||||||||
Approved revision: | 22 | ||||||||
Merged at revision: | 12 | ||||||||
Proposed branch: | lp:~diegosarmentero/clickmanager-plugin/sign-url | ||||||||
Merge into: | lp:clickmanager-plugin | ||||||||
Diff against target: |
839 lines (+246/-38) 27 files modified
debian/control (+3/-0) src/application.cpp (+13/-4) src/application.h (+10/-1) src/clickmanager.cpp (+46/-11) src/clickmanager.h (+19/-7) src/clickmanager_plugin.cpp (+2/-0) src/download/downloader.cpp (+6/-2) src/download/downloader.h (+6/-2) src/download_tracker.cpp (+4/-0) src/download_tracker.h (+5/-1) src/network/network.cpp (+3/-0) src/network/network.h (+4/-0) src/src.pro (+3/-2) tests/fakedownloader.cpp (+11/-2) tests/fakedownloader.h (+6/-2) tests/fakenetwork.cpp (+4/-0) tests/fakenetwork.h (+4/-0) tests/fakeprocess.cpp (+4/-0) tests/fakeprocess.h (+4/-0) tests/fakessoservice.cpp (+16/-0) tests/fakessoservice.h (+27/-0) tests/test_main.cpp (+2/-0) tests/testapplication.cpp (+4/-0) tests/testapplication.h (+4/-0) tests/testclickmanager.cpp (+23/-0) tests/testclickmanager.h (+6/-0) tests/tests.pro (+7/-4) |
||||||||
To merge this branch: | bzr merge lp:~diegosarmentero/clickmanager-plugin/sign-url | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Alejandro J. Cura (community) | Approve | ||
dobey (community) | Abstain | ||
Review via email: mp+187602@code.launchpad.net |
Commit message
- Support signed url.
- Improve error handling.
Description of the change
Use ubuntuone-
- 20. By Diego Sarmentero
-
update debian/control to include new dependencies
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:20
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 21. By Diego Sarmentero
-
fixing includes
Diego Sarmentero (diegosarmentero) wrote : | # |
> +#include <ubuntuoneauth-
>
> This is wrong. You should only include <ssoservice> as the ubuntuoneauth-2.0
> should come from the INCLUDES paths passed to the compiler (as
> -I/usr/
Fixed
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:21
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
dobey (dobey) : | # |
Alejandro J. Cura (alecu) wrote : | # |
While reviewing this I found a bug for clickmanager-plugin here: #1231422, but this branch looks good to me.
dobey (dobey) wrote : | # |
I'm abstaining for now, because this really should be 2 separate branches, one which adds the ClickPlugin namespace changes, and another which depends on that one, which adds the URL signing bits. I don't want to block this too long, given our current time frame, but I do want to state such changes should be split into separate branches when they are this invasive. So I am choosing to Abstain rather than vote Needs Fixing.
- 22. By Diego Sarmentero
-
* Automatic snapshot from revision 9
[ Ćukasz 'sil2100' Zemczak ]
* Automatic snapshot from revision 5 (bootstrap)
[ Ubuntu daily release ]
* Automatic snapshot from revision 6
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:22
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'debian/control' | |||
2 | --- debian/control 2013-09-18 13:27:46 +0000 | |||
3 | +++ debian/control 2013-09-26 16:47:31 +0000 | |||
4 | @@ -4,6 +4,9 @@ | |||
5 | 4 | Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> | 4 | Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> |
6 | 5 | Build-Depends: debhelper (>= 9), | 5 | Build-Depends: debhelper (>= 9), |
7 | 6 | libapt-pkg-dev, | 6 | libapt-pkg-dev, |
8 | 7 | libubuntuoneauth-2.0-dev, | ||
9 | 8 | libsignon-qt5-dev, | ||
10 | 9 | libaccounts-qt5-dev, | ||
11 | 7 | qt5-default, | 10 | qt5-default, |
12 | 8 | qt5-qmake, | 11 | qt5-qmake, |
13 | 9 | qtbase5-dev, | 12 | qtbase5-dev, |
14 | 10 | 13 | ||
15 | === modified file 'src/application.cpp' | |||
16 | --- src/application.cpp 2013-09-13 10:12:01 +0000 | |||
17 | +++ src/application.cpp 2013-09-26 16:47:31 +0000 | |||
18 | @@ -21,6 +21,8 @@ | |||
19 | 21 | #include <apt-pkg/debversion.h> | 21 | #include <apt-pkg/debversion.h> |
20 | 22 | #include <QDebug> | 22 | #include <QDebug> |
21 | 23 | 23 | ||
22 | 24 | namespace ClickPlugin { | ||
23 | 25 | |||
24 | 24 | Application::Application(QQuickItem *parent) : | 26 | Application::Application(QQuickItem *parent) : |
25 | 25 | QQuickItem(parent) | 27 | QQuickItem(parent) |
26 | 26 | { | 28 | { |
27 | @@ -47,13 +49,20 @@ | |||
28 | 47 | { | 49 | { |
29 | 48 | this->m_remote_version = version; | 50 | this->m_remote_version = version; |
30 | 49 | 51 | ||
35 | 50 | debVersioningSystem debVersion; | 52 | int result = debVS.CmpVersion(this->m_local_version.toUtf8().data(), |
36 | 51 | 53 | this->m_remote_version.toUtf8().data()); | |
33 | 52 | int result = debVersion.CmpVersion(this->m_local_version.toUtf8().data(), | ||
34 | 53 | this->m_remote_version.toUtf8().data()); | ||
37 | 54 | if(result == -1) { | 54 | if(result == -1) { |
38 | 55 | this->m_update = true; | 55 | this->m_update = true; |
39 | 56 | }else{ | 56 | }else{ |
40 | 57 | this->m_update = false; | 57 | this->m_update = false; |
41 | 58 | } | 58 | } |
42 | 59 | } | 59 | } |
43 | 60 | |||
44 | 61 | void Application::setError(QString error) { | ||
45 | 62 | this->m_error = error; | ||
46 | 63 | if(!this->m_error.isEmpty()) { | ||
47 | 64 | emit this->errorChanged(); | ||
48 | 65 | } | ||
49 | 66 | } | ||
50 | 67 | |||
51 | 68 | } | ||
52 | 60 | 69 | ||
53 | === modified file 'src/application.h' | |||
54 | --- src/application.h 2013-09-13 10:12:01 +0000 | |||
55 | +++ src/application.h 2013-09-26 16:47:31 +0000 | |||
56 | @@ -22,6 +22,8 @@ | |||
57 | 22 | #include <QQuickItem> | 22 | #include <QQuickItem> |
58 | 23 | #include <QString> | 23 | #include <QString> |
59 | 24 | 24 | ||
60 | 25 | namespace ClickPlugin { | ||
61 | 26 | |||
62 | 25 | class Application : public QQuickItem | 27 | class Application : public QQuickItem |
63 | 26 | { | 28 | { |
64 | 27 | Q_OBJECT | 29 | Q_OBJECT |
65 | @@ -36,6 +38,7 @@ | |||
66 | 36 | Q_PROPERTY(bool updateState READ updateState WRITE setUpdateState NOTIFY updatesStateChanged) | 38 | Q_PROPERTY(bool updateState READ updateState WRITE setUpdateState NOTIFY updatesStateChanged) |
67 | 37 | Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY selectedChanged) | 39 | Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY selectedChanged) |
68 | 38 | Q_PROPERTY(QString dbusPath READ dbusPath NOTIFY dbusPathChanged) | 40 | Q_PROPERTY(QString dbusPath READ dbusPath NOTIFY dbusPathChanged) |
69 | 41 | Q_PROPERTY(QString error READ getError NOTIFY errorChanged) | ||
70 | 39 | 42 | ||
71 | 40 | signals: | 43 | signals: |
72 | 41 | void titleChanged(); | 44 | void titleChanged(); |
73 | @@ -46,6 +49,7 @@ | |||
74 | 46 | void updatesStateChanged(); | 49 | void updatesStateChanged(); |
75 | 47 | void selectedChanged(); | 50 | void selectedChanged(); |
76 | 48 | void dbusPathChanged(); | 51 | void dbusPathChanged(); |
77 | 52 | void errorChanged(); | ||
78 | 49 | 53 | ||
79 | 50 | public: | 54 | public: |
80 | 51 | Application(QQuickItem *parent = 0); | 55 | Application(QQuickItem *parent = 0); |
81 | @@ -60,6 +64,7 @@ | |||
82 | 60 | bool updateRequired() { return this->m_update; } | 64 | bool updateRequired() { return this->m_update; } |
83 | 61 | bool updateState() { return this->m_update_state; } | 65 | bool updateState() { return this->m_update_state; } |
84 | 62 | bool selected() { return this->m_selected; } | 66 | bool selected() { return this->m_selected; } |
85 | 67 | QString getError() { return this->m_error; } | ||
86 | 63 | 68 | ||
87 | 64 | void initializeApplication(QString packagename, QString title, QString version); | 69 | void initializeApplication(QString packagename, QString title, QString version); |
88 | 65 | void setRemoteVersion(QString& version); | 70 | void setRemoteVersion(QString& version); |
89 | @@ -68,6 +73,7 @@ | |||
90 | 68 | void setDbusPath(QString dbuspath) { this->m_dbuspath = dbuspath; emit this->dbusPathChanged(); } | 73 | void setDbusPath(QString dbuspath) { this->m_dbuspath = dbuspath; emit this->dbusPathChanged(); } |
91 | 69 | void setBinaryFilesize(int size) { this->m_binary_filesize = size; emit this->binaryFilesizeChanged(); } | 74 | void setBinaryFilesize(int size) { this->m_binary_filesize = size; emit this->binaryFilesizeChanged(); } |
92 | 70 | void setIconUrl(QString icon) { this->m_icon_url = icon; emit this->iconUrlChanged(); } | 75 | void setIconUrl(QString icon) { this->m_icon_url = icon; emit this->iconUrlChanged(); } |
93 | 76 | void setError(QString error); | ||
94 | 71 | 77 | ||
95 | 72 | private: | 78 | private: |
96 | 73 | QString m_packagename; | 79 | QString m_packagename; |
97 | @@ -76,12 +82,15 @@ | |||
98 | 76 | QString m_remote_version; | 82 | QString m_remote_version; |
99 | 77 | QString m_dbuspath; | 83 | QString m_dbuspath; |
100 | 78 | QString m_icon_url; | 84 | QString m_icon_url; |
101 | 85 | QString m_error; | ||
102 | 79 | int m_binary_filesize; | 86 | int m_binary_filesize; |
103 | 80 | bool m_update; | 87 | bool m_update; |
104 | 81 | bool m_update_state; | 88 | bool m_update_state; |
105 | 82 | bool m_selected; | 89 | bool m_selected; |
106 | 83 | }; | 90 | }; |
107 | 84 | 91 | ||
109 | 85 | QML_DECLARE_TYPE(Application) | 92 | } |
110 | 93 | |||
111 | 94 | QML_DECLARE_TYPE(ClickPlugin::Application) | ||
112 | 86 | 95 | ||
113 | 87 | #endif // APPLICATION_H | 96 | #endif // APPLICATION_H |
114 | 88 | 97 | ||
115 | === modified file 'src/clickmanager.cpp' | |||
116 | --- src/clickmanager.cpp 2013-09-23 14:26:39 +0000 | |||
117 | +++ src/clickmanager.cpp 2013-09-26 16:47:31 +0000 | |||
118 | @@ -25,34 +25,54 @@ | |||
119 | 25 | #include <QJsonValue> | 25 | #include <QJsonValue> |
120 | 26 | #include <QDebug> | 26 | #include <QDebug> |
121 | 27 | 27 | ||
122 | 28 | namespace ClickPlugin { | ||
123 | 29 | |||
124 | 28 | ClickManager::ClickManager(QQuickItem *parent): | 30 | ClickManager::ClickManager(QQuickItem *parent): |
125 | 29 | QQuickItem(parent) | 31 | QQuickItem(parent) |
126 | 30 | , m_process(this) | 32 | , m_process(this) |
127 | 31 | { | 33 | { |
130 | 32 | this->m_updatesAvailable = false; | 34 | QObject::connect(&m_service, SIGNAL(credentialsFound(const Token&)), |
131 | 33 | this->connect(&(this->m_process), SIGNAL(finished(int)), | 35 | this, SLOT(handleCredentialsFound(Token))); |
132 | 36 | QObject::connect(&m_service, SIGNAL(credentialsNotFound()), | ||
133 | 37 | this, SLOT(handleCredentialsNotFound())); | ||
134 | 38 | QObject::connect(&(this->m_process), SIGNAL(finished(int)), | ||
135 | 34 | this, SLOT(processOutput())); | 39 | this, SLOT(processOutput())); |
137 | 35 | this->connect(&(this->network), SIGNAL(updatesFound()), | 40 | QObject::connect(&(this->m_network), SIGNAL(updatesFound()), |
138 | 36 | this, SLOT(processUpdates())); | 41 | this, SLOT(processUpdates())); |
140 | 37 | this->connect(&(this->network), SIGNAL(updatesNotFound()), | 42 | QObject::connect(&(this->m_network), SIGNAL(updatesNotFound()), |
141 | 38 | this, SIGNAL(updatesNotFound())); | 43 | this, SIGNAL(updatesNotFound())); |
143 | 39 | this->connect(&(this->network), SIGNAL(downloadUrlFound(QString,QString)), | 44 | QObject::connect(&(this->m_network), SIGNAL(downloadUrlFound(QString,QString)), |
144 | 40 | this, SLOT(downloadUrlObtained(QString,QString))); | 45 | this, SLOT(downloadUrlObtained(QString,QString))); |
146 | 41 | this->connect(&(this->downloader), SIGNAL(downloadCreated(QString,QString)), | 46 | QObject::connect(&(this->downloader), SIGNAL(downloadCreated(QString,QString)), |
147 | 42 | this, SLOT(downloadCreated(QString,QString))); | 47 | this, SLOT(downloadCreated(QString,QString))); |
148 | 48 | QObject::connect(&(this->downloader), SIGNAL(downloadNotCreated(QString,QString)), | ||
149 | 49 | this, SLOT(downloadNotCreated(QString,QString))); | ||
150 | 43 | } | 50 | } |
151 | 44 | 51 | ||
152 | 45 | ClickManager::~ClickManager() | 52 | ClickManager::~ClickManager() |
153 | 46 | { | 53 | { |
154 | 47 | } | 54 | } |
155 | 48 | 55 | ||
157 | 49 | void ClickManager::checkUpdates() | 56 | void ClickManager::handleCredentialsFound(Token token) |
158 | 50 | { | 57 | { |
159 | 58 | qDebug() << "Credentials found."; | ||
160 | 59 | this->m_token = token; | ||
161 | 51 | QStringList args("list"); | 60 | QStringList args("list"); |
162 | 52 | args << "--manifest"; | 61 | args << "--manifest"; |
163 | 53 | this->m_process.start("click", args); | 62 | this->m_process.start("click", args); |
164 | 54 | } | 63 | } |
165 | 55 | 64 | ||
166 | 65 | void ClickManager::handleCredentialsNotFound() | ||
167 | 66 | { | ||
168 | 67 | qDebug() << "No credentials were found."; | ||
169 | 68 | emit this->credentialsNotFound(); | ||
170 | 69 | } | ||
171 | 70 | |||
172 | 71 | void ClickManager::checkUpdates() | ||
173 | 72 | { | ||
174 | 73 | this->m_service.getCredentials(); | ||
175 | 74 | } | ||
176 | 75 | |||
177 | 56 | void ClickManager::processOutput() | 76 | void ClickManager::processOutput() |
178 | 57 | { | 77 | { |
179 | 58 | QString output(this->m_process.readAllStandardOutput()); | 78 | QString output(this->m_process.readAllStandardOutput()); |
180 | @@ -72,7 +92,7 @@ | |||
181 | 72 | this->m_apps[app->getPackageName()] = app; | 92 | this->m_apps[app->getPackageName()] = app; |
182 | 73 | } | 93 | } |
183 | 74 | 94 | ||
185 | 75 | this->network.checkForNewVersions(this->m_apps); | 95 | this->m_network.checkForNewVersions(this->m_apps); |
186 | 76 | } | 96 | } |
187 | 77 | 97 | ||
188 | 78 | void ClickManager::processUpdates() | 98 | void ClickManager::processUpdates() |
189 | @@ -90,13 +110,20 @@ | |||
190 | 90 | void ClickManager::startDownload(QString packagename) | 110 | void ClickManager::startDownload(QString packagename) |
191 | 91 | { | 111 | { |
192 | 92 | qDebug() << "Download Package:" << packagename; | 112 | qDebug() << "Download Package:" << packagename; |
194 | 93 | this->network.getResourceUrl(packagename); | 113 | this->m_network.getResourceUrl(packagename); |
195 | 94 | } | 114 | } |
196 | 95 | 115 | ||
197 | 96 | void ClickManager::downloadUrlObtained(QString packagename, QString url) | 116 | void ClickManager::downloadUrlObtained(QString packagename, QString url) |
198 | 97 | { | 117 | { |
201 | 98 | this->downloader.startDownload(packagename, url.append("?noauth=1")); | 118 | if(this->m_token.isValid()) { |
202 | 99 | qDebug() << "Download Url:" << url; | 119 | QString authHeader = this->m_token.signUrl(url, QStringLiteral("GET")); |
203 | 120 | qDebug() << "Download Url:" << url; | ||
204 | 121 | this->m_apps[packagename]->setError(""); | ||
205 | 122 | this->downloader.startDownload(packagename, url, authHeader); | ||
206 | 123 | } else { | ||
207 | 124 | Application* app = this->m_apps[packagename]; | ||
208 | 125 | app->setError("Invalid User Token"); | ||
209 | 126 | } | ||
210 | 100 | } | 127 | } |
211 | 101 | 128 | ||
212 | 102 | void ClickManager::downloadCreated(QString packagename, QString dbuspath) | 129 | void ClickManager::downloadCreated(QString packagename, QString dbuspath) |
213 | @@ -105,3 +132,11 @@ | |||
214 | 105 | this->m_apps[packagename]->setDbusPath(dbuspath); | 132 | this->m_apps[packagename]->setDbusPath(dbuspath); |
215 | 106 | this->m_apps[packagename]->setUpdateState(true); | 133 | this->m_apps[packagename]->setUpdateState(true); |
216 | 107 | } | 134 | } |
217 | 135 | |||
218 | 136 | void ClickManager::downloadNotCreated(QString packagename, QString error) | ||
219 | 137 | { | ||
220 | 138 | Application* app = this->m_apps[packagename]; | ||
221 | 139 | app->setError(error); | ||
222 | 140 | } | ||
223 | 141 | |||
224 | 142 | } | ||
225 | 108 | 143 | ||
226 | === modified file 'src/clickmanager.h' | |||
227 | --- src/clickmanager.h 2013-09-23 14:20:48 +0000 | |||
228 | +++ src/clickmanager.h 2013-09-26 16:47:31 +0000 | |||
229 | @@ -25,23 +25,29 @@ | |||
230 | 25 | #include <QVariant> | 25 | #include <QVariant> |
231 | 26 | #include <QVariantList> | 26 | #include <QVariantList> |
232 | 27 | #include "application.h" | 27 | #include "application.h" |
233 | 28 | #include <token.h> | ||
234 | 28 | 29 | ||
235 | 29 | #ifdef TESTS | 30 | #ifdef TESTS |
236 | 30 | #include "fakeprocess.h" | 31 | #include "fakeprocess.h" |
237 | 31 | #include "fakenetwork.h" | 32 | #include "fakenetwork.h" |
238 | 32 | #include "fakedownloader.h" | 33 | #include "fakedownloader.h" |
239 | 33 | #include "testclickmanager.h" | 34 | #include "testclickmanager.h" |
240 | 35 | #include "fakessoservice.h" | ||
241 | 34 | #else | 36 | #else |
242 | 37 | #include <ssoservice.h> | ||
243 | 35 | #include <QProcess> | 38 | #include <QProcess> |
244 | 36 | #include "network/network.h" | 39 | #include "network/network.h" |
245 | 37 | #include "download/downloader.h" | 40 | #include "download/downloader.h" |
246 | 38 | #endif | 41 | #endif |
247 | 39 | 42 | ||
248 | 43 | using namespace UbuntuOne; | ||
249 | 44 | |||
250 | 45 | namespace ClickPlugin { | ||
251 | 46 | |||
252 | 40 | class ClickManager : public QQuickItem | 47 | class ClickManager : public QQuickItem |
253 | 41 | { | 48 | { |
254 | 42 | Q_OBJECT | 49 | Q_OBJECT |
255 | 43 | Q_DISABLE_COPY(ClickManager) | 50 | Q_DISABLE_COPY(ClickManager) |
256 | 44 | Q_PROPERTY(bool updatesAvailable READ updatesAvailable NOTIFY updatesAvailableChanged) | ||
257 | 45 | Q_PROPERTY(QVariantList model READ model NOTIFY modelChanged) | 51 | Q_PROPERTY(QVariantList model READ model NOTIFY modelChanged) |
258 | 46 | 52 | ||
259 | 47 | #ifdef TESTS | 53 | #ifdef TESTS |
260 | @@ -49,9 +55,9 @@ | |||
261 | 49 | #endif | 55 | #endif |
262 | 50 | 56 | ||
263 | 51 | signals: | 57 | signals: |
264 | 52 | void updatesAvailableChanged(); | ||
265 | 53 | void modelChanged(); | 58 | void modelChanged(); |
266 | 54 | void updatesNotFound(); | 59 | void updatesNotFound(); |
267 | 60 | void credentialsNotFound(); | ||
268 | 55 | 61 | ||
269 | 56 | public: | 62 | public: |
270 | 57 | ClickManager(QQuickItem *parent = 0); | 63 | ClickManager(QQuickItem *parent = 0); |
271 | @@ -60,7 +66,6 @@ | |||
272 | 60 | Q_INVOKABLE void checkUpdates(); | 66 | Q_INVOKABLE void checkUpdates(); |
273 | 61 | Q_INVOKABLE void startDownload(QString packagename); | 67 | Q_INVOKABLE void startDownload(QString packagename); |
274 | 62 | 68 | ||
275 | 63 | bool updatesAvailable() { return this->m_updatesAvailable; } | ||
276 | 64 | QVariantList model() const { return this->m_model; } | 69 | QVariantList model() const { return this->m_model; } |
277 | 65 | 70 | ||
278 | 66 | private slots: | 71 | private slots: |
279 | @@ -68,25 +73,32 @@ | |||
280 | 68 | void processUpdates(); | 73 | void processUpdates(); |
281 | 69 | void downloadUrlObtained(QString packagename, QString url); | 74 | void downloadUrlObtained(QString packagename, QString url); |
282 | 70 | void downloadCreated(QString packagename, QString dbuspath); | 75 | void downloadCreated(QString packagename, QString dbuspath); |
283 | 76 | void downloadNotCreated(QString packagename, QString error); | ||
284 | 77 | void handleCredentialsFound(Token token); | ||
285 | 78 | void handleCredentialsNotFound(); | ||
286 | 71 | 79 | ||
287 | 72 | private: | 80 | private: |
288 | 73 | bool m_updatesAvailable; | ||
289 | 74 | QHash<QString, Application*> m_apps; | 81 | QHash<QString, Application*> m_apps; |
290 | 75 | QVariantList m_model; | 82 | QVariantList m_model; |
291 | 83 | Token m_token; | ||
292 | 76 | #ifdef TESTS | 84 | #ifdef TESTS |
294 | 77 | FakeNetwork network; | 85 | FakeSsoService m_service; |
295 | 86 | FakeNetwork m_network; | ||
296 | 78 | FakeDownloader downloader; | 87 | FakeDownloader downloader; |
297 | 79 | FakeProcess m_process; | 88 | FakeProcess m_process; |
298 | 80 | #else | 89 | #else |
299 | 90 | SSOService m_service; | ||
300 | 81 | QProcess m_process; | 91 | QProcess m_process; |
302 | 82 | Network network; | 92 | Network m_network; |
303 | 83 | Downloader downloader; | 93 | Downloader downloader; |
304 | 84 | #endif | 94 | #endif |
305 | 85 | 95 | ||
306 | 86 | void checkForUpdates(); | 96 | void checkForUpdates(); |
307 | 87 | }; | 97 | }; |
308 | 88 | 98 | ||
310 | 89 | QML_DECLARE_TYPE(ClickManager) | 99 | } |
311 | 100 | |||
312 | 101 | QML_DECLARE_TYPE(ClickPlugin::ClickManager) | ||
313 | 90 | 102 | ||
314 | 91 | #endif // CLICKMANAGER_H | 103 | #endif // CLICKMANAGER_H |
315 | 92 | 104 | ||
316 | 93 | 105 | ||
317 | === modified file 'src/clickmanager_plugin.cpp' | |||
318 | --- src/clickmanager_plugin.cpp 2013-09-13 10:12:01 +0000 | |||
319 | +++ src/clickmanager_plugin.cpp 2013-09-26 16:47:31 +0000 | |||
320 | @@ -23,6 +23,8 @@ | |||
321 | 23 | 23 | ||
322 | 24 | #include <qqml.h> | 24 | #include <qqml.h> |
323 | 25 | 25 | ||
324 | 26 | using namespace ClickPlugin; | ||
325 | 27 | |||
326 | 26 | void ClickManagerPlugin::registerTypes(const char *uri) | 28 | void ClickManagerPlugin::registerTypes(const char *uri) |
327 | 27 | { | 29 | { |
328 | 28 | // @uri com.ubuntu.click | 30 | // @uri com.ubuntu.click |
329 | 29 | 31 | ||
330 | === modified file 'src/download/downloader.cpp' | |||
331 | --- src/download/downloader.cpp 2013-09-23 14:50:58 +0000 | |||
332 | +++ src/download/downloader.cpp 2013-09-26 16:47:31 +0000 | |||
333 | @@ -23,6 +23,8 @@ | |||
334 | 23 | #define DOWNLOAD_COMMAND "post-download-command" | 23 | #define DOWNLOAD_COMMAND "post-download-command" |
335 | 24 | #define APP_ID "app_id" | 24 | #define APP_ID "app_id" |
336 | 25 | 25 | ||
337 | 26 | namespace ClickPlugin { | ||
338 | 27 | |||
339 | 26 | Downloader::Downloader(QObject *parent) : | 28 | Downloader::Downloader(QObject *parent) : |
340 | 27 | QObject(parent) | 29 | QObject(parent) |
341 | 28 | { | 30 | { |
342 | @@ -33,7 +35,7 @@ | |||
343 | 33 | this->manager = new DownloadManager("com.canonical.applications.Downloader", "/", QDBusConnection::sessionBus(), 0); | 35 | this->manager = new DownloadManager("com.canonical.applications.Downloader", "/", QDBusConnection::sessionBus(), 0); |
344 | 34 | } | 36 | } |
345 | 35 | 37 | ||
347 | 36 | void Downloader::startDownload(QString& packagename, QString& url) | 38 | void Downloader::startDownload(QString& packagename, QString& url, QString& authHeader) |
348 | 37 | { | 39 | { |
349 | 38 | QVariantMap vmap; | 40 | QVariantMap vmap; |
350 | 39 | QStringList args; | 41 | QStringList args; |
351 | @@ -41,14 +43,16 @@ | |||
352 | 41 | vmap[DOWNLOAD_COMMAND] = args; | 43 | vmap[DOWNLOAD_COMMAND] = args; |
353 | 42 | vmap[APP_ID] = packagename; | 44 | vmap[APP_ID] = packagename; |
354 | 43 | StringMap map; | 45 | StringMap map; |
355 | 46 | map["Authorization"] = authHeader; | ||
356 | 44 | DownloadStruct down = DownloadStruct(url, vmap, map); | 47 | DownloadStruct down = DownloadStruct(url, vmap, map); |
357 | 45 | QDBusPendingReply<QDBusObjectPath> reply = this->manager->createDownload(down); | 48 | QDBusPendingReply<QDBusObjectPath> reply = this->manager->createDownload(down); |
358 | 46 | reply.waitForFinished(); | 49 | reply.waitForFinished(); |
359 | 47 | if (reply.isError()) { | 50 | if (reply.isError()) { |
361 | 48 | emit this->downloadNotCreated(packagename); | 51 | emit this->downloadNotCreated(packagename, reply.error().message()); |
362 | 49 | }else{ | 52 | }else{ |
363 | 50 | QDBusObjectPath path = reply.value(); | 53 | QDBusObjectPath path = reply.value(); |
364 | 51 | emit this->downloadCreated(packagename, path.path()); | 54 | emit this->downloadCreated(packagename, path.path()); |
365 | 52 | } | 55 | } |
366 | 53 | } | 56 | } |
367 | 54 | 57 | ||
368 | 58 | } | ||
369 | 55 | 59 | ||
370 | === modified file 'src/download/downloader.h' | |||
371 | --- src/download/downloader.h 2013-09-10 19:01:19 +0000 | |||
372 | +++ src/download/downloader.h 2013-09-26 16:47:31 +0000 | |||
373 | @@ -24,21 +24,25 @@ | |||
374 | 24 | #include <QDBusObjectPath> | 24 | #include <QDBusObjectPath> |
375 | 25 | #include "downloadmanager.h" | 25 | #include "downloadmanager.h" |
376 | 26 | 26 | ||
377 | 27 | namespace ClickPlugin { | ||
378 | 28 | |||
379 | 27 | class Downloader : public QObject | 29 | class Downloader : public QObject |
380 | 28 | { | 30 | { |
381 | 29 | Q_OBJECT | 31 | Q_OBJECT |
382 | 30 | public: | 32 | public: |
383 | 31 | explicit Downloader(QObject *parent = 0); | 33 | explicit Downloader(QObject *parent = 0); |
384 | 32 | 34 | ||
386 | 33 | void startDownload(QString& packagename, QString& url); | 35 | void startDownload(QString& packagename, QString& url, QString& authHeader); |
387 | 34 | 36 | ||
388 | 35 | signals: | 37 | signals: |
389 | 36 | void downloadCreated(QString packagename, QString dbuspath); | 38 | void downloadCreated(QString packagename, QString dbuspath); |
391 | 37 | void downloadNotCreated(QString packagename); | 39 | void downloadNotCreated(QString packagename, QString error); |
392 | 38 | 40 | ||
393 | 39 | private: | 41 | private: |
394 | 40 | DownloadManager* manager; | 42 | DownloadManager* manager; |
395 | 41 | 43 | ||
396 | 42 | }; | 44 | }; |
397 | 43 | 45 | ||
398 | 46 | } | ||
399 | 47 | |||
400 | 44 | #endif // DOWNLOADER_H | 48 | #endif // DOWNLOADER_H |
401 | 45 | 49 | ||
402 | === modified file 'src/download_tracker.cpp' | |||
403 | --- src/download_tracker.cpp 2013-09-13 10:12:01 +0000 | |||
404 | +++ src/download_tracker.cpp 2013-09-26 16:47:31 +0000 | |||
405 | @@ -22,6 +22,8 @@ | |||
406 | 22 | #include "download_tracker.h" | 22 | #include "download_tracker.h" |
407 | 23 | #include <QDebug> | 23 | #include <QDebug> |
408 | 24 | 24 | ||
409 | 25 | namespace ClickPlugin { | ||
410 | 26 | |||
411 | 25 | DownloadTracker::DownloadTracker(QQuickItem *parent) : | 27 | DownloadTracker::DownloadTracker(QQuickItem *parent) : |
412 | 26 | QQuickItem(parent) | 28 | QQuickItem(parent) |
413 | 27 | { | 29 | { |
414 | @@ -70,3 +72,5 @@ | |||
415 | 70 | this->adaptor->start(); | 72 | this->adaptor->start(); |
416 | 71 | } | 73 | } |
417 | 72 | } | 74 | } |
418 | 75 | |||
419 | 76 | } | ||
420 | 73 | 77 | ||
421 | === modified file 'src/download_tracker.h' | |||
422 | --- src/download_tracker.h 2013-09-13 10:12:01 +0000 | |||
423 | +++ src/download_tracker.h 2013-09-26 16:47:31 +0000 | |||
424 | @@ -27,6 +27,8 @@ | |||
425 | 27 | #include <QDBusObjectPath> | 27 | #include <QDBusObjectPath> |
426 | 28 | #include <download/downloadtrackeradaptor.h> | 28 | #include <download/downloadtrackeradaptor.h> |
427 | 29 | 29 | ||
428 | 30 | namespace ClickPlugin { | ||
429 | 31 | |||
430 | 30 | class DownloadTracker : public QQuickItem | 32 | class DownloadTracker : public QQuickItem |
431 | 31 | { | 33 | { |
432 | 32 | Q_OBJECT | 34 | Q_OBJECT |
433 | @@ -61,6 +63,8 @@ | |||
434 | 61 | void startService(); | 63 | void startService(); |
435 | 62 | }; | 64 | }; |
436 | 63 | 65 | ||
438 | 64 | QML_DECLARE_TYPE(DownloadTracker) | 66 | } |
439 | 67 | |||
440 | 68 | QML_DECLARE_TYPE(ClickPlugin::DownloadTracker) | ||
441 | 65 | 69 | ||
442 | 66 | #endif // MYTYPE_H | 70 | #endif // MYTYPE_H |
443 | 67 | 71 | ||
444 | === modified file 'src/network/network.cpp' | |||
445 | --- src/network/network.cpp 2013-09-23 14:20:48 +0000 | |||
446 | +++ src/network/network.cpp 2013-09-26 16:47:31 +0000 | |||
447 | @@ -27,6 +27,7 @@ | |||
448 | 27 | #define URL_APPS "https://myapps.developer.ubuntu.com/dev/api/click-metadata/" | 27 | #define URL_APPS "https://myapps.developer.ubuntu.com/dev/api/click-metadata/" |
449 | 28 | #define URL_PACKAGE "https://search.apps.ubuntu.com/api/v1/package/" | 28 | #define URL_PACKAGE "https://search.apps.ubuntu.com/api/v1/package/" |
450 | 29 | 29 | ||
451 | 30 | namespace ClickPlugin { | ||
452 | 30 | 31 | ||
453 | 31 | Network::Network(QObject *parent) : | 32 | Network::Network(QObject *parent) : |
454 | 32 | QObject(parent) | 33 | QObject(parent) |
455 | @@ -127,3 +128,5 @@ | |||
456 | 127 | this->_request->setUrl(QUrl(URL_PACKAGE + packagename)); | 128 | this->_request->setUrl(QUrl(URL_PACKAGE + packagename)); |
457 | 128 | this->_nam->get(*this->_request); | 129 | this->_nam->get(*this->_request); |
458 | 129 | } | 130 | } |
459 | 131 | |||
460 | 132 | } | ||
461 | 130 | 133 | ||
462 | === modified file 'src/network/network.h' | |||
463 | --- src/network/network.h 2013-09-10 19:01:19 +0000 | |||
464 | +++ src/network/network.h 2013-09-26 16:47:31 +0000 | |||
465 | @@ -25,6 +25,8 @@ | |||
466 | 25 | #include <QHash> | 25 | #include <QHash> |
467 | 26 | #include "application.h" | 26 | #include "application.h" |
468 | 27 | 27 | ||
469 | 28 | namespace ClickPlugin { | ||
470 | 29 | |||
471 | 28 | class Network : public QObject | 30 | class Network : public QObject |
472 | 29 | { | 31 | { |
473 | 30 | Q_OBJECT | 32 | Q_OBJECT |
474 | @@ -49,4 +51,6 @@ | |||
475 | 49 | QHash<QString, Application*> _apps; | 51 | QHash<QString, Application*> _apps; |
476 | 50 | }; | 52 | }; |
477 | 51 | 53 | ||
478 | 54 | } | ||
479 | 55 | |||
480 | 52 | #endif // NETWORK_H | 56 | #endif // NETWORK_H |
481 | 53 | 57 | ||
482 | === modified file 'src/src.pro' | |||
483 | --- src/src.pro 2013-09-13 15:34:29 +0000 | |||
484 | +++ src/src.pro 2013-09-26 16:47:31 +0000 | |||
485 | @@ -1,6 +1,6 @@ | |||
486 | 1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
487 | 2 | TARGET = ClickManager | 2 | TARGET = ClickManager |
489 | 3 | QT += qml quick core dbus | 3 | QT += qml quick core dbus xml network |
490 | 4 | CONFIG += qt plugin | 4 | CONFIG += qt plugin |
491 | 5 | 5 | ||
492 | 6 | TARGET = $$qtLibraryTarget($$TARGET) | 6 | TARGET = $$qtLibraryTarget($$TARGET) |
493 | @@ -52,4 +52,5 @@ | |||
494 | 52 | INSTALLS += target qmldir | 52 | INSTALLS += target qmldir |
495 | 53 | } | 53 | } |
496 | 54 | 54 | ||
498 | 55 | LIBS += -lapt-pkg | 55 | QMAKE_CXXFLAGS += -I /usr/include/ubuntuoneauth-2.0 -I /usr/include/signon-qt5 -I /usr/include/accounts-qt5 |
499 | 56 | LIBS += -lapt-pkg -lubuntuoneauth-2.0 -lsignon-qt5 -laccounts-qt5 | ||
500 | 56 | 57 | ||
501 | === modified file 'tests/fakedownloader.cpp' | |||
502 | --- tests/fakedownloader.cpp 2013-09-13 11:00:52 +0000 | |||
503 | +++ tests/fakedownloader.cpp 2013-09-26 16:47:31 +0000 | |||
504 | @@ -17,13 +17,22 @@ | |||
505 | 17 | */ | 17 | */ |
506 | 18 | 18 | ||
507 | 19 | #include "fakedownloader.h" | 19 | #include "fakedownloader.h" |
508 | 20 | #include <QDebug> | ||
509 | 21 | |||
510 | 22 | namespace ClickPlugin { | ||
511 | 20 | 23 | ||
512 | 21 | FakeDownloader::FakeDownloader(QObject *parent) : | 24 | FakeDownloader::FakeDownloader(QObject *parent) : |
513 | 22 | QObject(parent) | 25 | QObject(parent) |
514 | 23 | { | 26 | { |
515 | 24 | } | 27 | } |
516 | 25 | 28 | ||
518 | 26 | void FakeDownloader::startDownload(QString& packagename, QString& url) | 29 | void FakeDownloader::startDownload(QString& packagename, QString& url, QString authHeader) |
519 | 27 | { | 30 | { |
521 | 28 | emit this->downloadCreated(packagename, "/com/canonical/download/path"); | 31 | if(authHeader.isEmpty()) { |
522 | 32 | emit this->downloadNotCreated(packagename, QString("DOWNLOAD ERROR")); | ||
523 | 33 | } else { | ||
524 | 34 | emit this->downloadCreated(packagename, "/com/canonical/download/path"); | ||
525 | 35 | } | ||
526 | 36 | } | ||
527 | 37 | |||
528 | 29 | } | 38 | } |
529 | 30 | 39 | ||
530 | === modified file 'tests/fakedownloader.h' | |||
531 | --- tests/fakedownloader.h 2013-09-13 11:00:52 +0000 | |||
532 | +++ tests/fakedownloader.h 2013-09-26 16:47:31 +0000 | |||
533 | @@ -21,18 +21,22 @@ | |||
534 | 21 | 21 | ||
535 | 22 | #include <QObject> | 22 | #include <QObject> |
536 | 23 | 23 | ||
537 | 24 | namespace ClickPlugin { | ||
538 | 25 | |||
539 | 24 | class FakeDownloader : public QObject | 26 | class FakeDownloader : public QObject |
540 | 25 | { | 27 | { |
541 | 26 | Q_OBJECT | 28 | Q_OBJECT |
542 | 27 | public: | 29 | public: |
543 | 28 | explicit FakeDownloader(QObject *parent = 0); | 30 | explicit FakeDownloader(QObject *parent = 0); |
544 | 29 | 31 | ||
546 | 30 | void startDownload(QString& packagename, QString& url); | 32 | void startDownload(QString& packagename, QString& url, QString authHeader); |
547 | 31 | 33 | ||
548 | 32 | signals: | 34 | signals: |
549 | 33 | void downloadCreated(QString packagename, QString dbuspath); | 35 | void downloadCreated(QString packagename, QString dbuspath); |
551 | 34 | void downloadNotCreated(QString packagename); | 36 | void downloadNotCreated(QString packagename, QString error); |
552 | 35 | 37 | ||
553 | 36 | }; | 38 | }; |
554 | 37 | 39 | ||
555 | 40 | } | ||
556 | 41 | |||
557 | 38 | #endif // FAKEDOWNLOADER_H | 42 | #endif // FAKEDOWNLOADER_H |
558 | 39 | 43 | ||
559 | === modified file 'tests/fakenetwork.cpp' | |||
560 | --- tests/fakenetwork.cpp 2013-09-13 11:00:52 +0000 | |||
561 | +++ tests/fakenetwork.cpp 2013-09-26 16:47:31 +0000 | |||
562 | @@ -18,6 +18,8 @@ | |||
563 | 18 | 18 | ||
564 | 19 | #include "fakenetwork.h" | 19 | #include "fakenetwork.h" |
565 | 20 | 20 | ||
566 | 21 | namespace ClickPlugin { | ||
567 | 22 | |||
568 | 21 | FakeNetwork::FakeNetwork(QObject *parent) : | 23 | FakeNetwork::FakeNetwork(QObject *parent) : |
569 | 22 | QObject(parent) | 24 | QObject(parent) |
570 | 23 | { | 25 | { |
571 | @@ -37,3 +39,5 @@ | |||
572 | 37 | { | 39 | { |
573 | 38 | emit this->downloadUrlFound(packagename, "http://canonical.com"); | 40 | emit this->downloadUrlFound(packagename, "http://canonical.com"); |
574 | 39 | } | 41 | } |
575 | 42 | |||
576 | 43 | } | ||
577 | 40 | 44 | ||
578 | === modified file 'tests/fakenetwork.h' | |||
579 | --- tests/fakenetwork.h 2013-09-13 11:00:52 +0000 | |||
580 | +++ tests/fakenetwork.h 2013-09-26 16:47:31 +0000 | |||
581 | @@ -24,6 +24,8 @@ | |||
582 | 24 | #include <QString> | 24 | #include <QString> |
583 | 25 | #include "application.h" | 25 | #include "application.h" |
584 | 26 | 26 | ||
585 | 27 | namespace ClickPlugin { | ||
586 | 28 | |||
587 | 27 | class FakeNetwork : public QObject | 29 | class FakeNetwork : public QObject |
588 | 28 | { | 30 | { |
589 | 29 | Q_OBJECT | 31 | Q_OBJECT |
590 | @@ -41,4 +43,6 @@ | |||
591 | 41 | 43 | ||
592 | 42 | }; | 44 | }; |
593 | 43 | 45 | ||
594 | 46 | } | ||
595 | 47 | |||
596 | 44 | #endif // FAKENETWORK_H | 48 | #endif // FAKENETWORK_H |
597 | 45 | 49 | ||
598 | === modified file 'tests/fakeprocess.cpp' | |||
599 | --- tests/fakeprocess.cpp 2013-09-23 15:32:01 +0000 | |||
600 | +++ tests/fakeprocess.cpp 2013-09-26 16:47:31 +0000 | |||
601 | @@ -21,6 +21,8 @@ | |||
602 | 21 | #include <QTextStream> | 21 | #include <QTextStream> |
603 | 22 | #include <QDir> | 22 | #include <QDir> |
604 | 23 | 23 | ||
605 | 24 | namespace ClickPlugin { | ||
606 | 25 | |||
607 | 24 | FakeProcess::FakeProcess(QObject *parent) : | 26 | FakeProcess::FakeProcess(QObject *parent) : |
608 | 25 | QObject(parent) | 27 | QObject(parent) |
609 | 26 | { | 28 | { |
610 | @@ -55,3 +57,5 @@ | |||
611 | 55 | { | 57 | { |
612 | 56 | 58 | ||
613 | 57 | } | 59 | } |
614 | 60 | |||
615 | 61 | } | ||
616 | 58 | 62 | ||
617 | === modified file 'tests/fakeprocess.h' | |||
618 | --- tests/fakeprocess.h 2013-09-23 15:32:01 +0000 | |||
619 | +++ tests/fakeprocess.h 2013-09-26 16:47:31 +0000 | |||
620 | @@ -23,6 +23,8 @@ | |||
621 | 23 | #include <QString> | 23 | #include <QString> |
622 | 24 | #include <QStringList> | 24 | #include <QStringList> |
623 | 25 | 25 | ||
624 | 26 | namespace ClickPlugin { | ||
625 | 27 | |||
626 | 26 | class FakeProcess : public QObject | 28 | class FakeProcess : public QObject |
627 | 27 | { | 29 | { |
628 | 28 | Q_OBJECT | 30 | Q_OBJECT |
629 | @@ -41,4 +43,6 @@ | |||
630 | 41 | 43 | ||
631 | 42 | }; | 44 | }; |
632 | 43 | 45 | ||
633 | 46 | } | ||
634 | 47 | |||
635 | 44 | #endif // FAKEPROCESS_H | 48 | #endif // FAKEPROCESS_H |
636 | 45 | 49 | ||
637 | === added file 'tests/fakessoservice.cpp' | |||
638 | --- tests/fakessoservice.cpp 1970-01-01 00:00:00 +0000 | |||
639 | +++ tests/fakessoservice.cpp 2013-09-26 16:47:31 +0000 | |||
640 | @@ -0,0 +1,16 @@ | |||
641 | 1 | #include "fakessoservice.h" | ||
642 | 2 | |||
643 | 3 | namespace ClickPlugin { | ||
644 | 4 | |||
645 | 5 | FakeSsoService::FakeSsoService(QObject *parent) : | ||
646 | 6 | QObject(parent) | ||
647 | 7 | { | ||
648 | 8 | } | ||
649 | 9 | |||
650 | 10 | void FakeSsoService::getCredentials() | ||
651 | 11 | { | ||
652 | 12 | Token token("token_key", "token_secret", "consumer_key", "consumer_secret"); | ||
653 | 13 | emit this->credentialsFound(token); | ||
654 | 14 | } | ||
655 | 15 | |||
656 | 16 | } | ||
657 | 0 | 17 | ||
658 | === added file 'tests/fakessoservice.h' | |||
659 | --- tests/fakessoservice.h 1970-01-01 00:00:00 +0000 | |||
660 | +++ tests/fakessoservice.h 2013-09-26 16:47:31 +0000 | |||
661 | @@ -0,0 +1,27 @@ | |||
662 | 1 | #ifndef FAKESSOSERVICE_H | ||
663 | 2 | #define FAKESSOSERVICE_H | ||
664 | 3 | |||
665 | 4 | #include <QObject> | ||
666 | 5 | #include <token.h> | ||
667 | 6 | |||
668 | 7 | using namespace UbuntuOne; | ||
669 | 8 | |||
670 | 9 | namespace ClickPlugin { | ||
671 | 10 | |||
672 | 11 | class FakeSsoService : public QObject | ||
673 | 12 | { | ||
674 | 13 | Q_OBJECT | ||
675 | 14 | public: | ||
676 | 15 | explicit FakeSsoService(QObject *parent = 0); | ||
677 | 16 | |||
678 | 17 | void getCredentials(); | ||
679 | 18 | |||
680 | 19 | signals: | ||
681 | 20 | void credentialsFound(const Token&); | ||
682 | 21 | void credentialsNotFound(); | ||
683 | 22 | |||
684 | 23 | }; | ||
685 | 24 | |||
686 | 25 | } | ||
687 | 26 | |||
688 | 27 | #endif // FAKESSOSERVICE_H | ||
689 | 0 | 28 | ||
690 | === modified file 'tests/test_main.cpp' | |||
691 | --- tests/test_main.cpp 2013-09-13 10:12:01 +0000 | |||
692 | +++ tests/test_main.cpp 2013-09-26 16:47:31 +0000 | |||
693 | @@ -21,6 +21,8 @@ | |||
694 | 21 | #include "testapplication.h" | 21 | #include "testapplication.h" |
695 | 22 | #include "testclickmanager.h" | 22 | #include "testclickmanager.h" |
696 | 23 | 23 | ||
697 | 24 | using namespace ClickPlugin; | ||
698 | 25 | |||
699 | 24 | int main() | 26 | int main() |
700 | 25 | { | 27 | { |
701 | 26 | 28 | ||
702 | 27 | 29 | ||
703 | === modified file 'tests/testapplication.cpp' | |||
704 | --- tests/testapplication.cpp 2013-09-13 11:00:52 +0000 | |||
705 | +++ tests/testapplication.cpp 2013-09-26 16:47:31 +0000 | |||
706 | @@ -21,6 +21,8 @@ | |||
707 | 21 | 21 | ||
708 | 22 | #include "application.h" | 22 | #include "application.h" |
709 | 23 | 23 | ||
710 | 24 | namespace ClickPlugin { | ||
711 | 25 | |||
712 | 24 | void TestApplication::testCompareVersion() | 26 | void TestApplication::testCompareVersion() |
713 | 25 | { | 27 | { |
714 | 26 | Application app; | 28 | Application app; |
715 | @@ -30,3 +32,5 @@ | |||
716 | 30 | app.setRemoteVersion(version); | 32 | app.setRemoteVersion(version); |
717 | 31 | QCOMPARE(app.updateRequired(), true); | 33 | QCOMPARE(app.updateRequired(), true); |
718 | 32 | } | 34 | } |
719 | 35 | |||
720 | 36 | } | ||
721 | 33 | 37 | ||
722 | === modified file 'tests/testapplication.h' | |||
723 | --- tests/testapplication.h 2013-09-13 11:00:52 +0000 | |||
724 | +++ tests/testapplication.h 2013-09-26 16:47:31 +0000 | |||
725 | @@ -23,6 +23,8 @@ | |||
726 | 23 | 23 | ||
727 | 24 | #include <QtTest/QtTest> | 24 | #include <QtTest/QtTest> |
728 | 25 | 25 | ||
729 | 26 | namespace ClickPlugin { | ||
730 | 27 | |||
731 | 26 | class TestApplication : public QObject | 28 | class TestApplication : public QObject |
732 | 27 | { | 29 | { |
733 | 28 | Q_OBJECT | 30 | Q_OBJECT |
734 | @@ -32,4 +34,6 @@ | |||
735 | 32 | 34 | ||
736 | 33 | }; | 35 | }; |
737 | 34 | 36 | ||
738 | 37 | } | ||
739 | 38 | |||
740 | 35 | #endif // TESTAPPLICATION_H | 39 | #endif // TESTAPPLICATION_H |
741 | 36 | 40 | ||
742 | === modified file 'tests/testclickmanager.cpp' | |||
743 | --- tests/testclickmanager.cpp 2013-09-13 11:00:52 +0000 | |||
744 | +++ tests/testclickmanager.cpp 2013-09-26 16:47:31 +0000 | |||
745 | @@ -21,6 +21,8 @@ | |||
746 | 21 | #include "clickmanager.h" | 21 | #include "clickmanager.h" |
747 | 22 | #include "application.h" | 22 | #include "application.h" |
748 | 23 | 23 | ||
749 | 24 | namespace ClickPlugin { | ||
750 | 25 | |||
751 | 24 | void TestClickManager::cleanup() | 26 | void TestClickManager::cleanup() |
752 | 25 | { | 27 | { |
753 | 26 | this->m_signal_counter = 0; | 28 | this->m_signal_counter = 0; |
754 | @@ -57,3 +59,24 @@ | |||
755 | 57 | QCOMPARE(app->updateState(), true); | 59 | QCOMPARE(app->updateState(), true); |
756 | 58 | QCOMPARE(app->dbusPath(), QString("/com/canonical/download/path")); | 60 | QCOMPARE(app->dbusPath(), QString("/com/canonical/download/path")); |
757 | 59 | } | 61 | } |
758 | 62 | |||
759 | 63 | void TestClickManager::testTokenObtained() | ||
760 | 64 | { | ||
761 | 65 | ClickManager manager; | ||
762 | 66 | manager.checkUpdates(); | ||
763 | 67 | QCOMPARE(manager.m_token.isValid(), true); | ||
764 | 68 | } | ||
765 | 69 | |||
766 | 70 | void TestClickManager::testDownloadNotCreated() | ||
767 | 71 | { | ||
768 | 72 | ClickManager manager; | ||
769 | 73 | manager.checkUpdates(); | ||
770 | 74 | manager.m_token = Token(); | ||
771 | 75 | Application* app = manager.m_model[0].value<Application*>(); | ||
772 | 76 | manager.startDownload(app->getPackageName()); | ||
773 | 77 | QCOMPARE(app->updateState(), false); | ||
774 | 78 | QCOMPARE(app->dbusPath(), QString("")); | ||
775 | 79 | QCOMPARE(app->getError(), QString("Invalid User Token")); | ||
776 | 80 | } | ||
777 | 81 | |||
778 | 82 | } | ||
779 | 60 | 83 | ||
780 | === modified file 'tests/testclickmanager.h' | |||
781 | --- tests/testclickmanager.h 2013-09-13 11:00:52 +0000 | |||
782 | +++ tests/testclickmanager.h 2013-09-26 16:47:31 +0000 | |||
783 | @@ -23,6 +23,8 @@ | |||
784 | 23 | 23 | ||
785 | 24 | #include <QtTest/QtTest> | 24 | #include <QtTest/QtTest> |
786 | 25 | 25 | ||
787 | 26 | namespace ClickPlugin { | ||
788 | 27 | |||
789 | 26 | class TestClickManager : public QObject | 28 | class TestClickManager : public QObject |
790 | 27 | { | 29 | { |
791 | 28 | Q_OBJECT | 30 | Q_OBJECT |
792 | @@ -35,9 +37,13 @@ | |||
793 | 35 | 37 | ||
794 | 36 | void testCheckUpdates(); | 38 | void testCheckUpdates(); |
795 | 37 | void testStartDownload(); | 39 | void testStartDownload(); |
796 | 40 | void testTokenObtained(); | ||
797 | 41 | void testDownloadNotCreated(); | ||
798 | 38 | 42 | ||
799 | 39 | private: | 43 | private: |
800 | 40 | int m_signal_counter; | 44 | int m_signal_counter; |
801 | 41 | }; | 45 | }; |
802 | 42 | 46 | ||
803 | 47 | } | ||
804 | 48 | |||
805 | 43 | #endif // TESTCLICKMANAGER_H | 49 | #endif // TESTCLICKMANAGER_H |
806 | 44 | 50 | ||
807 | === modified file 'tests/tests.pro' | |||
808 | --- tests/tests.pro 2013-09-13 15:34:29 +0000 | |||
809 | +++ tests/tests.pro 2013-09-26 16:47:31 +0000 | |||
810 | @@ -1,4 +1,4 @@ | |||
812 | 1 | QT += core qml quick network testlib dbus | 1 | QT += core qml quick network testlib dbus xml |
813 | 2 | 2 | ||
814 | 3 | QT -= gui | 3 | QT -= gui |
815 | 4 | 4 | ||
816 | @@ -25,7 +25,8 @@ | |||
817 | 25 | fakeprocess.cpp \ | 25 | fakeprocess.cpp \ |
818 | 26 | ../src/download/download_struct.cpp \ | 26 | ../src/download/download_struct.cpp \ |
819 | 27 | ../src/download/group_download_struct.cpp \ | 27 | ../src/download/group_download_struct.cpp \ |
821 | 28 | ../src/download/hash_algorithm.cpp | 28 | ../src/download/hash_algorithm.cpp \ |
822 | 29 | fakessoservice.cpp | ||
823 | 29 | 30 | ||
824 | 30 | HEADERS += \ | 31 | HEADERS += \ |
825 | 31 | ../src/clickmanager_plugin.h \ | 32 | ../src/clickmanager_plugin.h \ |
826 | @@ -44,9 +45,11 @@ | |||
827 | 44 | fakeprocess.h \ | 45 | fakeprocess.h \ |
828 | 45 | ../src/download/download_struct.h \ | 46 | ../src/download/download_struct.h \ |
829 | 46 | ../src/download/group_download_struct.h \ | 47 | ../src/download/group_download_struct.h \ |
831 | 47 | ../src/download/hash_algorithm.h | 48 | ../src/download/hash_algorithm.h \ |
832 | 49 | fakessoservice.h | ||
833 | 48 | 50 | ||
835 | 49 | LIBS += -lapt-pkg | 51 | QMAKE_CXXFLAGS += -I /usr/include/ubuntuoneauth-2.0 -I /usr/include/signon-qt5 -I /usr/include/accounts-qt5 |
836 | 52 | LIBS += -lapt-pkg -lubuntuoneauth-2.0 -lsignon-qt5 -laccounts-qt5 | ||
837 | 50 | INCLUDEPATH += ../src/ | 53 | INCLUDEPATH += ../src/ |
838 | 51 | 54 | ||
839 | 52 | DEFINES += SRCDIR=\\\"$$PWD/\\\" | 55 | DEFINES += SRCDIR=\\\"$$PWD/\\\" |
+#include <ubuntuoneauth- 2.0/ssoservice. h>
This is wrong. You should only include <ssoservice> as the ubuntuoneauth-2.0 should come from the INCLUDES paths passed to the compiler (as -I/usr/ include/ ubuntuoneauth- 2.0/ for example).