Merge lp:~mandel/ubuntu-download-manager/add-manager-implementation into lp:ubuntu-download-manager

Proposed by Manuel de la Peña
Status: Merged
Approved by: Manuel de la Peña
Approved revision: 217
Merged at revision: 216
Proposed branch: lp:~mandel/ubuntu-download-manager/add-manager-implementation
Merge into: lp:ubuntu-download-manager
Diff against target: 4183 lines (+1871/-320)
124 files modified
common-project-config.pri (+10/-1)
debian/control (+23/-1)
debian/ubuntu-download-manager-client-dev.install (+3/-1)
debian/ubuntu-download-manager-client1.install (+1/-1)
debian/ubuntu-download-manager-common-dev.install (+0/-1)
debian/ubuntu-download-manager-common1.install (+1/-1)
debian/ubuntu-download-manager-priv1.install (+1/-1)
download-manager.pro (+10/-2)
ubuntu-download-manager-client-tests/main.cpp (+25/-0)
ubuntu-download-manager-client-tests/test_download_watch.cpp (+90/-0)
ubuntu-download-manager-client-tests/test_download_watch.h (+58/-0)
ubuntu-download-manager-client-tests/test_group_watch.cpp (+99/-0)
ubuntu-download-manager-client-tests/test_group_watch.h (+60/-0)
ubuntu-download-manager-client-tests/ubuntu-download-manager-client-tests.pro (+44/-0)
ubuntu-download-manager-client/ubuntu-download-manager-client.pro (+13/-3)
ubuntu-download-manager-client/ubuntu/download_manager/download.cpp (+57/-0)
ubuntu-download-manager-client/ubuntu/download_manager/download.h (+62/-0)
ubuntu-download-manager-client/ubuntu/download_manager/error.cpp (+33/-0)
ubuntu-download-manager-client/ubuntu/download_manager/error.h (+43/-0)
ubuntu-download-manager-client/ubuntu/download_manager/group_download.cpp (+57/-0)
ubuntu-download-manager-client/ubuntu/download_manager/group_download.h (+63/-0)
ubuntu-download-manager-client/ubuntu/download_manager/manager.cpp (+146/-27)
ubuntu-download-manager-client/ubuntu/download_manager/manager.h (+39/-8)
ubuntu-download-manager-client/ubuntu/download_manager/manager_interface.cpp (+33/-0)
ubuntu-download-manager-client/ubuntu/download_manager/manager_interface.h (+111/-0)
ubuntu-download-manager-client/ubuntu/download_manager/manager_pendingcall_watcher.cpp (+102/-0)
ubuntu-download-manager-client/ubuntu/download_manager/manager_pendingcall_watcher.h (+81/-0)
ubuntu-download-manager-common/ubuntu-download-manager-common.pro (+2/-0)
ubuntu-download-manager-common/ubuntu/download_manager/system/dbus_connection.cpp (+10/-0)
ubuntu-download-manager-common/ubuntu/download_manager/system/dbus_connection.h (+3/-1)
ubuntu-download-manager-priv/downloads/daemon.cpp (+32/-9)
ubuntu-download-manager-priv/downloads/daemon.h (+19/-8)
ubuntu-download-manager-priv/downloads/download.cpp (+5/-1)
ubuntu-download-manager-priv/downloads/download.h (+5/-1)
ubuntu-download-manager-priv/downloads/download_manager_adaptor.cpp (+4/-0)
ubuntu-download-manager-priv/downloads/download_manager_adaptor.h (+4/-0)
ubuntu-download-manager-priv/downloads/downloads_db.cpp (+3/-0)
ubuntu-download-manager-priv/downloads/downloads_db.h (+4/-0)
ubuntu-download-manager-priv/downloads/factory.cpp (+4/-5)
ubuntu-download-manager-priv/downloads/factory.h (+5/-1)
ubuntu-download-manager-priv/downloads/file_download.cpp (+5/-1)
ubuntu-download-manager-priv/downloads/file_download.h (+5/-1)
ubuntu-download-manager-priv/downloads/group_download.cpp (+5/-1)
ubuntu-download-manager-priv/downloads/group_download.h (+5/-1)
ubuntu-download-manager-priv/downloads/group_download_adaptor.cpp (+4/-0)
ubuntu-download-manager-priv/downloads/group_download_adaptor.h (+4/-0)
ubuntu-download-manager-priv/downloads/manager.cpp (+4/-1)
ubuntu-download-manager-priv/downloads/manager.h (+6/-2)
ubuntu-download-manager-priv/downloads/queue.cpp (+3/-0)
ubuntu-download-manager-priv/downloads/queue.h (+4/-0)
ubuntu-download-manager-priv/downloads/sm_file_download.cpp (+5/-1)
ubuntu-download-manager-priv/downloads/sm_file_download.h (+5/-1)
ubuntu-download-manager-priv/downloads/state_machines/download_sm.cpp (+5/-1)
ubuntu-download-manager-priv/downloads/state_machines/download_sm.h (+5/-1)
ubuntu-download-manager-priv/downloads/state_machines/final_state.cpp (+5/-1)
ubuntu-download-manager-priv/downloads/state_machines/final_state.h (+5/-1)
ubuntu-download-manager-priv/downloads/state_machines/state.cpp (+17/-1)
ubuntu-download-manager-priv/downloads/state_machines/state.h (+17/-1)
ubuntu-download-manager-priv/system/apparmor.h (+2/-2)
ubuntu-download-manager-priv/ubuntu-download-manager-priv.pro (+0/-2)
ubuntu-download-manager-test-lib/ubuntu-download-manager-test-lib.pro (+63/-0)
ubuntu-download-manager-test-lib/ubuntu-download-manager-test-lib_global.h (+12/-0)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/base_testcase.h (+3/-3)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/client/daemon_testcase.cpp (+50/-0)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/client/daemon_testcase.h (+46/-0)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/apparmor.cpp (+2/-2)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/apparmor.h (+2/-2)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/application.cpp (+1/-1)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/application.h (+1/-1)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/dbus_connection.cpp (+1/-1)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/dbus_connection.h (+2/-2)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/download.cpp (+1/-1)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/download.h (+2/-2)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/factory.cpp (+2/-2)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/factory.h (+3/-2)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/file_manager.cpp (+1/-1)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/file_manager.h (+1/-1)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/manager.cpp (+2/-2)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/manager.h (+4/-3)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/network_reply.cpp (+3/-3)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/network_reply.h (+2/-2)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/process.cpp (+1/-1)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/process.h (+1/-1)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/process_factory.cpp (+2/-2)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/process_factory.h (+1/-1)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/qnetwork_reply.cpp (+2/-2)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/qnetwork_reply.h (+2/-2)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/queue.cpp (+1/-1)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/queue.h (+2/-2)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/request_factory.cpp (+3/-3)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/request_factory.h (+2/-2)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/sm_file_download.cpp (+2/-2)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/sm_file_download.h (+3/-3)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/system_network_info.cpp (+1/-1)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/system_network_info.h (+1/-1)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/timer.cpp (+1/-1)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/timer.h (+1/-1)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/uuid_factory.cpp (+1/-1)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/uuid_factory.h (+1/-1)
ubuntu-download-manager-test-lib/ubuntudownloadmanagertestlib.cpp (+6/-0)
ubuntu-download-manager-test-lib/ubuntudownloadmanagertestlib.h (+13/-0)
ubuntu-download-manager-tests/downloads/state_machines/test_cancel_download_transition.h (+7/-7)
ubuntu-download-manager-tests/downloads/state_machines/test_file_download_sm.h (+5/-5)
ubuntu-download-manager-tests/downloads/state_machines/test_final_state.h (+6/-6)
ubuntu-download-manager-tests/downloads/state_machines/test_network_error_transition.h (+5/-5)
ubuntu-download-manager-tests/downloads/state_machines/test_resume_download_transition.h (+5/-5)
ubuntu-download-manager-tests/downloads/state_machines/test_ssl_error_transition.h (+5/-5)
ubuntu-download-manager-tests/downloads/state_machines/test_start_download_transition.h (+5/-5)
ubuntu-download-manager-tests/downloads/state_machines/test_stop_request_transition.h (+6/-7)
ubuntu-download-manager-tests/downloads/test_daemon.cpp (+16/-14)
ubuntu-download-manager-tests/downloads/test_daemon.h (+7/-7)
ubuntu-download-manager-tests/downloads/test_download.cpp (+4/-4)
ubuntu-download-manager-tests/downloads/test_download.h (+7/-7)
ubuntu-download-manager-tests/downloads/test_download_factory.h (+9/-8)
ubuntu-download-manager-tests/downloads/test_download_manager.cpp (+3/-3)
ubuntu-download-manager-tests/downloads/test_download_manager.h (+14/-11)
ubuntu-download-manager-tests/downloads/test_download_queue.h (+6/-6)
ubuntu-download-manager-tests/downloads/test_downloads_db.cpp (+4/-4)
ubuntu-download-manager-tests/downloads/test_downloads_db.h (+4/-4)
ubuntu-download-manager-tests/downloads/test_group_download.cpp (+2/-2)
ubuntu-download-manager-tests/downloads/test_group_download.h (+12/-9)
ubuntu-download-manager-tests/main.cpp (+2/-2)
ubuntu-download-manager-tests/ubuntu-download-manager-tests.pro (+6/-40)
ubuntu-download-manager/main.cpp (+4/-3)
To merge this branch: bzr merge lp:~mandel/ubuntu-download-manager/add-manager-implementation
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Diego Sarmentero (community) Approve
Review via email: mp+201576@code.launchpad.net

Commit message

Provides the initial implementation of the Manager class that allows to create downloads in the UDM via the client lib.

Description of the change

Provides the initial implementation of the Manager class that allows to create downloads in the UDM via the client lib.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
203. By Manuel de la Peña

Increate timeout to make CI happy.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
204. By Manuel de la Peña

Increase the timeout for CI.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
205. By Manuel de la Peña

Larger timeout for CI.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
206. By Manuel de la Peña

USe the QEventLoop trick to try and do not use timeuts for the CI.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
207. By Manuel de la Peña

Remove the signal spy because if makes CI fail.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
208. By Manuel de la Peña

USe xvfb so that there are no issues in CI.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
209. By Manuel de la Peña

Provide dbus-launch for the headless CI.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
210. By Manuel de la Peña

Add code to allow starting the daemon.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
211. By Manuel de la Peña

Reverted to revno before the CI fiasco.

212. By Manuel de la Peña

Use dbus-test-runner.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Diego Sarmentero (diegosarmentero) wrote :

+1

review: Approve
213. By Manuel de la Peña

Fix packaging.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
214. By Manuel de la Peña

Fix debian -dev packages.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
215. By Manuel de la Peña

Use the arch location to fix issues with the .pc

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
216. By Manuel de la Peña

Install correctly in arm.

217. By Manuel de la Peña

Correct x86 location.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'common-project-config.pri'
2--- common-project-config.pri 2013-12-13 15:24:14 +0000
3+++ common-project-config.pri 2014-01-22 15:16:38 +0000
4@@ -27,7 +27,16 @@
5 message("==== install prefix set to `$${INSTALL_PREFIX}'")
6 }
7
8-INSTALL_LIBDIR = $${INSTALL_PREFIX}/lib
9+ARCH = $$system(uname -m)
10+contains( ARCH, x86_64 ) {
11+ INSTALL_LIBDIR = $${INSTALL_PREFIX}/lib/x86_64-linux-gnu
12+} else {
13+ contains( ARCH, i686) {
14+ INSTALL_LIBDIR = $${INSTALL_PREFIX}/lib/i386-linux-gnu
15+ } else {
16+ INSTALL_LIBDIR = $${INSTALL_PREFIX}/lib/arm-linux-gnueabihf
17+ }
18+}
19
20 # default library directory can be overriden by defining LIBDIR when
21 # running qmake
22
23=== modified file 'debian/control'
24--- debian/control 2013-12-03 16:41:58 +0000
25+++ debian/control 2014-01-22 15:16:38 +0000
26@@ -8,7 +8,8 @@
27 qtsystems5-dev,
28 libdbus-1-dev,
29 libqt5sql5-sqlite,
30- libnih-dbus-dev
31+ libnih-dbus-dev,
32+ dbus-test-runner
33 Maintainer: Manuel de la Peña <manuel.delapena@canonical.com>
34 Standards-Version: 3.9.4
35 Homepage: https://launchpad.net/ubuntu-system-image
36@@ -27,6 +28,16 @@
37 .
38 This package includes the common shared library between the client lib and and the service lib.
39
40+Package: ubuntu-download-manager-common-dev
41+Section: libdevel
42+Architecture: any
43+Depends: ubuntu-download-manager-common1(= ${binary:Version}),
44+ ${shlibs:Depends},
45+ ${misc:Depends}
46+Description: QT library for Ubuntu Download Manager - development files
47+ .
48+ This package contains the common headers shared between the client library and the daemon library.
49+
50 Package: ubuntu-download-manager-priv1
51 Section: libs
52 Architecture: any
53@@ -49,6 +60,17 @@
54 .
55 This package includes the public shared library.
56
57+Package: ubuntu-download-manager-client-dev
58+Section: libdevel
59+Architecture: any
60+Depends: ubuntu-download-manager-common1(= ${binary:Version}),
61+ ubuntu-download-manager-client1(= ${binary:Version}),
62+ ${shlibs:Depends},
63+ ${misc:Depends}
64+Description: QT library for Ubuntu Download Manager - development files
65+ .
66+ This package contains the header that can be used to allow an application use the Ubuntu Download Manager client library.
67+
68 Package: ubuntu-download-manager
69 Section: net
70 Architecture: any
71
72=== modified file 'debian/ubuntu-download-manager-client-dev.install'
73--- debian/ubuntu-download-manager-client-dev.install 2013-12-04 10:51:41 +0000
74+++ debian/ubuntu-download-manager-client-dev.install 2014-01-22 15:16:38 +0000
75@@ -1,3 +1,5 @@
76+usr/include/ubuntu/download_manager/error.h
77 usr/include/ubuntu/download_manager/manager.h
78-usr/lib/*/libubuntu-download-manager-client.so
79+usr/include/ubuntu/download_manager/download.h
80+usr/include/ubuntu/download_manager/group_download.h
81 usr/lib/*/pkgconfig/ubuntu-download-manager-client.pc
82
83=== modified file 'debian/ubuntu-download-manager-client1.install'
84--- debian/ubuntu-download-manager-client1.install 2013-12-03 16:41:58 +0000
85+++ debian/ubuntu-download-manager-client1.install 2014-01-22 15:16:38 +0000
86@@ -1,1 +1,1 @@
87-usr/lib/libubuntu-download-manager-client.so.*
88+usr/lib/*/libubuntu-download-manager-client.so.*
89
90=== modified file 'debian/ubuntu-download-manager-common-dev.install'
91--- debian/ubuntu-download-manager-common-dev.install 2013-12-04 00:57:13 +0000
92+++ debian/ubuntu-download-manager-common-dev.install 2014-01-22 15:16:38 +0000
93@@ -1,5 +1,4 @@
94 usr/include/ubuntu/download_manager/metatypes.h
95 usr/include/ubuntu/download_manager/download_struct.h
96 usr/include/ubuntu/download_manager/group_download_struct.h
97-usr/lib/*/libubuntu-download-manager-common.so
98 usr/lib/*/pkgconfig/ubuntu-download-manager-common.pc
99
100=== modified file 'debian/ubuntu-download-manager-common1.install'
101--- debian/ubuntu-download-manager-common1.install 2013-12-03 12:25:56 +0000
102+++ debian/ubuntu-download-manager-common1.install 2014-01-22 15:16:38 +0000
103@@ -1,1 +1,1 @@
104-usr/lib/libubuntu-download-manager-common.so.*
105+usr/lib/*/libubuntu-download-manager-common.so.*
106
107=== modified file 'debian/ubuntu-download-manager-priv1.install'
108--- debian/ubuntu-download-manager-priv1.install 2013-12-03 12:25:56 +0000
109+++ debian/ubuntu-download-manager-priv1.install 2014-01-22 15:16:38 +0000
110@@ -1,1 +1,1 @@
111-usr/lib/libubuntu-download-manager-priv.so.*
112+usr/lib/*/libubuntu-download-manager-priv.so.*
113
114=== modified file 'download-manager.pro'
115--- download-manager.pro 2013-12-03 13:29:34 +0000
116+++ download-manager.pro 2014-01-22 15:16:38 +0000
117@@ -7,11 +7,19 @@
118 ubuntu-download-manager-common \
119 ubuntu-download-manager-priv \
120 ubuntu-download-manager \
121+ ubuntu-download-manager-client \
122+ ubuntu-download-manager-test-lib \
123 ubuntu-download-manager-tests \
124- ubuntu-download-manager-client
125+ ubuntu-download-manager-client-tests
126
127 ubuntu-download-manager-priv.depends = ubuntu-download-manager-common
128
129 ubuntu-download-manager.depends = ubuntu-download-manager-priv
130
131-ubuntu-download-manager-tests.depends = ubuntu-download-manager-priv
132+ubuntu-download-manager-client.depends = ubuntu-download-manager-common
133+
134+ubuntu-download-manager-tests.depends += ubuntu-download-manager-test-lib
135+ubuntu-download-manager-tests.depends += ubuntu-download-manager-priv
136+
137+ubuntu-download-manager-client-tests.depends += ubuntu-download-manager-test-lib
138+ubuntu-download-manager-client-tests.depends += ubuntu-download-manager-client
139
140=== added directory 'ubuntu-download-manager-client-tests'
141=== added file 'ubuntu-download-manager-client-tests/main.cpp'
142--- ubuntu-download-manager-client-tests/main.cpp 1970-01-01 00:00:00 +0000
143+++ ubuntu-download-manager-client-tests/main.cpp 2014-01-22 15:16:38 +0000
144@@ -0,0 +1,25 @@
145+/*
146+ * Copyright 2013 Canonical Ltd.
147+ *
148+ * This library is free software; you can redistribute it and/or
149+ * modify it under the terms of version 3 of the GNU Lesser General Public
150+ * License as published by the Free Software Foundation.
151+ *
152+ * This program is distributed in the hope that it will be useful,
153+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
154+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
155+ * General Public License for more details.
156+ *
157+ * You should have received a copy of the GNU Lesser General Public
158+ * License along with this library; if not, write to the
159+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
160+ * Boston, MA 02110-1301, USA.
161+ */
162+
163+#include <QCoreApplication>
164+#include <ubuntu/download_manager/tests/test_runner.h>
165+
166+int main(int argc, char *argv[]) {
167+ QCoreApplication a(argc, argv);
168+ return RUN_ALL_QTESTS(argc, argv);
169+}
170
171=== added file 'ubuntu-download-manager-client-tests/test_download_watch.cpp'
172--- ubuntu-download-manager-client-tests/test_download_watch.cpp 1970-01-01 00:00:00 +0000
173+++ ubuntu-download-manager-client-tests/test_download_watch.cpp 2014-01-22 15:16:38 +0000
174@@ -0,0 +1,90 @@
175+/*
176+ * Copyright 2013 Canonical Ltd.
177+ *
178+ * This library is free software; you can redistribute it and/or
179+ * modify it under the terms of version 3 of the GNU Lesser General Public
180+ * License as published by the Free Software Foundation.
181+ *
182+ * This program is distributed in the hope that it will be useful,
183+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
184+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
185+ * General Public License for more details.
186+ *
187+ * You should have received a copy of the GNU Lesser General Public
188+ * License along with this library; if not, write to the
189+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
190+ * Boston, MA 02110-1301, USA.
191+ */
192+
193+#include <QSignalSpy>
194+#include "test_download_watch.h"
195+
196+TestDownloadWatch::TestDownloadWatch(QObject *parent)
197+ : DaemonTestCase("TestDownloadWatch", parent) {
198+}
199+
200+void
201+TestDownloadWatch::onSuccessCb(Download* down) {
202+ _calledSuccess = true;
203+ delete down;
204+}
205+
206+void
207+TestDownloadWatch::onErrorCb(Download* err) {
208+ _calledError = true;
209+ delete err;
210+}
211+
212+void
213+TestDownloadWatch::init() {
214+ DaemonTestCase::init();
215+ _calledSuccess = false;
216+ _calledError = false;
217+ _manager = Manager::createSessionManager(daemonPath(), this);
218+}
219+
220+void
221+TestDownloadWatch::cleanup() {
222+ delete _manager;
223+ DaemonTestCase::cleanup();
224+}
225+
226+void
227+TestDownloadWatch::testCallbackIsExecuted() {
228+ QString url = "http://www.python.org/ftp/python/3.3.3/Python-3.3.3.tar.xz";
229+ QVariantMap metadata;
230+ QMap<QString, QString> headers;
231+ DownloadStruct down(url, metadata, headers);
232+
233+ DownloadCb cb = std::bind(&TestDownloadWatch::onSuccessCb, this,
234+ std::placeholders::_1);
235+ DownloadCb errCb = std::bind(&TestDownloadWatch::onErrorCb, this,
236+ std::placeholders::_1);
237+
238+ QSignalSpy spy(_manager, SIGNAL(downloadCreated(Download*)));
239+ _manager->createDownload(down, cb, errCb);
240+
241+ QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 1, 50000);
242+ QVERIFY(_calledSuccess);
243+ QVERIFY(!_calledError);
244+}
245+
246+void
247+TestDownloadWatch::testErrCallbackIsExecuted() {
248+ QString url = ""; // we should get an error with an empty string
249+ QVariantMap metadata;
250+ QMap<QString, QString> headers;
251+ DownloadStruct down(url, metadata, headers);
252+
253+ DownloadCb cb = std::bind(&TestDownloadWatch::onSuccessCb, this,
254+ std::placeholders::_1);
255+ DownloadCb errCb = std::bind(&TestDownloadWatch::onErrorCb, this,
256+ std::placeholders::_1);
257+
258+ QSignalSpy spy(_manager, SIGNAL(downloadCreated(Download*)));
259+ _manager->createDownload(down, cb, errCb);
260+
261+ QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 1, 50000);
262+ QVERIFY(!_calledSuccess);
263+ QVERIFY(_calledError);
264+}
265
266=== added file 'ubuntu-download-manager-client-tests/test_download_watch.h'
267--- ubuntu-download-manager-client-tests/test_download_watch.h 1970-01-01 00:00:00 +0000
268+++ ubuntu-download-manager-client-tests/test_download_watch.h 2014-01-22 15:16:38 +0000
269@@ -0,0 +1,58 @@
270+/*
271+ * Copyright 2013 Canonical Ltd.
272+ *
273+ * This library is free software; you can redistribute it and/or
274+ * modify it under the terms of version 3 of the GNU Lesser General Public
275+ * License as published by the Free Software Foundation.
276+ *
277+ * This program is distributed in the hope that it will be useful,
278+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
279+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
280+ * General Public License for more details.
281+ *
282+ * You should have received a copy of the GNU Lesser General Public
283+ * License along with this library; if not, write to the
284+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
285+ * Boston, MA 02110-1301, USA.
286+ */
287+
288+#ifndef TEST_DOWNLOAD_WATCH_H
289+#define TEST_DOWNLOAD_WATCH_H
290+
291+#include <functional>
292+#include <ubuntu/download_manager/download.h>
293+#include <ubuntu/download_manager/error.h>
294+#include <ubuntu/download_manager/manager.h>
295+#include <QObject>
296+#include <ubuntu/download_manager/tests/client/daemon_testcase.h>
297+#include <ubuntu/download_manager/tests/test_runner.h>
298+
299+using namespace Ubuntu::DownloadManager;
300+
301+class TestDownloadWatch : public DaemonTestCase {
302+ Q_OBJECT
303+
304+ public:
305+ explicit TestDownloadWatch(QObject *parent = 0);
306+
307+ private:
308+ void onSuccessCb(Download* down);
309+ void onErrorCb(Download* err);
310+ void onDownloadError(Download* down);
311+
312+ private slots: // NOLINT(whitespace/indent)
313+
314+ void init() override;
315+ void cleanup() override;
316+ void testCallbackIsExecuted();
317+ void testErrCallbackIsExecuted();
318+
319+ private:
320+ bool _calledSuccess = false;
321+ bool _calledError = false;
322+ Manager* _manager;
323+};
324+
325+DECLARE_TEST(TestDownloadWatch)
326+
327+#endif // TEST_DOWNLOAD_WATCH_H
328
329=== added file 'ubuntu-download-manager-client-tests/test_group_watch.cpp'
330--- ubuntu-download-manager-client-tests/test_group_watch.cpp 1970-01-01 00:00:00 +0000
331+++ ubuntu-download-manager-client-tests/test_group_watch.cpp 2014-01-22 15:16:38 +0000
332@@ -0,0 +1,99 @@
333+/*
334+ * Copyright 2013 Canonical Ltd.
335+ *
336+ * This library is free software; you can redistribute it and/or
337+ * modify it under the terms of version 3 of the GNU Lesser General Public
338+ * License as published by the Free Software Foundation.
339+ *
340+ * This program is distributed in the hope that it will be useful,
341+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
342+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
343+ * General Public License for more details.
344+ *
345+ * You should have received a copy of the GNU Lesser General Public
346+ * License along with this library; if not, write to the
347+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
348+ * Boston, MA 02110-1301, USA.
349+ */
350+
351+#include <QSignalSpy>
352+#include "test_group_watch.h"
353+
354+TestGroupWatch::TestGroupWatch(QObject* parent)
355+ : DaemonTestCase("TestGroupWatch", parent) {
356+}
357+
358+void
359+TestGroupWatch::onSuccessCb(GroupDownload* down) {
360+ delete down;
361+ _calledSuccess = true;
362+}
363+
364+void
365+TestGroupWatch::onErrorCb(GroupDownload* err) {
366+ delete err;
367+ _calledError = true;
368+}
369+
370+void
371+TestGroupWatch::init() {
372+ DaemonTestCase::init();
373+ _calledSuccess = false;
374+ _calledError = false;
375+ _algo = "Md5";
376+ _manager = Manager::createSessionManager(daemonPath(), this);
377+}
378+
379+void
380+TestGroupWatch::cleanup() {
381+ delete _manager;
382+ DaemonTestCase::cleanup();
383+}
384+
385+void
386+TestGroupWatch::testCallbackIsExecuted() {
387+ QList<GroupDownloadStruct> downloadsStruct;
388+ downloadsStruct.append(GroupDownloadStruct("http://one.ubunt.com",
389+ "local_file", ""));
390+ downloadsStruct.append(GroupDownloadStruct("http://ubuntu.com",
391+ "other_local_file", ""));
392+ downloadsStruct.append(GroupDownloadStruct("http://reddit.com",
393+ "other_reddit_local_file", ""));
394+
395+ GroupCb cb = std::bind(&TestGroupWatch::onSuccessCb, this,
396+ std::placeholders::_1);
397+ GroupCb errCb = std::bind(&TestGroupWatch::onErrorCb, this,
398+ std::placeholders::_1);
399+
400+ QSignalSpy spy(_manager, SIGNAL(groupCreated(GroupDownload*)));
401+ _manager->createDownload(downloadsStruct, _algo, false, _metadata, _headers,
402+ cb, errCb);
403+
404+ QTRY_COMPARE(spy.count(), 1);
405+ QVERIFY(_calledSuccess);
406+ QVERIFY(!_calledError);
407+}
408+
409+void
410+TestGroupWatch::testErrCallbackIsExecuted() {
411+ QList<GroupDownloadStruct> downloadsStruct;
412+ downloadsStruct.append(GroupDownloadStruct("http://one.ubunt.com",
413+ "local_file", ""));
414+ downloadsStruct.append(GroupDownloadStruct("http://ubuntu.com",
415+ "local_file", "")); // same local path that raises an error
416+ downloadsStruct.append(GroupDownloadStruct("http://reddit.com",
417+ "other_reddit_local_file", ""));
418+
419+ GroupCb cb = std::bind(&TestGroupWatch::onSuccessCb, this,
420+ std::placeholders::_1);
421+ GroupCb errCb = std::bind(&TestGroupWatch::onErrorCb, this,
422+ std::placeholders::_1);
423+
424+ QSignalSpy spy(_manager, SIGNAL(groupCreated(GroupDownload*)));
425+ _manager->createDownload(downloadsStruct, _algo, false, _metadata, _headers,
426+ cb, errCb);
427+
428+ QTRY_COMPARE(spy.count(), 1);
429+ QVERIFY(!_calledSuccess);
430+ QVERIFY(_calledError);
431+}
432
433=== added file 'ubuntu-download-manager-client-tests/test_group_watch.h'
434--- ubuntu-download-manager-client-tests/test_group_watch.h 1970-01-01 00:00:00 +0000
435+++ ubuntu-download-manager-client-tests/test_group_watch.h 2014-01-22 15:16:38 +0000
436@@ -0,0 +1,60 @@
437+/*
438+ * Copyright 2013 Canonical Ltd.
439+ *
440+ * This library is free software; you can redistribute it and/or
441+ * modify it under the terms of version 3 of the GNU Lesser General Public
442+ * License as published by the Free Software Foundation.
443+ *
444+ * This program is distributed in the hope that it will be useful,
445+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
446+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
447+ * General Public License for more details.
448+ *
449+ * You should have received a copy of the GNU Lesser General Public
450+ * License along with this library; if not, write to the
451+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
452+ * Boston, MA 02110-1301, USA.
453+ */
454+
455+#ifndef TEST_GROUP_WATCH_H
456+#define TEST_GROUP_WATCH_H
457+
458+#include <functional>
459+#include <ubuntu/download_manager/group_download.h>
460+#include <ubuntu/download_manager/error.h>
461+#include <ubuntu/download_manager/manager.h>
462+#include <QObject>
463+#include <ubuntu/download_manager/tests/client/daemon_testcase.h>
464+#include <ubuntu/download_manager/tests/test_runner.h>
465+
466+using namespace Ubuntu::DownloadManager;
467+
468+class TestGroupWatch : public DaemonTestCase {
469+ Q_OBJECT
470+
471+ public:
472+ explicit TestGroupWatch(QObject* parent = 0);
473+
474+ private:
475+ void onSuccessCb(GroupDownload* down);
476+ void onErrorCb(GroupDownload* err);
477+
478+ private slots: // NOLINT(whitespace/indent)
479+
480+ void init() override;
481+ void cleanup() override;
482+ void testCallbackIsExecuted();
483+ void testErrCallbackIsExecuted();
484+
485+ private:
486+ bool _calledSuccess = false;
487+ bool _calledError = false;
488+ QString _algo;
489+ QVariantMap _metadata;
490+ QMap<QString, QString> _headers;
491+ Manager* _manager;
492+};
493+
494+DECLARE_TEST(TestGroupWatch)
495+
496+#endif // TEST_GROUP_WATCH_H
497
498=== added file 'ubuntu-download-manager-client-tests/ubuntu-download-manager-client-tests.pro'
499--- ubuntu-download-manager-client-tests/ubuntu-download-manager-client-tests.pro 1970-01-01 00:00:00 +0000
500+++ ubuntu-download-manager-client-tests/ubuntu-download-manager-client-tests.pro 2014-01-22 15:16:38 +0000
501@@ -0,0 +1,44 @@
502+include( ../common-project-config.pri )
503+include( ../common-vars.pri )
504+
505+QT += network core testlib dbus systeminfo sql
506+QT -= gui
507+
508+TARGET = ubuntu-download-manager-client-tests
509+CONFIG += console
510+CONFIG -= app_bundle
511+
512+TEMPLATE = app
513+
514+HEADERS += \
515+ test_group_watch.h \
516+ test_download_watch.h
517+
518+SOURCES += main.cpp \
519+ test_group_watch.cpp \
520+ test_download_watch.cpp
521+
522+LIBS += -L$$OUT_PWD/../ubuntu-download-manager-common/ -lubuntu-download-manager-common
523+
524+INCLUDEPATH += $$PWD/../ubuntu-download-manager-common
525+DEPENDPATH += $$PWD/../ubuntu-download-manager-common
526+
527+LIBS += -L$$OUT_PWD/../ubuntu-download-manager-client/ -lubuntu-download-manager-client
528+
529+INCLUDEPATH += $$PWD/../ubuntu-download-manager-client
530+DEPENDPATH += $$PWD/../ubuntu-download-manager-client
531+
532+LIBS += -L$$OUT_PWD/../ubuntu-download-manager-test-lib/ -lubuntu-download-manager-test-lib
533+
534+INCLUDEPATH += $$PWD/../ubuntu-download-manager-test-lib
535+DEPENDPATH += $$PWD/../ubuntu-download-manager-test-lib
536+
537+LIBS += -L$$OUT_PWD/../ubuntu-download-manager-priv/ -lubuntu-download-manager-priv
538+
539+INCLUDEPATH += $$PWD/../ubuntu-download-manager-priv
540+DEPENDPATH += $$PWD/../ubuntu-download-manager-priv
541+
542+
543+check.depends = $${TARGET}
544+check.commands = LD_LIBRARY_PATH=$$OUT_PWD/../ubuntu-download-manager-common:$$OUT_PWD/../ubuntu-download-manager-client:$$OUT_PWD/../ubuntu-download-manager-test-lib:$$OUT_PWD/../ubuntu-download-manager-priv dbus-test-runner --task=./$${TARGET}
545+QMAKE_EXTRA_TARGETS += check
546
547=== modified file 'ubuntu-download-manager-client/ubuntu-download-manager-client.pro'
548--- ubuntu-download-manager-client/ubuntu-download-manager-client.pro 2013-12-03 16:41:58 +0000
549+++ ubuntu-download-manager-client/ubuntu-download-manager-client.pro 2014-01-22 15:16:38 +0000
550@@ -9,13 +9,23 @@
551
552 DEFINES += UBUNTUDOWNLOADMANAGERCLIENT_LIBRARY
553
554-SOURCES += ubuntu/download_manager/manager.cpp
555+SOURCES += ubuntu/download_manager/manager.cpp \
556+ ubuntu/download_manager/manager_interface.cpp \
557+ ubuntu/download_manager/download.cpp \
558+ ubuntu/download_manager/group_download.cpp \
559+ ubuntu/download_manager/manager_pendingcall_watcher.cpp \
560+ ubuntu/download_manager/error.cpp
561
562 public_headers = \
563- ubuntu/download_manager/manager.h
564+ ubuntu/download_manager/manager.h \
565+ ubuntu/download_manager/download.h \
566+ ubuntu/download_manager/group_download.h \
567+ ubuntu/download_manager/error.h
568
569 private_headers = \
570- ubuntu-download-manager-client_global.h
571+ ubuntu-download-manager-client_global.h \
572+ ubuntu/download_manager/manager_interface.h \
573+ ubuntu/download_manager/manager_pendingcall_watcher.h
574
575 HEADERS +=\
576 $$public_headers \
577
578=== added file 'ubuntu-download-manager-client/ubuntu/download_manager/download.cpp'
579--- ubuntu-download-manager-client/ubuntu/download_manager/download.cpp 1970-01-01 00:00:00 +0000
580+++ ubuntu-download-manager-client/ubuntu/download_manager/download.cpp 2014-01-22 15:16:38 +0000
581@@ -0,0 +1,57 @@
582+/*
583+ * Copyright 2013 Canonical Ltd.
584+ *
585+ * This library is free software; you can redistribute it and/or
586+ * modify it under the terms of version 3 of the GNU Lesser General Public
587+ * License as published by the Free Software Foundation.
588+ *
589+ * This program is distributed in the hope that it will be useful,
590+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
591+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
592+ * General Public License for more details.
593+ *
594+ * You should have received a copy of the GNU Lesser General Public
595+ * License along with this library; if not, write to the
596+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
597+ * Boston, MA 02110-1301, USA.
598+ */
599+
600+#include "error.h"
601+#include "download.h"
602+
603+namespace Ubuntu {
604+
605+namespace DownloadManager {
606+
607+Download::Download(Error* err, QObject* parent)
608+ : QObject(parent),
609+ _error(err) {
610+ // TODO(mandel): complete implementation
611+ Q_UNUSED(err);
612+}
613+
614+Download::Download(QDBusObjectPath path, QObject* parent)
615+ : QObject(parent) {
616+ // TODO(mandel): complete implementation
617+ Q_UNUSED(path);
618+}
619+
620+Download::~Download() {
621+ delete _error;
622+}
623+
624+bool
625+Download::isError() {
626+ // TODO(mandel): complete implementation
627+ return false;
628+}
629+
630+Error*
631+Download::error() {
632+ // TODO(mandel): complete implementation
633+ return NULL;
634+}
635+
636+} // DownloadManager
637+
638+} // Ubuntu
639
640=== added file 'ubuntu-download-manager-client/ubuntu/download_manager/download.h'
641--- ubuntu-download-manager-client/ubuntu/download_manager/download.h 1970-01-01 00:00:00 +0000
642+++ ubuntu-download-manager-client/ubuntu/download_manager/download.h 2014-01-22 15:16:38 +0000
643@@ -0,0 +1,62 @@
644+/*
645+ * Copyright 2013 Canonical Ltd.
646+ *
647+ * This library is free software; you can redistribute it and/or
648+ * modify it under the terms of version 3 of the GNU Lesser General Public
649+ * License as published by the Free Software Foundation.
650+ *
651+ * This program is distributed in the hope that it will be useful,
652+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
653+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
654+ * General Public License for more details.
655+ *
656+ * You should have received a copy of the GNU Lesser General Public
657+ * License along with this library; if not, write to the
658+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
659+ * Boston, MA 02110-1301, USA.
660+ */
661+
662+#ifndef UBUNTU_DOWNLOADMANAGER_CLIENT_DOWNLOAD_H
663+#define UBUNTU_DOWNLOADMANAGER_CLIENT_DOWNLOAD_H
664+
665+#include <QDBusObjectPath>
666+#include <QObject>
667+#include "ubuntu-download-manager-client_global.h"
668+
669+namespace Ubuntu {
670+
671+namespace DownloadManager {
672+
673+class Error;
674+class ManagerPrivate;
675+class DownloadPrivate;
676+class UBUNTUDOWNLOADMANAGERCLIENTSHARED_EXPORT Download : public QObject {
677+ Q_OBJECT
678+ Q_DECLARE_PRIVATE(Download)
679+
680+ // allow the manager to create downloads
681+ friend class ManagerPrivate;
682+ friend class DownloadManagerPendingCallWatcher;
683+
684+ public:
685+ virtual ~Download();
686+ bool isError();
687+ Error* error();
688+
689+ protected:
690+ Download(Error* err, QObject* parent = 0);
691+ Download(QDBusObjectPath path, QObject* parent = 0);
692+
693+ private:
694+ // TODO(mandel): move this to pimpl, here to ensure no mem leaks atm
695+ Error* _error = NULL;
696+ // use pimpl pattern so that users do not have to be recompiled
697+ DownloadPrivate* d_ptr;
698+
699+};
700+
701+} // Ubuntu
702+
703+} // DownloadManager
704+
705+#endif // UBUNTU_DOWNLOADMANAGER_CLIENT_DOWNLOAD_H
706
707=== added file 'ubuntu-download-manager-client/ubuntu/download_manager/error.cpp'
708--- ubuntu-download-manager-client/ubuntu/download_manager/error.cpp 1970-01-01 00:00:00 +0000
709+++ ubuntu-download-manager-client/ubuntu/download_manager/error.cpp 2014-01-22 15:16:38 +0000
710@@ -0,0 +1,33 @@
711+/*
712+ * Copyright 2013 Canonical Ltd.
713+ *
714+ * This library is free software; you can redistribute it and/or
715+ * modify it under the terms of version 3 of the GNU Lesser General Public
716+ * License as published by the Free Software Foundation.
717+ *
718+ * This program is distributed in the hope that it will be useful,
719+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
720+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
721+ * General Public License for more details.
722+ *
723+ * You should have received a copy of the GNU Lesser General Public
724+ * License along with this library; if not, write to the
725+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
726+ * Boston, MA 02110-1301, USA.
727+ */
728+
729+#include <QDBusError>
730+#include "error.h"
731+
732+namespace Ubuntu {
733+
734+namespace DownloadManager {
735+
736+Error::Error(QDBusError err, QObject *parent)
737+ : QObject(parent) {
738+ Q_UNUSED(err);
739+}
740+
741+} // DownloadManager
742+
743+} // Ubuntu
744
745=== added file 'ubuntu-download-manager-client/ubuntu/download_manager/error.h'
746--- ubuntu-download-manager-client/ubuntu/download_manager/error.h 1970-01-01 00:00:00 +0000
747+++ ubuntu-download-manager-client/ubuntu/download_manager/error.h 2014-01-22 15:16:38 +0000
748@@ -0,0 +1,43 @@
749+/*
750+ * Copyright 2013 Canonical Ltd.
751+ *
752+ * This library is free software; you can redistribute it and/or
753+ * modify it under the terms of version 3 of the GNU Lesser General Public
754+ * License as published by the Free Software Foundation.
755+ *
756+ * This program is distributed in the hope that it will be useful,
757+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
758+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
759+ * General Public License for more details.
760+ *
761+ * You should have received a copy of the GNU Lesser General Public
762+ * License along with this library; if not, write to the
763+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
764+ * Boston, MA 02110-1301, USA.
765+ */
766+
767+#ifndef UBUNTU_DOWNLOADMANAGER_CLIENT_ERROR_H
768+#define UBUNTU_DOWNLOADMANAGER_CLIENT_ERROR_H
769+
770+#include <QObject>
771+#include "ubuntu-download-manager-client_global.h"
772+
773+class QDBusError;
774+
775+namespace Ubuntu {
776+
777+namespace DownloadManager {
778+
779+class UBUNTUDOWNLOADMANAGERCLIENTSHARED_EXPORT Error : public QObject {
780+ Q_OBJECT
781+
782+public:
783+ Error(QDBusError err, QObject *parent = 0);
784+
785+};
786+
787+} // DownloadManager
788+
789+} // Ubuntu
790+
791+#endif // ERROR_H
792
793=== added file 'ubuntu-download-manager-client/ubuntu/download_manager/group_download.cpp'
794--- ubuntu-download-manager-client/ubuntu/download_manager/group_download.cpp 1970-01-01 00:00:00 +0000
795+++ ubuntu-download-manager-client/ubuntu/download_manager/group_download.cpp 2014-01-22 15:16:38 +0000
796@@ -0,0 +1,57 @@
797+/*
798+ * Copyright 2013 Canonical Ltd.
799+ *
800+ * This library is free software; you can redistribute it and/or
801+ * modify it under the terms of version 3 of the GNU Lesser General Public
802+ * License as published by the Free Software Foundation.
803+ *
804+ * This program is distributed in the hope that it will be useful,
805+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
806+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
807+ * General Public License for more details.
808+ *
809+ * You should have received a copy of the GNU Lesser General Public
810+ * License along with this library; if not, write to the
811+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
812+ * Boston, MA 02110-1301, USA.
813+ */
814+
815+#include "error.h"
816+#include "group_download.h"
817+
818+namespace Ubuntu {
819+
820+namespace DownloadManager {
821+
822+GroupDownload::GroupDownload(Error* err, QObject* parent)
823+ : QObject(parent),
824+ _error(err) {
825+ // TODO(mandel): complete implementation
826+ Q_UNUSED(err);
827+}
828+
829+GroupDownload::GroupDownload(QDBusObjectPath path, QObject *parent)
830+ : QObject(parent) {
831+ // TODO(mandel): complete implementation
832+ Q_UNUSED(path);
833+}
834+
835+GroupDownload::~GroupDownload() {
836+ delete _error;
837+}
838+
839+bool
840+GroupDownload::isError() {
841+ // TODO(mandel): complete implementation
842+ return false;
843+}
844+
845+Error*
846+GroupDownload::error() {
847+ // TODO(mandel): complete implementation
848+ return NULL;
849+}
850+
851+} // DownloadManager
852+
853+} // Ubuntu
854
855=== added file 'ubuntu-download-manager-client/ubuntu/download_manager/group_download.h'
856--- ubuntu-download-manager-client/ubuntu/download_manager/group_download.h 1970-01-01 00:00:00 +0000
857+++ ubuntu-download-manager-client/ubuntu/download_manager/group_download.h 2014-01-22 15:16:38 +0000
858@@ -0,0 +1,63 @@
859+/*
860+ * Copyright 2013 Canonical Ltd.
861+ *
862+ * This library is free software; you can redistribute it and/or
863+ * modify it under the terms of version 3 of the GNU Lesser General Public
864+ * License as published by the Free Software Foundation.
865+ *
866+ * This program is distributed in the hope that it will be useful,
867+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
868+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
869+ * General Public License for more details.
870+ *
871+ * You should have received a copy of the GNU Lesser General Public
872+ * License along with this library; if not, write to the
873+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
874+ * Boston, MA 02110-1301, USA.
875+ */
876+
877+#ifndef UBUNTU_DOWNLOADMANAGER_CLIENT_GROUP_DOWNLOAD_H
878+#define UBUNTU_DOWNLOADMANAGER_CLIENT_GROUP_DOWNLOAD_H
879+
880+#include <QDBusObjectPath>
881+#include <QObject>
882+#include "ubuntu-download-manager-client_global.h"
883+
884+namespace Ubuntu {
885+
886+namespace DownloadManager {
887+
888+class Error;
889+class ManagerPrivate;
890+class GroupDownloadPrivate;
891+class UBUNTUDOWNLOADMANAGERCLIENTSHARED_EXPORT GroupDownload : public QObject {
892+ Q_OBJECT
893+ Q_DECLARE_PRIVATE(GroupDownload)
894+
895+ // allow the manager to create downloads
896+ friend class ManagerPrivate;
897+ friend class GroupManagerPendingCallWatcher;
898+
899+ public:
900+
901+ virtual ~GroupDownload();
902+ bool isError();
903+ Error* error();
904+
905+ protected:
906+ GroupDownload(Error* err, QObject* parent = 0);
907+ GroupDownload(QDBusObjectPath path, QObject* parent = 0);
908+
909+ private:
910+ // TODO(mandel): move this to pimpl, here to ensure no mem leaks atm
911+ Error* _error = NULL;
912+ // use pimpl pattern so that users do not have to be recompiled
913+ GroupDownloadPrivate* d_ptr;
914+
915+};
916+
917+} // DownloadManager
918+
919+} // Ubuntu
920+
921+#endif // GROUP_DOWNLOAD_H
922
923=== modified file 'ubuntu-download-manager-client/ubuntu/download_manager/manager.cpp'
924--- ubuntu-download-manager-client/ubuntu/download_manager/manager.cpp 2013-12-04 10:51:41 +0000
925+++ ubuntu-download-manager-client/ubuntu/download_manager/manager.cpp 2014-01-22 15:16:38 +0000
926@@ -1,5 +1,5 @@
927 /*
928- * Copyright 2013 Canonical Ltd.
929+ * Copyright 2013-2014 Canonical Ltd.
930 *
931 * This library is free software; you can redistribute it and/or
932 * modify it under the terms of version 3 of the GNU Lesser General Public
933@@ -16,9 +16,20 @@
934 * Boston, MA 02110-1301, USA.
935 */
936
937+#include <QDBusObjectPath>
938+#include <ubuntu/download_manager/system/dbus_connection.h>
939+#include "download.h"
940+#include "error.h"
941+#include "group_download.h"
942+#include "manager_interface.h"
943+#include "manager_pendingcall_watcher.h"
944 #include "manager.h"
945
946
947+#define DOWNLOAD_SERVICE "com.canonical.applications.Downloader"
948+#define MANAGER_PATH "/"
949+
950+
951 namespace Ubuntu {
952
953 namespace DownloadManager {
954@@ -31,31 +42,98 @@
955 Q_DECLARE_PUBLIC(Manager)
956
957 public:
958- explicit ManagerPrivate(Manager* parent)
959+ ManagerPrivate(QDBusConnection conn, const QString& path, Manager* parent)
960 : q_ptr(parent) {
961+ _dbusInterface = new ManagerInterface(path, MANAGER_PATH,
962+ conn);
963+ }
964+
965+ // used for testing purposes
966+ ManagerPrivate(ManagerInterface* interface, Manager* parent)
967+ : _dbusInterface(interface),
968+ q_ptr(parent) {
969+ }
970+
971+ ~ManagerPrivate() {
972+ delete _dbusInterface;
973 }
974
975 Download* createDownload(DownloadStruct downStruct) {
976- Q_UNUSED(downStruct);
977- return NULL;
978- }
979-
980- void createDownload(DownloadStruct downStruct, DownloadCreationCb cb) {
981- Q_UNUSED(downStruct);
982- Q_UNUSED(cb);
983- }
984-
985- GroupDownload* createDownload(GroupDownloadStruct groupStruct) {
986- Q_UNUSED(groupStruct);
987- return NULL;
988- }
989-
990- void createDownload(GroupDownloadStruct groupStruct, GroupCreationCb cb) {
991- Q_UNUSED(groupStruct);
992- Q_UNUSED(cb);
993+ Q_Q(Manager);
994+ QDBusPendingReply<QDBusObjectPath> reply =
995+ _dbusInterface->createDownload(downStruct);
996+ // blocking other method should be used
997+ reply.waitForFinished();
998+ if (reply.isError()) {
999+ auto err = new Error(reply.error());
1000+ return new Download(err);
1001+ } else {
1002+ auto path = reply.value();
1003+ auto down = new Download(path, q);
1004+ emit q->downloadCreated(down);
1005+ return down;
1006+ }
1007+ }
1008+
1009+ void createDownload(DownloadStruct downStruct,
1010+ DownloadCb cb,
1011+ DownloadCb errCb) {
1012+ Q_Q(Manager);
1013+ QDBusPendingCall call =
1014+ _dbusInterface->createDownload(downStruct);
1015+ auto watcher = new DownloadManagerPendingCallWatcher(call, cb, errCb,
1016+ static_cast<QObject*>(q));
1017+ q->connect(watcher, SIGNAL(callbackExecuted()),
1018+ q, SLOT(onWatcherDone()));
1019+ }
1020+
1021+ GroupDownload* createDownload(StructList downs,
1022+ const QString& algorithm,
1023+ bool allowed3G,
1024+ const QVariantMap& metadata,
1025+ StringMap headers) {
1026+ Q_Q(Manager);
1027+ QDBusPendingReply<QDBusObjectPath> reply =
1028+ _dbusInterface->createDownloadGroup(downs,
1029+ algorithm, allowed3G, metadata, headers);
1030+ // blocking other method should be used
1031+ reply.waitForFinished();
1032+ if (reply.isError()) {
1033+ Error* err = new Error(reply.error());
1034+ return new GroupDownload(err);
1035+ } else {
1036+ auto path = reply.value();
1037+ auto down = new GroupDownload(path, q);
1038+ emit q->groupCreated(down);
1039+ return down;
1040+ }
1041+ }
1042+
1043+ void createDownload(StructList downs,
1044+ const QString& algorithm,
1045+ bool allowed3G,
1046+ const QVariantMap& metadata,
1047+ StringMap headers,
1048+ GroupCb cb,
1049+ GroupCb errCb) {
1050+ Q_Q(Manager);
1051+ QDBusPendingCall call =
1052+ _dbusInterface->createDownloadGroup(downs,
1053+ algorithm, allowed3G, metadata, headers);
1054+ auto watcher = new GroupManagerPendingCallWatcher(call, cb, errCb,
1055+ static_cast<QObject*>(q));
1056+ q->connect(watcher, SIGNAL(callbackExecuted()),
1057+ q, SLOT(onWatcherDone()));
1058+ }
1059+
1060+ void onWatcherDone() {
1061+ Q_Q(Manager);
1062+ auto senderObj = q->sender();
1063+ senderObj->deleteLater();
1064 }
1065
1066 private:
1067+ ManagerInterface* _dbusInterface;
1068 Manager* q_ptr;
1069 };
1070
1071@@ -63,8 +141,36 @@
1072 * PUBLIC IMPLEMENTATION
1073 */
1074
1075-Manager::Manager(QObject* parent)
1076- : QObject(parent){
1077+Manager::Manager(QDBusConnection conn, const QString& path, QObject* parent)
1078+ : QObject(parent),
1079+ d_ptr(new ManagerPrivate(conn, path, this)){
1080+}
1081+
1082+Manager::Manager(ManagerInterface* interface, QObject* parent)
1083+ : QObject(parent),
1084+ d_ptr(new ManagerPrivate(interface, this)) {
1085+}
1086+
1087+Manager::~Manager() {
1088+ delete d_ptr;
1089+}
1090+
1091+Manager*
1092+Manager::createSessionManager(const QString& path, QObject* parent) {
1093+ if (path.isEmpty()) {
1094+ return new Manager(QDBusConnection::sessionBus(), DOWNLOAD_SERVICE, parent);
1095+ } else {
1096+ return new Manager(QDBusConnection::sessionBus(), path, parent);
1097+ }
1098+}
1099+
1100+Manager*
1101+Manager::createSystemManager(const QString& path, QObject* parent) {
1102+ if (path.isEmpty()) {
1103+ return new Manager(QDBusConnection::systemBus(), DOWNLOAD_SERVICE, parent);
1104+ } else {
1105+ return new Manager(QDBusConnection::systemBus(), path, parent);
1106+ }
1107 }
1108
1109 Download*
1110@@ -74,21 +180,34 @@
1111 }
1112
1113 void
1114-Manager::createDownload(DownloadStruct downStruct, DownloadCreationCb cb) {
1115+Manager::createDownload(DownloadStruct downStruct,
1116+ DownloadCb cb,
1117+ DownloadCb errCb) {
1118 Q_D(Manager);
1119- d->createDownload(downStruct, cb);
1120+ d->createDownload(downStruct, cb, errCb);
1121 }
1122
1123 GroupDownload*
1124-Manager::createDownload(GroupDownloadStruct groupStruct) {
1125+Manager::createDownload(StructList downs,
1126+ const QString &algorithm,
1127+ bool allowed3G,
1128+ const QVariantMap &metadata,
1129+ StringMap headers) {
1130 Q_D(Manager);
1131- return d->createDownload(groupStruct);
1132+ return d->createDownload(downs, algorithm, allowed3G, metadata, headers);
1133 }
1134
1135 void
1136-Manager::createDownload(GroupDownloadStruct groupStruct, GroupCreationCb cb) {
1137+Manager::createDownload(StructList downs,
1138+ const QString& algorithm,
1139+ bool allowed3G,
1140+ const QVariantMap& metadata,
1141+ StringMap headers,
1142+ GroupCb cb,
1143+ GroupCb errCb) {
1144 Q_D(Manager);
1145- d->createDownload(groupStruct, cb);
1146+ d->createDownload(downs, algorithm, allowed3G, metadata, headers, cb,
1147+ errCb);
1148 }
1149
1150 } // DownloadManager
1151
1152=== modified file 'ubuntu-download-manager-client/ubuntu/download_manager/manager.h'
1153--- ubuntu-download-manager-client/ubuntu/download_manager/manager.h 2013-12-04 10:51:41 +0000
1154+++ ubuntu-download-manager-client/ubuntu/download_manager/manager.h 2014-01-22 15:16:38 +0000
1155@@ -1,5 +1,5 @@
1156 /*
1157- * Copyright 2013 Canonical Ltd.
1158+ * Copyright 2013-2014 Canonical Ltd.
1159 *
1160 * This library is free software; you can redistribute it and/or
1161 * modify it under the terms of version 3 of the GNU Lesser General Public
1162@@ -20,7 +20,10 @@
1163 #define UBUNTU_DOWNLOADMANAGER_CLIENT_MANAGER_H
1164
1165 #include <functional>
1166+#include <QList>
1167+#include <QDBusConnection>
1168 #include <QObject>
1169+#include <ubuntu/download_manager/metatypes.h>
1170 #include <ubuntu/download_manager/download_struct.h>
1171 #include <ubuntu/download_manager/group_download_struct.h>
1172 #include "ubuntu-download-manager-client_global.h"
1173@@ -30,28 +33,56 @@
1174 namespace DownloadManager {
1175
1176 class Download;
1177+class Error;
1178 class GroupDownload;
1179+class ManagerInterface;
1180
1181-typedef std::function<void(Download*)> DownloadCreationCb;
1182-typedef std::function<void(GroupDownload*)> GroupCreationCb;
1183+typedef std::function<void(Download*)> DownloadCb;
1184+typedef std::function<void(GroupDownload*)> GroupCb;
1185
1186 class ManagerPrivate;
1187 class UBUNTUDOWNLOADMANAGERCLIENTSHARED_EXPORT Manager : public QObject {
1188 Q_DECLARE_PRIVATE(Manager)
1189 Q_OBJECT
1190
1191+ // allow watchers to emit the signals
1192+ friend class DownloadManagerPendingCallWatcher;
1193+ friend class GroupManagerPendingCallWatcher;
1194+
1195 public:
1196- explicit Manager(QObject* parent);
1197-
1198+ virtual ~Manager();
1199 virtual Download* createDownload(DownloadStruct downStruct);
1200- virtual void createDownload(DownloadStruct downStruct, DownloadCreationCb cb);
1201- virtual GroupDownload* createDownload(GroupDownloadStruct groupStruct);
1202- virtual void createDownload(GroupDownloadStruct groupStruct, GroupCreationCb cb);
1203+ virtual void createDownload(DownloadStruct downStruct,
1204+ DownloadCb cb,
1205+ DownloadCb errCb);
1206+ virtual GroupDownload* createDownload(StructList downs,
1207+ const QString &algorithm,
1208+ bool allowed3G,
1209+ const QVariantMap &metadata,
1210+ StringMap headers);
1211+ virtual void createDownload(StructList downs,
1212+ const QString &algorithm,
1213+ bool allowed3G,
1214+ const QVariantMap &metadata,
1215+ StringMap headers,
1216+ GroupCb cb,
1217+ GroupCb errCb);
1218+
1219+ static Manager* createSessionManager(const QString& path = "", QObject* parent=0);
1220+ static Manager* createSystemManager(const QString& path = "", QObject* parent=0);
1221
1222 signals:
1223 void downloadCreated(Download* down);
1224 void groupCreated(GroupDownload* down);
1225
1226+ protected:
1227+ Manager(QDBusConnection conn, const QString& path = "", QObject* parent= 0);
1228+ // used for testing purposes
1229+ Manager(ManagerInterface* interface, QObject* parent);
1230+
1231+ private:
1232+ Q_PRIVATE_SLOT(d_func(), void onWatcherDone())
1233+
1234 private:
1235 // use pimpl pattern so that users do not have to be recompiled
1236 ManagerPrivate* d_ptr;
1237
1238=== added file 'ubuntu-download-manager-client/ubuntu/download_manager/manager_interface.cpp'
1239--- ubuntu-download-manager-client/ubuntu/download_manager/manager_interface.cpp 1970-01-01 00:00:00 +0000
1240+++ ubuntu-download-manager-client/ubuntu/download_manager/manager_interface.cpp 2014-01-22 15:16:38 +0000
1241@@ -0,0 +1,33 @@
1242+/*
1243+ * This file was generated by qdbusxml2cpp version 0.8
1244+ * Command line was: qdbusxml2cpp com.canonical.applications.download_manager.xml -p manager_interface -c ManagerInterface
1245+ *
1246+ * qdbusxml2cpp is Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
1247+ *
1248+ * This is an auto-generated file.
1249+ * This file may have been hand-edited. Look for HAND-EDIT comments
1250+ * before re-generating it.
1251+ */
1252+
1253+#include "manager_interface.h"
1254+
1255+/*
1256+ * Implementation of interface class ManagerInterface
1257+ */
1258+
1259+namespace Ubuntu {
1260+
1261+namespace DownloadManager {
1262+
1263+ManagerInterface::ManagerInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
1264+ : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
1265+{
1266+}
1267+
1268+ManagerInterface::~ManagerInterface()
1269+{
1270+}
1271+
1272+} // Ubuntu
1273+
1274+} // DownloadManager
1275
1276=== added file 'ubuntu-download-manager-client/ubuntu/download_manager/manager_interface.h'
1277--- ubuntu-download-manager-client/ubuntu/download_manager/manager_interface.h 1970-01-01 00:00:00 +0000
1278+++ ubuntu-download-manager-client/ubuntu/download_manager/manager_interface.h 2014-01-22 15:16:38 +0000
1279@@ -0,0 +1,111 @@
1280+/*
1281+ * This file was generated by qdbusxml2cpp version 0.8
1282+ * Command line was: qdbusxml2cpp com.canonical.applications.download_manager.xml -p manager_interface -c ManagerInterface
1283+ *
1284+ * qdbusxml2cpp is Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
1285+ *
1286+ * This is an auto-generated file.
1287+ * Do not edit! All changes made to it will be lost.
1288+ */
1289+
1290+#ifndef MANAGER_INTERFACE_H_1386155846
1291+#define MANAGER_INTERFACE_H_1386155846
1292+
1293+#include <QtCore/QObject>
1294+#include <QtCore/QByteArray>
1295+#include <QtCore/QList>
1296+#include <QtCore/QMap>
1297+#include <QtCore/QString>
1298+#include <QtCore/QStringList>
1299+#include <QtCore/QVariant>
1300+#include <QtDBus/QtDBus>
1301+#include <ubuntu/download_manager/metatypes.h>
1302+
1303+namespace Ubuntu {
1304+
1305+namespace DownloadManager {
1306+
1307+/*
1308+ * Proxy class for interface com.canonical.applications.DownloadManager
1309+ */
1310+class ManagerInterface: public QDBusAbstractInterface
1311+{
1312+ Q_OBJECT
1313+public:
1314+ static inline const char *staticInterfaceName()
1315+ { return "com.canonical.applications.DownloadManager"; }
1316+
1317+public:
1318+ ManagerInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
1319+
1320+ ~ManagerInterface();
1321+
1322+public Q_SLOTS: // METHODS
1323+ inline QDBusPendingReply<> allowGSMDownload(bool allowed)
1324+ {
1325+ QList<QVariant> argumentList;
1326+ argumentList << QVariant::fromValue(allowed);
1327+ return asyncCallWithArgumentList(QLatin1String("allowGSMDownload"), argumentList);
1328+ }
1329+
1330+ inline QDBusPendingReply<QDBusObjectPath> createDownload(DownloadStruct download)
1331+ {
1332+ QList<QVariant> argumentList;
1333+ argumentList << QVariant::fromValue(download);
1334+ return asyncCallWithArgumentList(QLatin1String("createDownload"), argumentList);
1335+ }
1336+
1337+ inline QDBusPendingReply<QDBusObjectPath> createDownloadGroup(StructList downloads, const QString &algorithm, bool allowed3G, const QVariantMap &metadata, StringMap headers)
1338+ {
1339+ QList<QVariant> argumentList;
1340+ argumentList << QVariant::fromValue(downloads) << QVariant::fromValue(algorithm) << QVariant::fromValue(allowed3G) << QVariant::fromValue(metadata) << QVariant::fromValue(headers);
1341+ return asyncCallWithArgumentList(QLatin1String("createDownloadGroup"), argumentList);
1342+ }
1343+
1344+ inline QDBusPendingReply<qulonglong> defaultThrottle()
1345+ {
1346+ QList<QVariant> argumentList;
1347+ return asyncCallWithArgumentList(QLatin1String("defaultThrottle"), argumentList);
1348+ }
1349+
1350+ inline QDBusPendingReply<> exit()
1351+ {
1352+ QList<QVariant> argumentList;
1353+ return asyncCallWithArgumentList(QLatin1String("exit"), argumentList);
1354+ }
1355+
1356+ inline QDBusPendingReply<QList<QDBusObjectPath> > getAllDownloads()
1357+ {
1358+ QList<QVariant> argumentList;
1359+ return asyncCallWithArgumentList(QLatin1String("getAllDownloads"), argumentList);
1360+ }
1361+
1362+ inline QDBusPendingReply<QList<QDBusObjectPath> > getAllDownloadsWithMetadata(const QString &name, const QString &value)
1363+ {
1364+ QList<QVariant> argumentList;
1365+ argumentList << QVariant::fromValue(name) << QVariant::fromValue(value);
1366+ return asyncCallWithArgumentList(QLatin1String("getAllDownloadsWithMetadata"), argumentList);
1367+ }
1368+
1369+ inline QDBusPendingReply<bool> isGSMDownloadAllowed()
1370+ {
1371+ QList<QVariant> argumentList;
1372+ return asyncCallWithArgumentList(QLatin1String("isGSMDownloadAllowed"), argumentList);
1373+ }
1374+
1375+ inline QDBusPendingReply<> setDefaultThrottle(qulonglong speed)
1376+ {
1377+ QList<QVariant> argumentList;
1378+ argumentList << QVariant::fromValue(speed);
1379+ return asyncCallWithArgumentList(QLatin1String("setDefaultThrottle"), argumentList);
1380+ }
1381+
1382+Q_SIGNALS: // SIGNALS
1383+ void downloadCreated(const QDBusObjectPath &path);
1384+};
1385+
1386+} // DownloadManager
1387+
1388+} // Ubuntu
1389+
1390+#endif
1391
1392=== added file 'ubuntu-download-manager-client/ubuntu/download_manager/manager_pendingcall_watcher.cpp'
1393--- ubuntu-download-manager-client/ubuntu/download_manager/manager_pendingcall_watcher.cpp 1970-01-01 00:00:00 +0000
1394+++ ubuntu-download-manager-client/ubuntu/download_manager/manager_pendingcall_watcher.cpp 2014-01-22 15:16:38 +0000
1395@@ -0,0 +1,102 @@
1396+/*
1397+ * Copyright 2013 Canonical Ltd.
1398+ *
1399+ * This library is free software; you can redistribute it and/or
1400+ * modify it under the terms of version 3 of the GNU Lesser General Public
1401+ * License as published by the Free Software Foundation.
1402+ *
1403+ * This program is distributed in the hope that it will be useful,
1404+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1405+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1406+ * General Public License for more details.
1407+ *
1408+ * You should have received a copy of the GNU Lesser General Public
1409+ * License along with this library; if not, write to the
1410+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
1411+ * Boston, MA 02110-1301, USA.
1412+ */
1413+
1414+#include <QDebug>
1415+#include <QDBusPendingReply>
1416+#include <QDBusObjectPath>
1417+#include "download.h"
1418+#include "error.h"
1419+#include "group_download.h"
1420+#include "manager.h"
1421+#include "manager_pendingcall_watcher.h"
1422+
1423+namespace Ubuntu {
1424+
1425+namespace DownloadManager {
1426+
1427+
1428+DownloadManagerPendingCallWatcher::DownloadManagerPendingCallWatcher(
1429+ const QDBusPendingCall& call,
1430+ DownloadCb cb,
1431+ DownloadCb errCb,
1432+ QObject* parent)
1433+ : QDBusPendingCallWatcher(call, parent),
1434+ _cb(cb),
1435+ _errCb(errCb) {
1436+ connect(this, &QDBusPendingCallWatcher::finished,
1437+ this, &DownloadManagerPendingCallWatcher::onFinished);
1438+}
1439+
1440+void
1441+DownloadManagerPendingCallWatcher::onFinished(QDBusPendingCallWatcher* watcher) {
1442+ QDBusPendingReply<QDBusObjectPath> reply = *watcher;
1443+ auto man = static_cast<Manager*>(parent());
1444+ if (reply.isError()) {
1445+ qDebug() << "ERROR" << reply.error() << reply.error().type();
1446+ // creater error and deal with it
1447+ auto err = new Error(reply.error());
1448+ auto down = new Download(err);
1449+ _errCb(down);
1450+ emit man->downloadCreated(down);
1451+ } else {
1452+ qDebug() << "Success!";
1453+ auto path = reply.value();
1454+ auto down = new Download(path);
1455+ emit man->downloadCreated(down);
1456+ _cb(down);
1457+ }
1458+ emit callbackExecuted();
1459+ watcher->deleteLater();
1460+}
1461+
1462+
1463+GroupManagerPendingCallWatcher::GroupManagerPendingCallWatcher(
1464+ const QDBusPendingCall& call,
1465+ GroupCb cb,
1466+ GroupCb errCb,
1467+ QObject* parent)
1468+ : QDBusPendingCallWatcher(call, parent),
1469+ _cb(cb),
1470+ _errCb(errCb) {
1471+ connect(this, &QDBusPendingCallWatcher::finished,
1472+ this, &GroupManagerPendingCallWatcher::onFinished);
1473+}
1474+
1475+void
1476+GroupManagerPendingCallWatcher::onFinished(QDBusPendingCallWatcher* watcher) {
1477+ QDBusPendingReply<QDBusObjectPath> reply = *watcher;
1478+ auto man = static_cast<Manager*>(parent());
1479+ if (reply.isError()) {
1480+ // creater error and deal with it
1481+ auto err = new Error(reply.error());
1482+ auto down = new GroupDownload(err);
1483+ _errCb(down);
1484+ emit man->groupCreated(down);
1485+ } else {
1486+ QDBusObjectPath path = reply.value();
1487+ auto down = new GroupDownload(path);
1488+ emit man->groupCreated(down);
1489+ _cb(down);
1490+ }
1491+ emit callbackExecuted();
1492+ watcher->deleteLater();
1493+}
1494+
1495+} // DownloadManager
1496+
1497+} // Ubuntu
1498
1499=== added file 'ubuntu-download-manager-client/ubuntu/download_manager/manager_pendingcall_watcher.h'
1500--- ubuntu-download-manager-client/ubuntu/download_manager/manager_pendingcall_watcher.h 1970-01-01 00:00:00 +0000
1501+++ ubuntu-download-manager-client/ubuntu/download_manager/manager_pendingcall_watcher.h 2014-01-22 15:16:38 +0000
1502@@ -0,0 +1,81 @@
1503+/*
1504+ * Copyright 2013 Canonical Ltd.
1505+ *
1506+ * This library is free software; you can redistribute it and/or
1507+ * modify it under the terms of version 3 of the GNU Lesser General Public
1508+ * License as published by the Free Software Foundation.
1509+ *
1510+ * This program is distributed in the hope that it will be useful,
1511+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1512+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1513+ * General Public License for more details.
1514+ *
1515+ * You should have received a copy of the GNU Lesser General Public
1516+ * License along with this library; if not, write to the
1517+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
1518+ * Boston, MA 02110-1301, USA.
1519+ */
1520+
1521+#ifndef UBUNTU_DOWNLOADMANAGER_CLIENT_MANAGER_PENDINGCALL_WATCHER_H
1522+#define UBUNTU_DOWNLOADMANAGER_CLIENT_MANAGER_PENDINGCALL_WATCHER_H
1523+
1524+#include <functional>
1525+#include <QDBusPendingCallWatcher>
1526+
1527+namespace Ubuntu {
1528+
1529+namespace DownloadManager {
1530+
1531+class Download;
1532+class Error;
1533+class GroupDownload;
1534+
1535+typedef std::function<void(Download*)> DownloadCb;
1536+typedef std::function<void(GroupDownload*)> GroupCb;
1537+
1538+class DownloadManagerPendingCallWatcher : public QDBusPendingCallWatcher {
1539+ Q_OBJECT
1540+
1541+ public:
1542+ DownloadManagerPendingCallWatcher(const QDBusPendingCall& call,
1543+ DownloadCb cb,
1544+ DownloadCb errCb,
1545+ QObject* parent = 0);
1546+
1547+ signals:
1548+ void callbackExecuted();
1549+
1550+ private slots:
1551+ void onFinished(QDBusPendingCallWatcher* watcher);
1552+
1553+ private:
1554+ DownloadCb _cb;
1555+ DownloadCb _errCb;
1556+};
1557+
1558+
1559+class GroupManagerPendingCallWatcher : public QDBusPendingCallWatcher {
1560+ Q_OBJECT
1561+
1562+ public:
1563+ GroupManagerPendingCallWatcher(const QDBusPendingCall& call,
1564+ GroupCb cb,
1565+ GroupCb errCb,
1566+ QObject* parent = 0);
1567+
1568+ signals:
1569+ void callbackExecuted();
1570+
1571+ private slots:
1572+ void onFinished(QDBusPendingCallWatcher* watcher);
1573+
1574+ private:
1575+ GroupCb _cb;
1576+ GroupCb _errCb;
1577+};
1578+
1579+} // DownloadManager
1580+
1581+} // Ubuntu
1582+
1583+#endif // UBUNTU_DOWNLOADMANAGER_CLIENT_MANAGER_PENDINGCALL_WATCHER_H
1584
1585=== modified file 'ubuntu-download-manager-common/ubuntu-download-manager-common.pro'
1586--- ubuntu-download-manager-common/ubuntu-download-manager-common.pro 2013-12-03 11:36:40 +0000
1587+++ ubuntu-download-manager-common/ubuntu-download-manager-common.pro 2014-01-22 15:16:38 +0000
1588@@ -12,6 +12,7 @@
1589 SOURCES += \
1590 ubuntu/download_manager/download_struct.cpp \
1591 ubuntu/download_manager/group_download_struct.cpp \
1592+ ubuntu/download_manager/system/dbus_connection.cpp \
1593 ubuntu/download_manager/system/hash_algorithm.cpp
1594
1595 public_headers = \
1596@@ -21,6 +22,7 @@
1597
1598 private_headers = \
1599 ubuntu_download_manager_common_global.h \
1600+ ubuntu/download_manager/system/dbus_connection.h \
1601 ubuntu/download_manager/system/hash_algorithm.h
1602
1603 HEADERS +=\
1604
1605=== renamed file 'ubuntu-download-manager-priv/system/dbus_connection.cpp' => 'ubuntu-download-manager-common/ubuntu/download_manager/system/dbus_connection.cpp'
1606--- ubuntu-download-manager-priv/system/dbus_connection.cpp 2014-01-16 15:42:53 +0000
1607+++ ubuntu-download-manager-common/ubuntu/download_manager/system/dbus_connection.cpp 2014-01-22 15:16:38 +0000
1608@@ -29,12 +29,22 @@
1609 _conn(QDBusConnection::connectToBus(QDBusConnection::ActivationBus, "DBUS")) {
1610 }
1611
1612+DBusConnection::DBusConnection(QDBusConnection conn, QObject* parent)
1613+ : QObject(parent),
1614+ _conn(conn) {
1615+}
1616+
1617 bool
1618 DBusConnection::registerService(const QString& serviceName) {
1619 return _conn.registerService(serviceName);
1620 }
1621
1622 bool
1623+DBusConnection::unregisterService(const QString& serviceName) {
1624+ return _conn.unregisterService(serviceName);
1625+}
1626+
1627+bool
1628 DBusConnection::registerObject(const QString& path,
1629 QObject* object,
1630 QDBusConnection::RegisterOptions options) {
1631
1632=== renamed file 'ubuntu-download-manager-priv/system/dbus_connection.h' => 'ubuntu-download-manager-common/ubuntu/download_manager/system/dbus_connection.h'
1633--- ubuntu-download-manager-priv/system/dbus_connection.h 2014-01-16 15:42:53 +0000
1634+++ ubuntu-download-manager-common/ubuntu/download_manager/system/dbus_connection.h 2014-01-22 15:16:38 +0000
1635@@ -31,9 +31,11 @@
1636 class DBusConnection : public QObject {
1637 Q_OBJECT
1638 public:
1639- explicit DBusConnection(QObject *parent = 0);
1640+ explicit DBusConnection(QObject* parent = 0);
1641+ DBusConnection(QDBusConnection conn, QObject* parent = 0);
1642
1643 virtual bool registerService(const QString& serviceName);
1644+ virtual bool unregisterService(const QString& serviceName);
1645 virtual bool registerObject(const QString& path, QObject* object,
1646 QDBusConnection::RegisterOptions options = QDBusConnection::ExportAdaptors); // NOLINT(whitespace/line_length)
1647 virtual void unregisterObject(const QString& path,
1648
1649=== modified file 'ubuntu-download-manager-priv/downloads/daemon.cpp'
1650--- ubuntu-download-manager-priv/downloads/daemon.cpp 2013-11-28 16:01:44 +0000
1651+++ ubuntu-download-manager-priv/downloads/daemon.cpp 2014-01-22 15:16:38 +0000
1652@@ -1,5 +1,5 @@
1653 /*
1654- * Copyright 2013 Canonical Ltd.
1655+ * Copyright 2013-2014 Canonical Ltd.
1656 *
1657 * This library is free software; you can redistribute it and/or
1658 * modify it under the terms of version 3 of the GNU Lesser General Public
1659@@ -25,6 +25,7 @@
1660 #include "downloads/download_manager_adaptor.h"
1661 #include "system/application.h"
1662 #include "system/logger.h"
1663+#include "system/timer.h"
1664
1665 #define DISABLE_TIMEOUT "-disable-timeout"
1666 #define SELFSIGNED_CERT "-self-signed-certs"
1667@@ -34,6 +35,8 @@
1668
1669 namespace DownloadManager {
1670
1671+namespace Daemon {
1672+
1673 /**
1674 * PRIVATE IMPLEMENATION
1675 */
1676@@ -80,6 +83,9 @@
1677
1678 void enableTimeout(bool enabled) {
1679 _isTimeoutEnabled = enabled;
1680+ if (!_isTimeoutEnabled) {
1681+ _shutDownTimer->stop();
1682+ }
1683 }
1684
1685 bool isStoppable() {
1686@@ -100,11 +106,11 @@
1687
1688 void start(QString path) {
1689 TRACE;
1690+ _path = path;
1691 _downAdaptor = new DownloadManagerAdaptor(_downInterface);
1692- bool ret = _conn->registerService(path);
1693+ bool ret = _conn->registerService(_path);
1694 if (ret) {
1695- qDebug() << "Service registered to"
1696- << "com.canonical.applications.Downloader";
1697+ qDebug() << "Service registered to" << _path;
1698 ret = _conn->registerObject("/", _downInterface);
1699 qDebug() << ret;
1700 if (!ret) {
1701@@ -119,6 +125,14 @@
1702 _app->exit(-1);
1703 }
1704
1705+ void stop() {
1706+ // stop listening in the service
1707+ bool ret = _conn->unregisterService(_path);
1708+ if (!ret) {
1709+ qCritical() << "Could not unregister service at" << _path;
1710+ }
1711+ }
1712+
1713 void onTimeout() {
1714 qDebug() << "Timeout reached, shutdown service.";
1715 _app->exit(0);
1716@@ -194,14 +208,15 @@
1717 }
1718
1719 private:
1720+ QString _path = "";
1721 bool _isTimeoutEnabled = true;
1722 bool _stoppable = false;
1723 QList<QSslCertificate> _certs;
1724- Application* _app;
1725- Timer* _shutDownTimer;
1726- DBusConnection* _conn;
1727- Manager* _downInterface;
1728- DownloadManagerAdaptor* _downAdaptor;
1729+ Application* _app = nullptr;
1730+ Timer* _shutDownTimer = nullptr;
1731+ DBusConnection* _conn = nullptr;
1732+ Manager* _downInterface = nullptr;
1733+ DownloadManagerAdaptor* _downAdaptor = nullptr;
1734 Daemon* q_ptr;
1735 };
1736
1737@@ -269,6 +284,14 @@
1738 d->start(path);
1739 }
1740
1741+void
1742+Daemon::stop() {
1743+ Q_D(Daemon);
1744+ d->stop();
1745+}
1746+
1747+} // Daemon
1748+
1749 } // DownloadManager
1750
1751 } // Ubuntu
1752
1753=== modified file 'ubuntu-download-manager-priv/downloads/daemon.h'
1754--- ubuntu-download-manager-priv/downloads/daemon.h 2013-11-28 16:01:44 +0000
1755+++ ubuntu-download-manager-priv/downloads/daemon.h 2014-01-22 15:16:38 +0000
1756@@ -1,5 +1,5 @@
1757 /*
1758- * Copyright 2013 Canonical Ltd.
1759+ * Copyright 2013-2014 Canonical Ltd.
1760 *
1761 * This library is free software; you can redistribute it and/or
1762 * modify it under the terms of version 3 of the GNU Lesser General Public
1763@@ -22,16 +22,24 @@
1764 #include <QObject>
1765 #include <QSslCertificate>
1766 #include <QSharedPointer>
1767+#include <ubuntu/download_manager/system/dbus_connection.h>
1768 #include "app-downloader-lib_global.h"
1769-#include "downloads/manager.h"
1770-#include "system/application.h"
1771-#include "system/dbus_connection.h"
1772-#include "system/timer.h"
1773
1774 namespace Ubuntu {
1775
1776 namespace DownloadManager {
1777
1778+namespace System {
1779+
1780+class Application;
1781+class DBusConnection;
1782+class Timer;
1783+
1784+}
1785+
1786+namespace Daemon {
1787+
1788+class Manager;
1789 class DaemonPrivate;
1790 class APPDOWNLOADERLIBSHARED_EXPORT Daemon : public QObject {
1791 Q_DECLARE_PRIVATE(Daemon)
1792@@ -39,9 +47,9 @@
1793
1794 public:
1795 explicit Daemon(QObject *parent = 0);
1796- Daemon(Application* app,
1797- DBusConnection* conn,
1798- Timer* timer,
1799+ Daemon(System::Application* app,
1800+ System::DBusConnection* conn,
1801+ System::Timer* timer,
1802 Manager* man,
1803 QObject *parent = 0);
1804 virtual ~Daemon();
1805@@ -57,6 +65,7 @@
1806
1807 public slots: // NOLINT (whitespace/indent)
1808 void start(QString path="com.canonical.applications.Downloader");
1809+ void stop();
1810
1811 private:
1812 Q_PRIVATE_SLOT(d_func(), void onTimeout())
1813@@ -67,6 +76,8 @@
1814 DaemonPrivate* d_ptr;
1815 };
1816
1817+} // Daemon
1818+
1819 } // DownloadManager
1820
1821 } // Ubuntu
1822
1823=== modified file 'ubuntu-download-manager-priv/downloads/download.cpp'
1824--- ubuntu-download-manager-priv/downloads/download.cpp 2013-12-20 22:57:15 +0000
1825+++ ubuntu-download-manager-priv/downloads/download.cpp 2014-01-22 15:16:38 +0000
1826@@ -1,5 +1,5 @@
1827 /*
1828- * Copyright 2013 Canonical Ltd.
1829+ * Copyright 2013-2014 Canonical Ltd.
1830 *
1831 * This library is free software; you can redistribute it and/or
1832 * modify it under the terms of version 3 of the GNU Lesser General Public
1833@@ -25,6 +25,8 @@
1834
1835 namespace DownloadManager {
1836
1837+namespace Daemon {
1838+
1839 Download::Download(const QString& id,
1840 const QString& path,
1841 bool isConfined,
1842@@ -125,6 +127,8 @@
1843 emit error(errorStr);
1844 }
1845
1846+} // Daemon
1847+
1848 } // DownloadManager
1849
1850 } // Ubuntu
1851
1852=== modified file 'ubuntu-download-manager-priv/downloads/download.h'
1853--- ubuntu-download-manager-priv/downloads/download.h 2013-11-27 12:26:15 +0000
1854+++ ubuntu-download-manager-priv/downloads/download.h 2014-01-22 15:16:38 +0000
1855@@ -1,5 +1,5 @@
1856 /*
1857- * Copyright 2013 Canonical Ltd.
1858+ * Copyright 2013-2014 Canonical Ltd.
1859 *
1860 * This library is free software; you can redistribute it and/or
1861 * modify it under the terms of version 3 of the GNU Lesser General Public
1862@@ -35,6 +35,8 @@
1863
1864 using namespace System;
1865
1866+namespace Daemon {
1867+
1868 class Download : public QObject {
1869 Q_OBJECT
1870
1871@@ -175,6 +177,8 @@
1872 QObject* _adaptor = NULL;
1873 };
1874
1875+} // Daemon
1876+
1877 } // DownloadManager
1878
1879 } // Ubuntu
1880
1881=== modified file 'ubuntu-download-manager-priv/downloads/download_manager_adaptor.cpp'
1882--- ubuntu-download-manager-priv/downloads/download_manager_adaptor.cpp 2013-10-25 11:44:53 +0000
1883+++ ubuntu-download-manager-priv/downloads/download_manager_adaptor.cpp 2014-01-22 15:16:38 +0000
1884@@ -21,6 +21,8 @@
1885
1886 namespace DownloadManager {
1887
1888+namespace Daemon {
1889+
1890 /*
1891 * Implementation of adaptor class DownloadManagerAdaptor
1892 */
1893@@ -103,6 +105,8 @@
1894 QMetaObject::invokeMethod(parent(), "setDefaultThrottle", Q_ARG(qulonglong, speed));
1895 }
1896
1897+} // Daemon
1898+
1899 } // DownloadManager
1900
1901 } // Ubuntu
1902
1903=== modified file 'ubuntu-download-manager-priv/downloads/download_manager_adaptor.h'
1904--- ubuntu-download-manager-priv/downloads/download_manager_adaptor.h 2013-11-12 12:30:18 +0000
1905+++ ubuntu-download-manager-priv/downloads/download_manager_adaptor.h 2014-01-22 15:16:38 +0000
1906@@ -29,6 +29,8 @@
1907
1908 namespace DownloadManager {
1909
1910+namespace Daemon {
1911+
1912 /*
1913 * Adaptor class for interface com.canonical.applications.DownloadManager
1914 */
1915@@ -99,6 +101,8 @@
1916 void downloadCreated(const QDBusObjectPath &path);
1917 };
1918
1919+} // Daemon
1920+
1921 } // DownloadManager
1922
1923 } // Ubuntu
1924
1925=== modified file 'ubuntu-download-manager-priv/downloads/downloads_db.cpp'
1926--- ubuntu-download-manager-priv/downloads/downloads_db.cpp 2014-01-16 15:42:53 +0000
1927+++ ubuntu-download-manager-priv/downloads/downloads_db.cpp 2014-01-22 15:16:38 +0000
1928@@ -84,6 +84,8 @@
1929
1930 namespace DownloadManager {
1931
1932+namespace Daemon {
1933+
1934 DownloadsDb::DownloadsDb(QObject* parent)
1935 : QObject(parent) {
1936 _fileManager = FileManager::instance();
1937@@ -262,6 +264,7 @@
1938 return success;
1939 }
1940
1941+} // Daemon
1942
1943 } // DownloadManager
1944
1945
1946=== modified file 'ubuntu-download-manager-priv/downloads/downloads_db.h'
1947--- ubuntu-download-manager-priv/downloads/downloads_db.h 2014-01-16 15:42:53 +0000
1948+++ ubuntu-download-manager-priv/downloads/downloads_db.h 2014-01-22 15:16:38 +0000
1949@@ -28,6 +28,8 @@
1950
1951 namespace DownloadManager {
1952
1953+namespace Daemon {
1954+
1955 class DownloadsDb : public QObject {
1956 Q_OBJECT
1957
1958@@ -53,6 +55,8 @@
1959 QSqlDatabase _db;
1960 };
1961
1962+} // Daemon
1963+
1964 } // DownloadManager
1965
1966 } // Ubuntu
1967
1968=== modified file 'ubuntu-download-manager-priv/downloads/factory.cpp'
1969--- ubuntu-download-manager-priv/downloads/factory.cpp 2013-11-28 15:31:10 +0000
1970+++ ubuntu-download-manager-priv/downloads/factory.cpp 2014-01-22 15:16:38 +0000
1971@@ -1,5 +1,5 @@
1972 /*
1973- * Copyright 2013 Canonical Ltd.
1974+ * Copyright 2013-2014 Canonical Ltd.
1975 *
1976 * This library is free software; you can redistribute it and/or
1977 * modify it under the terms of version 3 of the GNU Lesser General Public
1978@@ -30,10 +30,7 @@
1979
1980 namespace DownloadManager {
1981
1982-/*
1983- * PRIVATE IMPLEMENTATION
1984- */
1985-
1986+namespace Daemon {
1987
1988 Factory::Factory(QObject* parent)
1989 : QObject(parent) {
1990@@ -179,6 +176,8 @@
1991 RequestFactory::instance()->setAcceptedCertificates(certs);
1992 }
1993
1994+} // Daemon
1995+
1996 } // DownloadManager
1997
1998 } // Ubuntu
1999
2000=== modified file 'ubuntu-download-manager-priv/downloads/factory.h'
2001--- ubuntu-download-manager-priv/downloads/factory.h 2013-12-02 12:03:18 +0000
2002+++ ubuntu-download-manager-priv/downloads/factory.h 2014-01-22 15:16:38 +0000
2003@@ -1,5 +1,5 @@
2004 /*
2005- * Copyright 2013 Canonical Ltd.
2006+ * Copyright 2013-2014 Canonical Ltd.
2007 *
2008 * This library is free software; you can redistribute it and/or
2009 * modify it under the terms of version 3 of the GNU Lesser General Public
2010@@ -30,6 +30,8 @@
2011
2012 namespace DownloadManager {
2013
2014+namespace Daemon {
2015+
2016 class Factory : public QObject {
2017 Q_OBJECT
2018
2019@@ -93,6 +95,8 @@
2020 AppArmor* _apparmor;
2021 };
2022
2023+} // Daemon
2024+
2025 } // DownloadManager
2026
2027 } // Ubuntu
2028
2029=== modified file 'ubuntu-download-manager-priv/downloads/file_download.cpp'
2030--- ubuntu-download-manager-priv/downloads/file_download.cpp 2014-01-16 17:26:28 +0000
2031+++ ubuntu-download-manager-priv/downloads/file_download.cpp 2014-01-22 15:16:38 +0000
2032@@ -1,5 +1,5 @@
2033 /*
2034- * Copyright 2013 Canonical Ltd.
2035+ * Copyright 2013-2014 Canonical Ltd.
2036 *
2037 * This library is free software; you can redistribute it and/or
2038 * modify it under the terms of version 3 of the GNU Lesser General Public
2039@@ -44,6 +44,8 @@
2040
2041 namespace DownloadManager {
2042
2043+namespace Daemon {
2044+
2045 FileDownload::FileDownload(const QString& id,
2046 const QString& path,
2047 bool isConfined,
2048@@ -571,6 +573,8 @@
2049 Download::emitError(error);
2050 }
2051
2052+} // Daemon
2053+
2054 } // DownloadManager
2055
2056 } // Ubuntu
2057
2058=== modified file 'ubuntu-download-manager-priv/downloads/file_download.h'
2059--- ubuntu-download-manager-priv/downloads/file_download.h 2014-01-16 15:22:06 +0000
2060+++ ubuntu-download-manager-priv/downloads/file_download.h 2014-01-22 15:16:38 +0000
2061@@ -1,5 +1,5 @@
2062 /*
2063- * Copyright 2013 Canonical Ltd.
2064+ * Copyright 2013-2014 Canonical Ltd.
2065 *
2066 * This library is free software; you can redistribute it and/or
2067 * modify it under the terms of version 3 of the GNU Lesser General Public
2068@@ -34,6 +34,8 @@
2069
2070 namespace DownloadManager {
2071
2072+namespace Daemon {
2073+
2074 class FileDownload : public Download {
2075 Q_OBJECT
2076
2077@@ -123,6 +125,8 @@
2078 RequestFactory* _requestFactory;
2079 };
2080
2081+} // Daemon
2082+
2083 } // DownloadManager
2084
2085 } // Ubuntu
2086
2087=== modified file 'ubuntu-download-manager-priv/downloads/group_download.cpp'
2088--- ubuntu-download-manager-priv/downloads/group_download.cpp 2013-12-02 12:03:18 +0000
2089+++ ubuntu-download-manager-priv/downloads/group_download.cpp 2014-01-22 15:16:38 +0000
2090@@ -1,5 +1,5 @@
2091 /*
2092- * copyright 2013 2013 canonical ltd.
2093+ * copyright 2013-2014 canonical ltd.
2094 *
2095 * this library is free software; you can redistribute it and/or
2096 * modify it under the terms of version 3 of the gnu lesser general public
2097@@ -28,6 +28,8 @@
2098
2099 namespace DownloadManager {
2100
2101+namespace Daemon {
2102+
2103 GroupDownload::GroupDownload(const QString& id,
2104 const QString& path,
2105 bool isConfined,
2106@@ -296,6 +298,8 @@
2107 }
2108 }
2109
2110+} // Daemon
2111+
2112 } // DownloadManager
2113
2114 } // Ubuntu
2115
2116=== modified file 'ubuntu-download-manager-priv/downloads/group_download.h'
2117--- ubuntu-download-manager-priv/downloads/group_download.h 2013-12-02 12:03:18 +0000
2118+++ ubuntu-download-manager-priv/downloads/group_download.h 2014-01-22 15:16:38 +0000
2119@@ -1,5 +1,5 @@
2120 /*
2121- * Copyright 2013 Canonical Ltd.
2122+ * Copyright 2013-2014 Canonical Ltd.
2123 *
2124 * This library is free software; you can redistribute it and/or
2125 * modify it under the terms of version 3 of the GNU Lesser General Public
2126@@ -33,6 +33,8 @@
2127
2128 namespace DownloadManager {
2129
2130+namespace Daemon {
2131+
2132 class GroupDownload : public Download {
2133 Q_OBJECT
2134
2135@@ -82,6 +84,8 @@
2136 FileManager* _fileManager = NULL;
2137 };
2138
2139+} // Daemon
2140+
2141 } // DownloadManager
2142
2143 } // Ubuntu
2144
2145=== modified file 'ubuntu-download-manager-priv/downloads/group_download_adaptor.cpp'
2146--- ubuntu-download-manager-priv/downloads/group_download_adaptor.cpp 2013-10-25 11:44:53 +0000
2147+++ ubuntu-download-manager-priv/downloads/group_download_adaptor.cpp 2014-01-22 15:16:38 +0000
2148@@ -22,6 +22,8 @@
2149
2150 namespace DownloadManager {
2151
2152+namespace Daemon {
2153+
2154 /*
2155 * Implementation of adaptor class GroupDownloadAdaptor
2156 */
2157@@ -112,6 +114,8 @@
2158 return total;
2159 }
2160
2161+} // Daemon
2162+
2163 } // DownloadManager
2164
2165 } // Ubuntu
2166
2167=== modified file 'ubuntu-download-manager-priv/downloads/group_download_adaptor.h'
2168--- ubuntu-download-manager-priv/downloads/group_download_adaptor.h 2013-11-12 12:30:18 +0000
2169+++ ubuntu-download-manager-priv/downloads/group_download_adaptor.h 2014-01-22 15:16:38 +0000
2170@@ -28,6 +28,8 @@
2171
2172 namespace DownloadManager {
2173
2174+namespace Daemon {
2175+
2176 /*
2177 * Adaptor class for interface com.canonical.applications.Download
2178 */
2179@@ -121,6 +123,8 @@
2180 void started(bool success);
2181 };
2182
2183+} // Daemon
2184+
2185 } // DownloadManager
2186
2187 } // Ubuntu
2188
2189=== modified file 'ubuntu-download-manager-priv/downloads/manager.cpp'
2190--- ubuntu-download-manager-priv/downloads/manager.cpp 2013-11-29 11:44:07 +0000
2191+++ ubuntu-download-manager-priv/downloads/manager.cpp 2014-01-22 15:16:38 +0000
2192@@ -1,5 +1,5 @@
2193 /*
2194- * Copyright 2013 Canonical Ltd.
2195+ * Copyright 2013-2014 Canonical Ltd.
2196 *
2197 * This library is free software; you can redistribute it and/or
2198 * modify it under the terms of version 3 of the GNU Lesser General Public
2199@@ -27,6 +27,8 @@
2200
2201 namespace DownloadManager {
2202
2203+namespace Daemon {
2204+
2205 Manager::Manager(Application* app,
2206 DBusConnection* connection,
2207 bool stoppable,
2208@@ -239,6 +241,7 @@
2209 }
2210 }
2211
2212+} // Daemon
2213
2214 } // DownloadManager
2215
2216
2217=== modified file 'ubuntu-download-manager-priv/downloads/manager.h'
2218--- ubuntu-download-manager-priv/downloads/manager.h 2013-12-02 12:03:18 +0000
2219+++ ubuntu-download-manager-priv/downloads/manager.h 2014-01-22 15:16:38 +0000
2220@@ -1,5 +1,5 @@
2221 /*
2222- * Copyright 2013 Canonical Ltd.
2223+ * Copyright 2013-2014 Canonical Ltd.
2224 *
2225 * This library is free software; you can redistribute it and/or
2226 * modify it under the terms of version 3 of the GNU Lesser General Public
2227@@ -25,16 +25,18 @@
2228 #include <QtDBus/QDBusContext>
2229 #include <QSslCertificate>
2230 #include <ubuntu/download_manager/metatypes.h>
2231+#include <ubuntu/download_manager/system/dbus_connection.h>
2232 #include "downloads/download.h"
2233 #include "downloads/queue.h"
2234 #include "downloads/factory.h"
2235 #include "system/application.h"
2236-#include "system/dbus_connection.h"
2237
2238 namespace Ubuntu {
2239
2240 namespace DownloadManager {
2241
2242+namespace Daemon {
2243+
2244 class Manager : public QObject, public QDBusContext {
2245 Q_OBJECT
2246
2247@@ -103,6 +105,8 @@
2248 bool _stoppable;
2249 };
2250
2251+} // Daemon
2252+
2253 } // DownloadManager
2254
2255 } // Manager
2256
2257=== modified file 'ubuntu-download-manager-priv/downloads/queue.cpp'
2258--- ubuntu-download-manager-priv/downloads/queue.cpp 2014-01-16 15:42:53 +0000
2259+++ ubuntu-download-manager-priv/downloads/queue.cpp 2014-01-22 15:16:38 +0000
2260@@ -26,6 +26,8 @@
2261
2262 namespace DownloadManager {
2263
2264+namespace Daemon {
2265+
2266 Queue::Queue(QObject* parent)
2267 : QObject(parent),
2268 _current("") {
2269@@ -176,6 +178,7 @@
2270 emit currentChanged(_current);
2271 }
2272
2273+} // Daemon
2274
2275 } // DownloadManager
2276
2277
2278=== modified file 'ubuntu-download-manager-priv/downloads/queue.h'
2279--- ubuntu-download-manager-priv/downloads/queue.h 2014-01-16 15:42:53 +0000
2280+++ ubuntu-download-manager-priv/downloads/queue.h 2014-01-22 15:16:38 +0000
2281@@ -31,6 +31,8 @@
2282
2283 using namespace System;
2284
2285+namespace Daemon {
2286+
2287 class Queue : public QObject {
2288 Q_OBJECT
2289
2290@@ -63,6 +65,8 @@
2291 QStringList _sortedPaths; // keep the order
2292 };
2293
2294+} // Daemon
2295+
2296 } // DownloadManager
2297
2298 } // Ubuntu
2299
2300=== modified file 'ubuntu-download-manager-priv/downloads/sm_file_download.cpp'
2301--- ubuntu-download-manager-priv/downloads/sm_file_download.cpp 2013-11-11 16:12:38 +0000
2302+++ ubuntu-download-manager-priv/downloads/sm_file_download.cpp 2014-01-22 15:16:38 +0000
2303@@ -1,5 +1,5 @@
2304 /*
2305- * Copyright 2013 Canonical Ltd.
2306+ * Copyright 2013-2014 Canonical Ltd.
2307 *
2308 * This library is free software; you can redistribute it and/or
2309 * modify it under the terms of version 3 of the GNU Lesser General Public
2310@@ -22,6 +22,8 @@
2311
2312 namespace DownloadManager {
2313
2314+namespace Daemon {
2315+
2316 SMFileDownload::SMFileDownload(QObject *parent)
2317 : QObject(parent) {
2318 }
2319@@ -65,6 +67,8 @@
2320 // TODO: perform the cancel
2321 }
2322
2323+} // Daemon
2324+
2325 } // Ubuntu
2326
2327 } // DownloadManager
2328
2329=== modified file 'ubuntu-download-manager-priv/downloads/sm_file_download.h'
2330--- ubuntu-download-manager-priv/downloads/sm_file_download.h 2013-11-11 16:12:38 +0000
2331+++ ubuntu-download-manager-priv/downloads/sm_file_download.h 2014-01-22 15:16:38 +0000
2332@@ -1,5 +1,5 @@
2333 /*
2334- * Copyright 2013 Canonical Ltd.
2335+ * Copyright 2013-2014 Canonical Ltd.
2336 *
2337 * This library is free software; you can redistribute it and/or
2338 * modify it under the terms of version 3 of the GNU Lesser General Public
2339@@ -28,6 +28,8 @@
2340
2341 namespace DownloadManager {
2342
2343+namespace Daemon {
2344+
2345 class SMFileDownload : public QObject {
2346 Q_OBJECT
2347
2348@@ -73,6 +75,8 @@
2349
2350 };
2351
2352+} // Daemon
2353+
2354 } // DownloadManager
2355
2356 } // Ubuntu
2357
2358=== modified file 'ubuntu-download-manager-priv/downloads/state_machines/download_sm.cpp'
2359--- ubuntu-download-manager-priv/downloads/state_machines/download_sm.cpp 2013-11-18 12:13:13 +0000
2360+++ ubuntu-download-manager-priv/downloads/state_machines/download_sm.cpp 2014-01-22 15:16:38 +0000
2361@@ -1,5 +1,5 @@
2362 /*
2363- * Copyright 2013 Canonical Ltd.
2364+ * Copyright 2013-2014 Canonical Ltd.
2365 *
2366 * This library is free software; you can redistribute it and/or
2367 * modify it under the terms of version 3 of the GNU Lesser General Public
2368@@ -30,6 +30,8 @@
2369
2370 namespace DownloadManager {
2371
2372+namespace Daemon {
2373+
2374 namespace StateMachines {
2375
2376
2377@@ -451,6 +453,8 @@
2378
2379 } // StateMachines
2380
2381+} // Daemon
2382+
2383 } // DownloadManager
2384
2385 } // Ubuntu
2386
2387=== modified file 'ubuntu-download-manager-priv/downloads/state_machines/download_sm.h'
2388--- ubuntu-download-manager-priv/downloads/state_machines/download_sm.h 2013-11-11 16:14:46 +0000
2389+++ ubuntu-download-manager-priv/downloads/state_machines/download_sm.h 2014-01-22 15:16:38 +0000
2390@@ -1,5 +1,5 @@
2391 /*
2392- * Copyright 2013 Canonical Ltd.
2393+ * Copyright 2013-2014 Canonical Ltd.
2394 *
2395 * This library is free software; you can redistribute it and/or
2396 * modify it under the terms of version 3 of the GNU Lesser General Public
2397@@ -30,6 +30,8 @@
2398
2399 namespace DownloadManager {
2400
2401+namespace Daemon {
2402+
2403 namespace StateMachines {
2404
2405 class DownloadSMTransition : public QSignalTransition {
2406@@ -170,6 +172,8 @@
2407
2408 } // StateMachines
2409
2410+} // Daemon
2411+
2412 } // DownloadManager
2413
2414 } // Ubuntu
2415
2416=== modified file 'ubuntu-download-manager-priv/downloads/state_machines/final_state.cpp'
2417--- ubuntu-download-manager-priv/downloads/state_machines/final_state.cpp 2013-11-05 20:55:59 +0000
2418+++ ubuntu-download-manager-priv/downloads/state_machines/final_state.cpp 2014-01-22 15:16:38 +0000
2419@@ -1,5 +1,5 @@
2420 /*
2421- * Copyright 2013 Canonical Ltd.
2422+ * Copyright 2013-2014 Canonical Ltd.
2423 *
2424 * This library is free software; you can redistribute it and/or
2425 * modify it under the terms of version 3 of the GNU Lesser General Public
2426@@ -23,6 +23,8 @@
2427
2428 namespace DownloadManager {
2429
2430+namespace Daemon {
2431+
2432 namespace StateMachines {
2433
2434 FinalState::FinalState(QState* parent)
2435@@ -68,6 +70,8 @@
2436
2437 } // StateMachines
2438
2439+} // Daemon
2440+
2441 } // DownloadManager
2442
2443 } // Ubuntu
2444
2445=== modified file 'ubuntu-download-manager-priv/downloads/state_machines/final_state.h'
2446--- ubuntu-download-manager-priv/downloads/state_machines/final_state.h 2013-11-05 20:55:59 +0000
2447+++ ubuntu-download-manager-priv/downloads/state_machines/final_state.h 2014-01-22 15:16:38 +0000
2448@@ -1,5 +1,5 @@
2449 /*
2450- * Copyright 2013 Canonical Ltd.
2451+ * Copyright 2013-2014 Canonical Ltd.
2452 *
2453 * This library is free software; you can redistribute it and/or
2454 * modify it under the terms of version 3 of the GNU Lesser General Public
2455@@ -28,6 +28,8 @@
2456
2457 namespace DownloadManager {
2458
2459+namespace Daemon {
2460+
2461 namespace StateMachines {
2462
2463 struct PropertyAssignment {
2464@@ -68,6 +70,8 @@
2465
2466 } // StateMachines
2467
2468+} // Daemon
2469+
2470 } // DownloadManager
2471
2472 } // Ubuntu
2473
2474=== modified file 'ubuntu-download-manager-priv/downloads/state_machines/state.cpp'
2475--- ubuntu-download-manager-priv/downloads/state_machines/state.cpp 2013-11-05 20:55:59 +0000
2476+++ ubuntu-download-manager-priv/downloads/state_machines/state.cpp 2014-01-22 15:16:38 +0000
2477@@ -1,5 +1,5 @@
2478 /*
2479- * Copyright 2013 Canonical Ltd.
2480+ * Copyright 2013-2014 Canonical Ltd.
2481 *
2482 * This library is free software; you can redistribute it and/or
2483 * modify it under the terms of version 3 of the GNU Lesser General Public
2484@@ -18,6 +18,14 @@
2485
2486 #include "state.h"
2487
2488+namespace Ubuntu {
2489+
2490+namespace DownloadManager {
2491+
2492+namespace Daemon {
2493+
2494+namespace StateMachines {
2495+
2496 State::State(QObject* obj,
2497 const char* property,
2498 QVariant value,
2499@@ -26,3 +34,11 @@
2500 // simply add the property
2501 assignProperty(obj, property, value);
2502 }
2503+
2504+} // StateMachines
2505+
2506+} // Daemon
2507+
2508+} // DownloadManager
2509+
2510+} // Ubuntu
2511
2512=== modified file 'ubuntu-download-manager-priv/downloads/state_machines/state.h'
2513--- ubuntu-download-manager-priv/downloads/state_machines/state.h 2013-11-05 20:55:59 +0000
2514+++ ubuntu-download-manager-priv/downloads/state_machines/state.h 2014-01-22 15:16:38 +0000
2515@@ -1,5 +1,5 @@
2516 /*
2517- * Copyright 2013 Canonical Ltd.
2518+ * Copyright 2013-2014 Canonical Ltd.
2519 *
2520 * This library is free software; you can redistribute it and/or
2521 * modify it under the terms of version 3 of the GNU Lesser General Public
2522@@ -22,6 +22,14 @@
2523 #include <QState>
2524 #include <QVariant>
2525
2526+namespace Ubuntu {
2527+
2528+namespace DownloadManager {
2529+
2530+namespace Daemon {
2531+
2532+namespace StateMachines {
2533+
2534 class State : public QState {
2535 Q_OBJECT
2536 public:
2537@@ -29,4 +37,12 @@
2538
2539 };
2540
2541+} // StateMachines
2542+
2543+} // Daemon
2544+
2545+} // DownloadManager
2546+
2547+} // Ubuntu
2548+
2549 #endif // DOWNLOADER_LIB_STATE_H
2550
2551=== modified file 'ubuntu-download-manager-priv/system/apparmor.h'
2552--- ubuntu-download-manager-priv/system/apparmor.h 2013-11-13 20:02:15 +0000
2553+++ ubuntu-download-manager-priv/system/apparmor.h 2014-01-22 15:16:38 +0000
2554@@ -1,5 +1,5 @@
2555 /*
2556- * Copyright 2013 Canonical Ltd.
2557+ * Copyright 2013-2014 Canonical Ltd.
2558 *
2559 * This library is free software; you can redistribute it and/or
2560 * modify it under the terms of version 3 of the GNU Lesser General Public
2561@@ -23,7 +23,7 @@
2562 #include <QPair>
2563 #include <QString>
2564 #include <QSharedPointer>
2565-#include "dbus_connection.h"
2566+#include <ubuntu/download_manager/system/dbus_connection.h>
2567 #include "dbus_proxy.h"
2568 #include "uuid_factory.h"
2569
2570
2571=== modified file 'ubuntu-download-manager-priv/ubuntu-download-manager-priv.pro'
2572--- ubuntu-download-manager-priv/ubuntu-download-manager-priv.pro 2013-12-03 12:25:56 +0000
2573+++ ubuntu-download-manager-priv/ubuntu-download-manager-priv.pro 2014-01-22 15:16:38 +0000
2574@@ -34,7 +34,6 @@
2575 system/process.cpp \
2576 system/logger.cpp \
2577 system/file_manager.cpp \
2578- system/dbus_connection.cpp \
2579 system/application.cpp \
2580 system/apparmor.cpp \
2581 system/network_reply.cpp \
2582@@ -66,7 +65,6 @@
2583 system/process.h \
2584 system/logger.h \
2585 system/file_manager.h \
2586- system/dbus_connection.h \
2587 system/application.h \
2588 system/apparmor.h \
2589 system/network_reply.h \
2590
2591=== added directory 'ubuntu-download-manager-test-lib'
2592=== added directory 'ubuntu-download-manager-test-lib/ubuntu'
2593=== added file 'ubuntu-download-manager-test-lib/ubuntu-download-manager-test-lib.pro'
2594--- ubuntu-download-manager-test-lib/ubuntu-download-manager-test-lib.pro 1970-01-01 00:00:00 +0000
2595+++ ubuntu-download-manager-test-lib/ubuntu-download-manager-test-lib.pro 2014-01-22 15:16:38 +0000
2596@@ -0,0 +1,63 @@
2597+include( ../common-project-config.pri )
2598+include( ../common-vars.pri )
2599+
2600+QT += network core testlib dbus systeminfo sql
2601+QT -= gui
2602+
2603+TARGET = ubuntu-download-manager-test-lib
2604+TEMPLATE = lib
2605+
2606+DEFINES += UBUNTUDOWNLOADMANAGERTESTLIB_LIBRARY
2607+
2608+SOURCES += ubuntu/download_manager/tests/base_testcase.cpp \
2609+ ubuntu/download_manager/tests/fake.cpp \
2610+ ubuntu/download_manager/tests/client/daemon_testcase.cpp \
2611+ ubuntu/download_manager/tests/server/apparmor.cpp \
2612+ ubuntu/download_manager/tests/server/application.cpp \
2613+ ubuntu/download_manager/tests/server/dbus_connection.cpp \
2614+ ubuntu/download_manager/tests/server/download.cpp \
2615+ ubuntu/download_manager/tests/server/factory.cpp \
2616+ ubuntu/download_manager/tests/server/file_manager.cpp \
2617+ ubuntu/download_manager/tests/server/manager.cpp \
2618+ ubuntu/download_manager/tests/server/network_reply.cpp \
2619+ ubuntu/download_manager/tests/server/process.cpp \
2620+ ubuntu/download_manager/tests/server/process_factory.cpp \
2621+ ubuntu/download_manager/tests/server/qnetwork_reply.cpp \
2622+ ubuntu/download_manager/tests/server/queue.cpp \
2623+ ubuntu/download_manager/tests/server/request_factory.cpp \
2624+ ubuntu/download_manager/tests/server/sm_file_download.cpp \
2625+ ubuntu/download_manager/tests/server/system_network_info.cpp \
2626+ ubuntu/download_manager/tests/server/timer.cpp \
2627+ ubuntu/download_manager/tests/server/uuid_factory.cpp
2628+
2629+HEADERS += ubuntu/download_manager/tests/base_testcase.h \
2630+ ubuntu/download_manager/tests/fake.h\
2631+ ubuntu/download_manager/tests/test_runner.h \
2632+ ubuntu/download_manager/tests/client/daemon_testcase.h \
2633+ ubuntu/download_manager/tests/server/apparmor.h \
2634+ ubuntu/download_manager/tests/server/application.h \
2635+ ubuntu/download_manager/tests/server/dbus_connection.h \
2636+ ubuntu/download_manager/tests/server/download.h \
2637+ ubuntu/download_manager/tests/server/factory.h \
2638+ ubuntu/download_manager/tests/server/file_manager.h \
2639+ ubuntu/download_manager/tests/server/manager.h \
2640+ ubuntu/download_manager/tests/server/network_reply.h \
2641+ ubuntu/download_manager/tests/server/process.h \
2642+ ubuntu/download_manager/tests/server/process_factory.h \
2643+ ubuntu/download_manager/tests/server/qnetwork_reply.h \
2644+ ubuntu/download_manager/tests/server/queue.h \
2645+ ubuntu/download_manager/tests/server/request_factory.h \
2646+ ubuntu/download_manager/tests/server/sm_file_download.h \
2647+ ubuntu/download_manager/tests/server/system_network_info.h \
2648+ ubuntu/download_manager/tests/server/timer.h \
2649+ ubuntu/download_manager/tests/server/uuid_factory.h
2650+
2651+LIBS += -L$$OUT_PWD/../ubuntu-download-manager-common/ -lubuntu-download-manager-common
2652+
2653+INCLUDEPATH += $$PWD/../ubuntu-download-manager-common
2654+DEPENDPATH += $$PWD/../ubuntu-download-manager-common
2655+
2656+LIBS += -L$$OUT_PWD/../ubuntu-download-manager-priv/ -lubuntu-download-manager-priv
2657+
2658+INCLUDEPATH += $$PWD/../ubuntu-download-manager-priv
2659+DEPENDPATH += $$PWD/../ubuntu-download-manager-priv
2660
2661=== added file 'ubuntu-download-manager-test-lib/ubuntu-download-manager-test-lib_global.h'
2662--- ubuntu-download-manager-test-lib/ubuntu-download-manager-test-lib_global.h 1970-01-01 00:00:00 +0000
2663+++ ubuntu-download-manager-test-lib/ubuntu-download-manager-test-lib_global.h 2014-01-22 15:16:38 +0000
2664@@ -0,0 +1,12 @@
2665+#ifndef UBUNTUDOWNLOADMANAGERTESTLIB_GLOBAL_H
2666+#define UBUNTUDOWNLOADMANAGERTESTLIB_GLOBAL_H
2667+
2668+#include <QtCore/qglobal.h>
2669+
2670+#if defined(UBUNTUDOWNLOADMANAGERTESTLIB_LIBRARY)
2671+# define UBUNTUDOWNLOADMANAGERTESTLIBSHARED_EXPORT Q_DECL_EXPORT
2672+#else
2673+# define UBUNTUDOWNLOADMANAGERTESTLIBSHARED_EXPORT Q_DECL_IMPORT
2674+#endif
2675+
2676+#endif // UBUNTUDOWNLOADMANAGERTESTLIB_GLOBAL_H
2677
2678=== added directory 'ubuntu-download-manager-test-lib/ubuntu/download_manager'
2679=== added directory 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests'
2680=== renamed file 'ubuntu-download-manager-tests/base_testcase.cpp' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/base_testcase.cpp'
2681=== renamed file 'ubuntu-download-manager-tests/base_testcase.h' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/base_testcase.h'
2682--- ubuntu-download-manager-tests/base_testcase.h 2013-11-08 17:46:32 +0000
2683+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/base_testcase.h 2014-01-22 15:16:38 +0000
2684@@ -1,5 +1,5 @@
2685 /*
2686- * Copyright 2013 Canonical Ltd.
2687+ * Copyright 2013-2014 Canonical Ltd.
2688 *
2689 * This library is free software; you can redistribute it and/or
2690 * modify it under the terms of version 3 of the GNU Lesser General Public
2691@@ -21,9 +21,9 @@
2692
2693 #include <QObject>
2694
2695-class BaseTestCase : public QObject
2696-{
2697+class BaseTestCase : public QObject {
2698 Q_OBJECT
2699+
2700 public:
2701 BaseTestCase(const QString& testName, QObject *parent = 0);
2702
2703
2704=== added directory 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/client'
2705=== added file 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/client/daemon_testcase.cpp'
2706--- ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/client/daemon_testcase.cpp 1970-01-01 00:00:00 +0000
2707+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/client/daemon_testcase.cpp 2014-01-22 15:16:38 +0000
2708@@ -0,0 +1,50 @@
2709+/*
2710+ * Copyright 2013 Canonical Ltd.
2711+ *
2712+ * This library is free software; you can redistribute it and/or
2713+ * modify it under the terms of version 3 of the GNU Lesser General Public
2714+ * License as published by the Free Software Foundation.
2715+ *
2716+ * This program is distributed in the hope that it will be useful,
2717+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2718+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2719+ * General Public License for more details.
2720+ *
2721+ * You should have received a copy of the GNU Lesser General Public
2722+ * License along with this library; if not, write to the
2723+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
2724+ * Boston, MA 02110-1301, USA.
2725+ */
2726+
2727+#include "daemon_testcase.h"
2728+
2729+DaemonTestCase::DaemonTestCase(const QString& testName, QObject* parent)
2730+ : BaseTestCase(testName, parent) {
2731+}
2732+
2733+
2734+QString
2735+DaemonTestCase::daemonPath() {
2736+ return _daemonPath;
2737+}
2738+
2739+void
2740+DaemonTestCase::init() {
2741+ // WARNING: create a path for this exact test.. we might have
2742+ // issues if we have to two object with the same name
2743+ _daemonPath = "com.canonical.applications.testing.Downloader."
2744+ + objectName();
2745+ _daemon = new Daemon::Daemon(this);
2746+
2747+ BaseTestCase::init();
2748+ _daemon->enableTimeout(false);
2749+ _daemon->start(_daemonPath);
2750+}
2751+
2752+void
2753+DaemonTestCase::cleanup() {
2754+ _daemon->stop(); // unregisters the service although the delete should do
2755+ // the same.. but I like to be explicit
2756+ delete _daemon;
2757+ BaseTestCase::cleanup();
2758+}
2759
2760=== added file 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/client/daemon_testcase.h'
2761--- ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/client/daemon_testcase.h 1970-01-01 00:00:00 +0000
2762+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/client/daemon_testcase.h 2014-01-22 15:16:38 +0000
2763@@ -0,0 +1,46 @@
2764+/*
2765+ * Copyright 2013 Canonical Ltd.
2766+ *
2767+ * This library is free software; you can redistribute it and/or
2768+ * modify it under the terms of version 3 of the GNU Lesser General Public
2769+ * License as published by the Free Software Foundation.
2770+ *
2771+ * This program is distributed in the hope that it will be useful,
2772+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2773+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2774+ * General Public License for more details.
2775+ *
2776+ * You should have received a copy of the GNU Lesser General Public
2777+ * License along with this library; if not, write to the
2778+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
2779+ * Boston, MA 02110-1301, USA.
2780+ */
2781+
2782+#ifndef DAEMON_TESTCASE_H
2783+#define DAEMON_TESTCASE_H
2784+
2785+#include <QObject>
2786+#include <downloads/daemon.h> // comes from the priv lib, just for testing!!!!
2787+#include "ubuntu/download_manager/tests/base_testcase.h"
2788+
2789+using namespace Ubuntu::DownloadManager;
2790+
2791+class DaemonTestCase : public BaseTestCase {
2792+ Q_OBJECT
2793+
2794+ public:
2795+ DaemonTestCase(const QString& testName, QObject *parent = 0);
2796+
2797+ QString daemonPath();
2798+
2799+ protected slots: // NOLINT(whitespace/indent)
2800+
2801+ void init() override;
2802+ void cleanup() override;
2803+
2804+ private:
2805+ QString _daemonPath;
2806+ Daemon::Daemon* _daemon;
2807+};
2808+
2809+#endif // DAEMON_TESTCASE_H
2810
2811=== renamed file 'ubuntu-download-manager-tests/fakes/fake.cpp' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/fake.cpp'
2812=== renamed file 'ubuntu-download-manager-tests/fakes/fake.h' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/fake.h'
2813=== added directory 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server'
2814=== renamed file 'ubuntu-download-manager-tests/fakes/fake_apparmor.cpp' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/apparmor.cpp'
2815--- ubuntu-download-manager-tests/fakes/fake_apparmor.cpp 2013-11-27 15:50:02 +0000
2816+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/apparmor.cpp 2014-01-22 15:16:38 +0000
2817@@ -1,5 +1,5 @@
2818 /*
2819- * Copyright 2013 Canonical Ltd.
2820+ * Copyright 2013-2014 Canonical Ltd.
2821 *
2822 * This library is free software; you can redistribute it and/or
2823 * modify it under the terms of version 3 of the GNU Lesser General Public
2824@@ -17,7 +17,7 @@
2825 */
2826
2827 #include <system/uuid_utils.h>
2828-#include "fake_apparmor.h"
2829+#include "apparmor.h"
2830
2831 FakeAppArmor::FakeAppArmor(QSharedPointer<UuidFactory> uuidFactory,
2832 QObject *parent)
2833
2834=== renamed file 'ubuntu-download-manager-tests/fakes/fake_apparmor.h' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/apparmor.h'
2835--- ubuntu-download-manager-tests/fakes/fake_apparmor.h 2013-10-30 11:04:37 +0000
2836+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/apparmor.h 2014-01-22 15:16:38 +0000
2837@@ -1,5 +1,5 @@
2838 /*
2839- * Copyright 2013 Canonical Ltd.
2840+ * Copyright 2013-2014 Canonical Ltd.
2841 *
2842 * This library is free software; you can redistribute it and/or
2843 * modify it under the terms of version 3 of the GNU Lesser General Public
2844@@ -23,7 +23,7 @@
2845 #include <QSharedPointer>
2846 #include <system/apparmor.h>
2847 #include <system/uuid_factory.h>
2848-#include "fake.h"
2849+#include "ubuntu/download_manager/tests/fake.h"
2850
2851 using namespace Ubuntu::DownloadManager::System;
2852
2853
2854=== renamed file 'ubuntu-download-manager-tests/fakes/fake_application.cpp' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/application.cpp'
2855--- ubuntu-download-manager-tests/fakes/fake_application.cpp 2014-01-16 15:42:53 +0000
2856+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/application.cpp 2014-01-22 15:16:38 +0000
2857@@ -16,7 +16,7 @@
2858 * Boston, MA 02110-1301, USA.
2859 */
2860
2861-#include "./fake_application.h"
2862+#include "application.h"
2863
2864 FakeApplication::FakeApplication(QObject *parent)
2865 : Application(parent),
2866
2867=== renamed file 'ubuntu-download-manager-tests/fakes/fake_application.h' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/application.h'
2868--- ubuntu-download-manager-tests/fakes/fake_application.h 2014-01-16 15:42:53 +0000
2869+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/application.h 2014-01-22 15:16:38 +0000
2870@@ -21,7 +21,7 @@
2871
2872 #include <QObject>
2873 #include <system/application.h>
2874-#include "fake.h"
2875+#include "ubuntu/download_manager/tests/fake.h"
2876
2877 using namespace Ubuntu::DownloadManager::System;
2878
2879
2880=== renamed file 'ubuntu-download-manager-tests/fakes/fake_dbus_connection.cpp' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/dbus_connection.cpp'
2881--- ubuntu-download-manager-tests/fakes/fake_dbus_connection.cpp 2014-01-16 15:42:53 +0000
2882+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/dbus_connection.cpp 2014-01-22 15:16:38 +0000
2883@@ -16,7 +16,7 @@
2884 * Boston, MA 02110-1301, USA.
2885 */
2886
2887-#include "./fake_dbus_connection.h"
2888+#include "dbus_connection.h"
2889
2890 /*
2891 * REGISTER OPTIONS WRAPPER
2892
2893=== renamed file 'ubuntu-download-manager-tests/fakes/fake_dbus_connection.h' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/dbus_connection.h'
2894--- ubuntu-download-manager-tests/fakes/fake_dbus_connection.h 2014-01-16 15:42:53 +0000
2895+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/dbus_connection.h 2014-01-22 15:16:38 +0000
2896@@ -18,8 +18,8 @@
2897
2898 #ifndef FAKE_DBUS_CONNECTION_H
2899 #define FAKE_DBUS_CONNECTION_H
2900-#include <system/dbus_connection.h>
2901-#include "fake.h"
2902+#include <ubuntu/download_manager/system/dbus_connection.h>
2903+#include "ubuntu/download_manager/tests/fake.h"
2904
2905
2906 using namespace Ubuntu::DownloadManager::System;
2907
2908=== renamed file 'ubuntu-download-manager-tests/fakes/fake_download.cpp' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/download.cpp'
2909--- ubuntu-download-manager-tests/fakes/fake_download.cpp 2014-01-16 15:42:53 +0000
2910+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/download.cpp 2014-01-22 15:16:38 +0000
2911@@ -17,7 +17,7 @@
2912 */
2913
2914 #include <QDebug>
2915-#include "fake_download.h"
2916+#include "download.h"
2917
2918 FakeDownload::FakeDownload(const QString& id,
2919 const QString& path,
2920
2921=== renamed file 'ubuntu-download-manager-tests/fakes/fake_download.h' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/download.h'
2922--- ubuntu-download-manager-tests/fakes/fake_download.h 2014-01-16 15:42:53 +0000
2923+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/download.h 2014-01-22 15:16:38 +0000
2924@@ -22,9 +22,9 @@
2925 #include <downloads/file_download.h>
2926 #include <system/system_network_info.h>
2927 #include <ubuntu/download_manager/metatypes.h>
2928-#include "fake.h"
2929+#include "ubuntu/download_manager/tests/fake.h"
2930
2931-using namespace Ubuntu::DownloadManager;
2932+using namespace Ubuntu::DownloadManager::Daemon;
2933
2934 class FakeDownload : public FileDownload, public Fake {
2935 Q_OBJECT
2936
2937=== renamed file 'ubuntu-download-manager-tests/fakes/fake_download_factory.cpp' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/factory.cpp'
2938--- ubuntu-download-manager-tests/fakes/fake_download_factory.cpp 2014-01-16 15:42:53 +0000
2939+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/factory.cpp 2014-01-22 15:16:38 +0000
2940@@ -16,8 +16,8 @@
2941 * Boston, MA 02110-1301, USA.
2942 */
2943
2944-#include "fake_download.h"
2945-#include "fake_download_factory.h"
2946+#include "download.h"
2947+#include "factory.h"
2948
2949 FakeDownloadFactory::FakeDownloadFactory(
2950 AppArmor* apparmor,
2951
2952=== renamed file 'ubuntu-download-manager-tests/fakes/fake_download_factory.h' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/factory.h'
2953--- ubuntu-download-manager-tests/fakes/fake_download_factory.h 2014-01-16 15:42:53 +0000
2954+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/factory.h 2014-01-22 15:16:38 +0000
2955@@ -22,9 +22,10 @@
2956 #include <QObject>
2957 #include <QSharedPointer>
2958 #include <downloads/factory.h>
2959-#include "fake.h"
2960+#include "ubuntu/download_manager/tests/fake.h"
2961
2962-using namespace Ubuntu::DownloadManager;
2963+using namespace Ubuntu::DownloadManager::System;
2964+using namespace Ubuntu::DownloadManager::Daemon;
2965
2966 class FakeDownloadFactory : public Factory, public Fake {
2967 Q_OBJECT
2968
2969=== renamed file 'ubuntu-download-manager-tests/fakes/fake_file_manager.cpp' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/file_manager.cpp'
2970--- ubuntu-download-manager-tests/fakes/fake_file_manager.cpp 2014-01-16 15:42:53 +0000
2971+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/file_manager.cpp 2014-01-22 15:16:38 +0000
2972@@ -16,7 +16,7 @@
2973 * Boston, MA 02110-1301, USA.
2974 */
2975
2976-#include "./fake_file_manager.h"
2977+#include "file_manager.h"
2978
2979 FakeFile::FakeFile(const QString& name)
2980 : File(name) {
2981
2982=== renamed file 'ubuntu-download-manager-tests/fakes/fake_file_manager.h' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/file_manager.h'
2983--- ubuntu-download-manager-tests/fakes/fake_file_manager.h 2014-01-16 15:42:53 +0000
2984+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/file_manager.h 2014-01-22 15:16:38 +0000
2985@@ -21,7 +21,7 @@
2986
2987 #include <QObject>
2988 #include <system/file_manager.h>
2989-#include "fake.h"
2990+#include "ubuntu/download_manager/tests/fake.h"
2991
2992 using namespace Ubuntu::DownloadManager::System;
2993
2994
2995=== renamed file 'ubuntu-download-manager-tests/fakes/fake_download_manager.cpp' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/manager.cpp'
2996--- ubuntu-download-manager-tests/fakes/fake_download_manager.cpp 2013-11-28 16:01:44 +0000
2997+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/manager.cpp 2014-01-22 15:16:38 +0000
2998@@ -1,5 +1,5 @@
2999 /*
3000- * Copyright 2013 Canonical Ltd.
3001+ * Copyright 2013-2014 Canonical Ltd.
3002 *
3003 * This library is free software; you can redistribute it and/or
3004 * modify it under the terms of version 3 of the GNU Lesser General Public
3005@@ -16,7 +16,7 @@
3006 * Boston, MA 02110-1301, USA.
3007 */
3008
3009-#include "./fake_download_manager.h"
3010+#include "manager.h"
3011
3012 FakeDownloadManager::FakeDownloadManager(Application* app,
3013 DBusConnection* connection,
3014
3015=== renamed file 'ubuntu-download-manager-tests/fakes/fake_download_manager.h' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/manager.h'
3016--- ubuntu-download-manager-tests/fakes/fake_download_manager.h 2013-11-28 16:01:44 +0000
3017+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/manager.h 2014-01-22 15:16:38 +0000
3018@@ -1,5 +1,5 @@
3019 /*
3020- * Copyright 2013 Canonical Ltd.
3021+ * Copyright 2013-2014 Canonical Ltd.
3022 *
3023 * This library is free software; you can redistribute it and/or
3024 * modify it under the terms of version 3 of the GNU Lesser General Public
3025@@ -21,9 +21,10 @@
3026
3027 #include <QObject>
3028 #include <downloads/manager.h>
3029-#include "fake.h"
3030+#include "ubuntu/download_manager/tests/fake.h"
3031
3032-using namespace Ubuntu::DownloadManager;
3033+using namespace Ubuntu::DownloadManager::System;
3034+using namespace Ubuntu::DownloadManager::Daemon;
3035
3036 class FakeDownloadManager : public Manager, public Fake {
3037 Q_OBJECT
3038
3039=== renamed file 'ubuntu-download-manager-tests/fakes/fake_network_reply.cpp' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/network_reply.cpp'
3040--- ubuntu-download-manager-tests/fakes/fake_network_reply.cpp 2013-12-02 11:05:31 +0000
3041+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/network_reply.cpp 2014-01-22 15:16:38 +0000
3042@@ -1,5 +1,5 @@
3043 /*
3044- * Copyright 2013 Canonical Ltd.
3045+ * Copyright 2013-2014 Canonical Ltd.
3046 *
3047 * This library is free software; you can redistribute it and/or
3048 * modify it under the terms of version 3 of the GNU Lesser General Public
3049@@ -16,8 +16,8 @@
3050 * Boston, MA 02110-1301, USA.
3051 */
3052
3053-#include "./fake_qnetwork_reply.h"
3054-#include "./fake_network_reply.h"
3055+#include "qnetwork_reply.h"
3056+#include "network_reply.h"
3057
3058
3059 SslErrorsListWrapper::SslErrorsListWrapper(QList<QSslError> value,
3060
3061=== renamed file 'ubuntu-download-manager-tests/fakes/fake_network_reply.h' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/network_reply.h'
3062--- ubuntu-download-manager-tests/fakes/fake_network_reply.h 2013-10-30 11:04:37 +0000
3063+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/network_reply.h 2014-01-22 15:16:38 +0000
3064@@ -1,5 +1,5 @@
3065 /*
3066- * Copyright 2013 Canonical Ltd.
3067+ * Copyright 2013-2014 Canonical Ltd.
3068 *
3069 * This library is free software; you can redistribute it and/or
3070 * modify it under the terms of version 3 of the GNU Lesser General Public
3071@@ -21,7 +21,7 @@
3072
3073 #include <QObject>
3074 #include <system/network_reply.h>
3075-#include "fake.h"
3076+#include "ubuntu/download_manager/tests/fake.h"
3077
3078 using namespace Ubuntu::DownloadManager::System;
3079
3080
3081=== renamed file 'ubuntu-download-manager-tests/fakes/fake_process.cpp' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/process.cpp'
3082--- ubuntu-download-manager-tests/fakes/fake_process.cpp 2014-01-16 15:42:53 +0000
3083+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/process.cpp 2014-01-22 15:16:38 +0000
3084@@ -16,7 +16,7 @@
3085 * Boston, MA 02110-1301, USA.
3086 */
3087
3088-#include "./fake_process.h"
3089+#include "process.h"
3090
3091 OpenModeWrapper::OpenModeWrapper(QProcess::OpenMode mode, QObject* parent)
3092 : QObject(parent) {
3093
3094=== renamed file 'ubuntu-download-manager-tests/fakes/fake_process.h' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/process.h'
3095--- ubuntu-download-manager-tests/fakes/fake_process.h 2014-01-16 15:42:53 +0000
3096+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/process.h 2014-01-22 15:16:38 +0000
3097@@ -21,7 +21,7 @@
3098
3099 #include <QObject>
3100 #include <system/process.h>
3101-#include "fake.h"
3102+#include "ubuntu/download_manager/tests/fake.h"
3103
3104 using namespace Ubuntu::DownloadManager::System;
3105
3106
3107=== renamed file 'ubuntu-download-manager-tests/fakes/fake_process_factory.cpp' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/process_factory.cpp'
3108--- ubuntu-download-manager-tests/fakes/fake_process_factory.cpp 2014-01-16 15:42:53 +0000
3109+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/process_factory.cpp 2014-01-22 15:16:38 +0000
3110@@ -16,8 +16,8 @@
3111 * Boston, MA 02110-1301, USA.
3112 */
3113
3114-#include "./fake_process_factory.h"
3115-#include "./fake_process.h"
3116+#include "process_factory.h"
3117+#include "process.h"
3118
3119 FakeProcessFactory::FakeProcessFactory(QObject *parent)
3120 : ProcessFactory(parent),
3121
3122=== renamed file 'ubuntu-download-manager-tests/fakes/fake_process_factory.h' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/process_factory.h'
3123--- ubuntu-download-manager-tests/fakes/fake_process_factory.h 2014-01-16 15:42:53 +0000
3124+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/process_factory.h 2014-01-22 15:16:38 +0000
3125@@ -21,7 +21,7 @@
3126
3127 #include <QObject>
3128 #include <system/process_factory.h>
3129-#include "./fake.h"
3130+#include "ubuntu/download_manager/tests/fake.h"
3131
3132 using namespace Ubuntu::DownloadManager::System;
3133
3134
3135=== renamed file 'ubuntu-download-manager-tests/fakes/fake_qnetwork_reply.cpp' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/qnetwork_reply.cpp'
3136--- ubuntu-download-manager-tests/fakes/fake_qnetwork_reply.cpp 2013-10-30 11:04:37 +0000
3137+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/qnetwork_reply.cpp 2014-01-22 15:16:38 +0000
3138@@ -1,5 +1,5 @@
3139 /*
3140- * Copyright 2013 Canonical Ltd.
3141+ * Copyright 2013-2014 Canonical Ltd.
3142 *
3143 * This library is free software; you can redistribute it and/or
3144 * modify it under the terms of version 3 of the GNU Lesser General Public
3145@@ -16,7 +16,7 @@
3146 * Boston, MA 02110-1301, USA.
3147 */
3148
3149-#include "fake_qnetwork_reply.h"
3150+#include "qnetwork_reply.h"
3151
3152 FakeQNetworkReply::FakeQNetworkReply(QObject* parent)
3153 : QNetworkReply(parent),
3154
3155=== renamed file 'ubuntu-download-manager-tests/fakes/fake_qnetwork_reply.h' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/qnetwork_reply.h'
3156--- ubuntu-download-manager-tests/fakes/fake_qnetwork_reply.h 2013-10-30 11:04:37 +0000
3157+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/qnetwork_reply.h 2014-01-22 15:16:38 +0000
3158@@ -1,5 +1,5 @@
3159 /*
3160- * Copyright 2013 Canonical Ltd.
3161+ * Copyright 2013-2014 Canonical Ltd.
3162 *
3163 * This library is free software; you can redistribute it and/or
3164 * modify it under the terms of version 3 of the GNU Lesser General Public
3165@@ -20,7 +20,7 @@
3166 #define FAKE_QNETWORK_REPLY_H
3167
3168 #include <QNetworkReply>
3169-#include "./fake.h"
3170+#include "ubuntu/download_manager/tests/fake.h"
3171
3172
3173 class FakeQNetworkReply : public QNetworkReply, public Fake {
3174
3175=== renamed file 'ubuntu-download-manager-tests/fakes/fake_download_queue.cpp' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/queue.cpp'
3176--- ubuntu-download-manager-tests/fakes/fake_download_queue.cpp 2014-01-16 15:42:53 +0000
3177+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/queue.cpp 2014-01-22 15:16:38 +0000
3178@@ -16,7 +16,7 @@
3179 * Boston, MA 02110-1301, USA.
3180 */
3181
3182-#include "./fake_download_queue.h"
3183+#include "queue.h"
3184
3185 FakeDownloadQueue::FakeDownloadQueue(QObject *parent)
3186 : Queue(parent),
3187
3188=== renamed file 'ubuntu-download-manager-tests/fakes/fake_download_queue.h' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/queue.h'
3189--- ubuntu-download-manager-tests/fakes/fake_download_queue.h 2014-01-16 15:42:53 +0000
3190+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/queue.h 2014-01-22 15:16:38 +0000
3191@@ -21,9 +21,9 @@
3192 #include <QSharedPointer>
3193 #include <downloads/queue.h>
3194 #include <system/system_network_info.h>
3195-#include "fake.h"
3196+#include "ubuntu/download_manager/tests/fake.h"
3197
3198-using namespace Ubuntu::DownloadManager;
3199+using namespace Ubuntu::DownloadManager::Daemon;
3200
3201 class FakeDownloadQueue : public Queue, public Fake {
3202 Q_OBJECT
3203
3204=== renamed file 'ubuntu-download-manager-tests/fakes/fake_request_factory.cpp' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/request_factory.cpp'
3205--- ubuntu-download-manager-tests/fakes/fake_request_factory.cpp 2013-11-27 15:50:02 +0000
3206+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/request_factory.cpp 2014-01-22 15:16:38 +0000
3207@@ -1,5 +1,5 @@
3208 /*
3209- * Copyright 2013 Canonical Ltd.
3210+ * Copyright 2013-2014 Canonical Ltd.
3211 *
3212 * This library is free software; you can redistribute it and/or
3213 * modify it under the terms of version 3 of the GNU Lesser General Public
3214@@ -17,8 +17,8 @@
3215 */
3216
3217 #include <QDebug>
3218-#include "./fake_network_reply.h"
3219-#include "./fake_request_factory.h"
3220+#include "network_reply.h"
3221+#include "request_factory.h"
3222
3223 RequestWrapper::RequestWrapper(const QNetworkRequest& request, QObject* parent)
3224 : QObject(parent),
3225
3226=== renamed file 'ubuntu-download-manager-tests/fakes/fake_request_factory.h' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/request_factory.h'
3227--- ubuntu-download-manager-tests/fakes/fake_request_factory.h 2013-10-30 11:04:37 +0000
3228+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/request_factory.h 2014-01-22 15:16:38 +0000
3229@@ -1,5 +1,5 @@
3230 /*
3231- * Copyright 2013 Canonical Ltd.
3232+ * Copyright 2013-2014 Canonical Ltd.
3233 *
3234 * This library is free software; you can redistribute it and/or
3235 * modify it under the terms of version 3 of the GNU Lesser General Public
3236@@ -24,7 +24,7 @@
3237 #include <QNetworkReply>
3238 #include <QPair>
3239 #include <system/request_factory.h>
3240-#include "./fake.h"
3241+#include "ubuntu/download_manager/tests/fake.h"
3242
3243 using namespace Ubuntu::DownloadManager::System;
3244
3245
3246=== renamed file 'ubuntu-download-manager-tests/fakes/fake_sm_file_download.cpp' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/sm_file_download.cpp'
3247--- ubuntu-download-manager-tests/fakes/fake_sm_file_download.cpp 2013-11-27 15:50:02 +0000
3248+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/sm_file_download.cpp 2014-01-22 15:16:38 +0000
3249@@ -1,5 +1,5 @@
3250 /*
3251- * Copyright 2013 Canonical Ltd.
3252+ * Copyright 2013-2014 Canonical Ltd.
3253 *
3254 * This library is free software; you can redistribute it and/or
3255 * modify it under the terms of version 3 of the GNU Lesser General Public
3256@@ -16,7 +16,7 @@
3257 * Boston, MA 02110-1301, USA.
3258 */
3259
3260-#include "fake_sm_file_download.h"
3261+#include "sm_file_download.h"
3262
3263 NetworkErrorWrapper::NetworkErrorWrapper(QNetworkReply::NetworkError value,
3264 QObject* parent)
3265
3266=== renamed file 'ubuntu-download-manager-tests/fakes/fake_sm_file_download.h' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/sm_file_download.h'
3267--- ubuntu-download-manager-tests/fakes/fake_sm_file_download.h 2013-11-11 16:14:46 +0000
3268+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/sm_file_download.h 2014-01-22 15:16:38 +0000
3269@@ -1,5 +1,5 @@
3270 /*
3271- * Copyright 2013 Canonical Ltd.
3272+ * Copyright 2013-2014 Canonical Ltd.
3273 *
3274 * This library is free software; you can redistribute it and/or
3275 * modify it under the terms of version 3 of the GNU Lesser General Public
3276@@ -22,9 +22,9 @@
3277 #include <QObject>
3278 #include <QSslError>
3279 #include <downloads/sm_file_download.h>
3280-#include "fakes/fake.h"
3281+#include "ubuntu/download_manager/tests/fake.h"
3282
3283-using namespace Ubuntu::DownloadManager;
3284+using namespace Ubuntu::DownloadManager::Daemon;
3285
3286 class NetworkErrorWrapper : public QObject {
3287 Q_OBJECT
3288
3289=== renamed file 'ubuntu-download-manager-tests/fakes/fake_system_network_info.cpp' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/system_network_info.cpp'
3290--- ubuntu-download-manager-tests/fakes/fake_system_network_info.cpp 2014-01-16 15:42:53 +0000
3291+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/system_network_info.cpp 2014-01-22 15:16:38 +0000
3292@@ -16,7 +16,7 @@
3293 * Boston, MA 02110-1301, USA.
3294 */
3295
3296-#include "./fake_system_network_info.h"
3297+#include "system_network_info.h"
3298
3299 NetworkModeWrapper::NetworkModeWrapper(QNetworkInfo::NetworkMode mode,
3300 QObject *parent)
3301
3302=== renamed file 'ubuntu-download-manager-tests/fakes/fake_system_network_info.h' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/system_network_info.h'
3303--- ubuntu-download-manager-tests/fakes/fake_system_network_info.h 2014-01-16 15:42:53 +0000
3304+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/system_network_info.h 2014-01-22 15:16:38 +0000
3305@@ -21,7 +21,7 @@
3306
3307 #include <QObject>
3308 #include <system/system_network_info.h>
3309-#include "fake.h"
3310+#include "ubuntu/download_manager/tests/fake.h"
3311
3312 using namespace Ubuntu::DownloadManager::System;
3313
3314
3315=== renamed file 'ubuntu-download-manager-tests/fakes/fake_timer.cpp' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/timer.cpp'
3316--- ubuntu-download-manager-tests/fakes/fake_timer.cpp 2014-01-16 15:42:53 +0000
3317+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/timer.cpp 2014-01-22 15:16:38 +0000
3318@@ -16,7 +16,7 @@
3319 * Boston, MA 02110-1301, USA.
3320 */
3321
3322-#include "./fake_timer.h"
3323+#include "timer.h"
3324
3325 FakeTimer::FakeTimer(QObject *parent)
3326 : Timer(parent),
3327
3328=== renamed file 'ubuntu-download-manager-tests/fakes/fake_timer.h' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/timer.h'
3329--- ubuntu-download-manager-tests/fakes/fake_timer.h 2014-01-16 15:42:53 +0000
3330+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/timer.h 2014-01-22 15:16:38 +0000
3331@@ -21,7 +21,7 @@
3332
3333 #include <QObject>
3334 #include <system/timer.h>
3335-#include "fake.h"
3336+#include "ubuntu/download_manager/tests/fake.h"
3337
3338 using namespace Ubuntu::DownloadManager::System;
3339
3340
3341=== renamed file 'ubuntu-download-manager-tests/fakes/fake_uuid_factory.cpp' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/uuid_factory.cpp'
3342--- ubuntu-download-manager-tests/fakes/fake_uuid_factory.cpp 2014-01-16 15:42:53 +0000
3343+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/uuid_factory.cpp 2014-01-22 15:16:38 +0000
3344@@ -16,7 +16,7 @@
3345 * Boston, MA 02110-1301, USA.
3346 */
3347
3348-#include "./fake_uuid_factory.h"
3349+#include "uuid_factory.h"
3350
3351 FakeUuidFactory::FakeUuidFactory(QObject *parent)
3352 : UuidFactory(parent) {
3353
3354=== renamed file 'ubuntu-download-manager-tests/fakes/fake_uuid_factory.h' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/uuid_factory.h'
3355--- ubuntu-download-manager-tests/fakes/fake_uuid_factory.h 2014-01-16 15:42:53 +0000
3356+++ ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/uuid_factory.h 2014-01-22 15:16:38 +0000
3357@@ -21,7 +21,7 @@
3358
3359 #include <QObject>
3360 #include <system/uuid_factory.h>
3361-#include "./fake.h"
3362+#include "ubuntu/download_manager/tests/fake.h"
3363
3364 using namespace Ubuntu::DownloadManager::System;
3365
3366
3367=== renamed file 'ubuntu-download-manager-tests/test_runner.h' => 'ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/test_runner.h'
3368=== added file 'ubuntu-download-manager-test-lib/ubuntudownloadmanagertestlib.cpp'
3369--- ubuntu-download-manager-test-lib/ubuntudownloadmanagertestlib.cpp 1970-01-01 00:00:00 +0000
3370+++ ubuntu-download-manager-test-lib/ubuntudownloadmanagertestlib.cpp 2014-01-22 15:16:38 +0000
3371@@ -0,0 +1,6 @@
3372+#include "ubuntudownloadmanagertestlib.h"
3373+
3374+
3375+Ubuntudownloadmanagertestlib::Ubuntudownloadmanagertestlib()
3376+{
3377+}
3378
3379=== added file 'ubuntu-download-manager-test-lib/ubuntudownloadmanagertestlib.h'
3380--- ubuntu-download-manager-test-lib/ubuntudownloadmanagertestlib.h 1970-01-01 00:00:00 +0000
3381+++ ubuntu-download-manager-test-lib/ubuntudownloadmanagertestlib.h 2014-01-22 15:16:38 +0000
3382@@ -0,0 +1,13 @@
3383+#ifndef UBUNTUDOWNLOADMANAGERTESTLIB_H
3384+#define UBUNTUDOWNLOADMANAGERTESTLIB_H
3385+
3386+#include "ubuntu-download-manager-test-lib_global.h"
3387+
3388+class UBUNTUDOWNLOADMANAGERTESTLIBSHARED_EXPORT Ubuntudownloadmanagertestlib
3389+{
3390+
3391+public:
3392+ Ubuntudownloadmanagertestlib();
3393+};
3394+
3395+#endif // UBUNTUDOWNLOADMANAGERTESTLIB_H
3396
3397=== modified file 'ubuntu-download-manager-tests/downloads/state_machines/test_cancel_download_transition.h'
3398--- ubuntu-download-manager-tests/downloads/state_machines/test_cancel_download_transition.h 2013-10-31 20:58:34 +0000
3399+++ ubuntu-download-manager-tests/downloads/state_machines/test_cancel_download_transition.h 2014-01-22 15:16:38 +0000
3400@@ -1,5 +1,5 @@
3401 /*
3402- * Copyright 2013 Canonical Ltd.
3403+ * Copyright 2013-2014 Canonical Ltd.
3404 *
3405 * This library is free software; you can redistribute it and/or
3406 * modify it under the terms of version 3 of the GNU Lesser General Public
3407@@ -24,12 +24,12 @@
3408 #include <QState>
3409 #include <QStateMachine>
3410 #include <downloads/state_machines/download_sm.h>
3411-#include "base_testcase.h"
3412-#include "test_runner.h"
3413-#include "fakes/fake_sm_file_download.h"
3414-
3415-
3416-using namespace Ubuntu::DownloadManager::StateMachines;
3417+#include <ubuntu/download_manager/tests/base_testcase.h>
3418+#include <ubuntu/download_manager/tests/test_runner.h>
3419+#include <ubuntu/download_manager/tests/server/sm_file_download.h>
3420+
3421+
3422+using namespace Ubuntu::DownloadManager::Daemon::StateMachines;
3423
3424 class TestCancelDownloadTransition : public BaseTestCase {
3425 Q_OBJECT
3426
3427=== modified file 'ubuntu-download-manager-tests/downloads/state_machines/test_file_download_sm.h'
3428--- ubuntu-download-manager-tests/downloads/state_machines/test_file_download_sm.h 2013-11-05 19:24:01 +0000
3429+++ ubuntu-download-manager-tests/downloads/state_machines/test_file_download_sm.h 2014-01-22 15:16:38 +0000
3430@@ -1,5 +1,5 @@
3431 /*
3432- * Copyright 2013 Canonical Ltd.
3433+ * Copyright 2013-2014 Canonical Ltd.
3434 *
3435 * This library is free software; you can redistribute it and/or
3436 * modify it under the terms of version 3 of the GNU Lesser General Public
3437@@ -24,11 +24,11 @@
3438 #include <QStateMachine>
3439 #include <QSignalTransition>
3440 #include <downloads/state_machines/download_sm.h>
3441-#include "base_testcase.h"
3442-#include "test_runner.h"
3443-#include "fakes/fake_sm_file_download.h"
3444+#include <ubuntu/download_manager/tests/base_testcase.h>
3445+#include <ubuntu/download_manager/tests/test_runner.h>
3446+#include <ubuntu/download_manager/tests/server/sm_file_download.h>
3447
3448-using namespace Ubuntu::DownloadManager::StateMachines;
3449+using namespace Ubuntu::DownloadManager::Daemon::StateMachines;
3450
3451 class TestFileDownloadSM : public BaseTestCase {
3452 Q_OBJECT
3453
3454=== modified file 'ubuntu-download-manager-tests/downloads/state_machines/test_final_state.h'
3455--- ubuntu-download-manager-tests/downloads/state_machines/test_final_state.h 2013-11-04 20:04:53 +0000
3456+++ ubuntu-download-manager-tests/downloads/state_machines/test_final_state.h 2014-01-22 15:16:38 +0000
3457@@ -1,5 +1,5 @@
3458 /*
3459- * Copyright 2013 Canonical Ltd.
3460+ * Copyright 2013-2014 Canonical Ltd.
3461 *
3462 * This library is free software; you can redistribute it and/or
3463 * modify it under the terms of version 3 of the GNU Lesser General Public
3464@@ -24,11 +24,11 @@
3465 #include <QStateMachine>
3466 #include <QSignalTransition>
3467 #include <downloads/state_machines/final_state.h>
3468-#include "base_testcase.h"
3469-#include "test_runner.h"
3470-
3471-
3472-using namespace Ubuntu::DownloadManager::StateMachines;
3473+#include <ubuntu/download_manager/tests/base_testcase.h>
3474+#include <ubuntu/download_manager/tests/test_runner.h>
3475+
3476+
3477+using namespace Ubuntu::DownloadManager::Daemon::StateMachines;
3478
3479 class TestFinalStateHelperObject : public QObject {
3480 Q_OBJECT
3481
3482=== modified file 'ubuntu-download-manager-tests/downloads/state_machines/test_network_error_transition.h'
3483--- ubuntu-download-manager-tests/downloads/state_machines/test_network_error_transition.h 2013-10-31 15:50:44 +0000
3484+++ ubuntu-download-manager-tests/downloads/state_machines/test_network_error_transition.h 2014-01-22 15:16:38 +0000
3485@@ -1,5 +1,5 @@
3486 /*
3487- * Copyright 2013 Canonical Ltd.
3488+ * Copyright 2013-2014 Canonical Ltd.
3489 *
3490 * This library is free software; you can redistribute it and/or
3491 * modify it under the terms of version 3 of the GNU Lesser General Public
3492@@ -24,11 +24,11 @@
3493 #include <QStateMachine>
3494 #include <QObject>
3495 #include <downloads/state_machines/download_sm.h>
3496-#include "base_testcase.h"
3497-#include "test_runner.h"
3498-#include "fakes/fake_sm_file_download.h"
3499+#include <ubuntu/download_manager/tests/base_testcase.h>
3500+#include <ubuntu/download_manager/tests/test_runner.h>
3501+#include <ubuntu/download_manager/tests/server/sm_file_download.h>
3502
3503-using namespace Ubuntu::DownloadManager::StateMachines;
3504+using namespace Ubuntu::DownloadManager::Daemon::StateMachines;
3505
3506 class TestNetworkErrorTransition : public BaseTestCase {
3507 Q_OBJECT
3508
3509=== modified file 'ubuntu-download-manager-tests/downloads/state_machines/test_resume_download_transition.h'
3510--- ubuntu-download-manager-tests/downloads/state_machines/test_resume_download_transition.h 2013-11-01 11:06:34 +0000
3511+++ ubuntu-download-manager-tests/downloads/state_machines/test_resume_download_transition.h 2014-01-22 15:16:38 +0000
3512@@ -1,5 +1,5 @@
3513 /*
3514- * Copyright 2013 Canonical Ltd.
3515+ * Copyright 2013-2014 Canonical Ltd.
3516 *
3517 * This library is free software; you can redistribute it and/or
3518 * modify it under the terms of version 3 of the GNU Lesser General Public
3519@@ -24,11 +24,11 @@
3520 #include <QState>
3521 #include <QStateMachine>
3522 #include <downloads/state_machines/download_sm.h>
3523-#include "base_testcase.h"
3524-#include "test_runner.h"
3525-#include "fakes/fake_sm_file_download.h"
3526+#include <ubuntu/download_manager/tests/base_testcase.h>
3527+#include <ubuntu/download_manager/tests/test_runner.h>
3528+#include <ubuntu/download_manager/tests/server/sm_file_download.h>
3529
3530-using namespace Ubuntu::DownloadManager::StateMachines;
3531+using namespace Ubuntu::DownloadManager::Daemon::StateMachines;
3532
3533 class TestResumeDownloadTransition : public BaseTestCase {
3534 Q_OBJECT
3535
3536=== modified file 'ubuntu-download-manager-tests/downloads/state_machines/test_ssl_error_transition.h'
3537--- ubuntu-download-manager-tests/downloads/state_machines/test_ssl_error_transition.h 2013-11-11 10:06:15 +0000
3538+++ ubuntu-download-manager-tests/downloads/state_machines/test_ssl_error_transition.h 2014-01-22 15:16:38 +0000
3539@@ -1,5 +1,5 @@
3540 /*
3541- * Copyright 2013 Canonical Ltd.
3542+ * Copyright 2013-2014 Canonical Ltd.
3543 *
3544 * This library is free software; you can redistribute it and/or
3545 * modify it under the terms of version 3 of the GNU Lesser General Public
3546@@ -24,11 +24,11 @@
3547 #include <QState>
3548 #include <QStateMachine>
3549 #include <downloads/state_machines/download_sm.h>
3550-#include "base_testcase.h"
3551-#include "test_runner.h"
3552-#include "fakes/fake_sm_file_download.h"
3553+#include <ubuntu/download_manager/tests/base_testcase.h>
3554+#include <ubuntu/download_manager/tests/test_runner.h>
3555+#include <ubuntu/download_manager/tests/server/sm_file_download.h>
3556
3557-using namespace Ubuntu::DownloadManager::StateMachines;
3558+using namespace Ubuntu::DownloadManager::Daemon::StateMachines;
3559
3560 class TestSslErrorTransition : public BaseTestCase {
3561 Q_OBJECT
3562
3563=== modified file 'ubuntu-download-manager-tests/downloads/state_machines/test_start_download_transition.h'
3564--- ubuntu-download-manager-tests/downloads/state_machines/test_start_download_transition.h 2013-10-31 18:26:02 +0000
3565+++ ubuntu-download-manager-tests/downloads/state_machines/test_start_download_transition.h 2014-01-22 15:16:38 +0000
3566@@ -1,5 +1,5 @@
3567 /*
3568- * Copyright 2013 Canonical Ltd.
3569+ * Copyright 2013-2014 Canonical Ltd.
3570 *
3571 * This library is free software; you can redistribute it and/or
3572 * modify it under the terms of version 3 of the GNU Lesser General Public
3573@@ -24,11 +24,11 @@
3574 #include <QState>
3575 #include <QStateMachine>
3576 #include <downloads/state_machines/download_sm.h>
3577-#include "base_testcase.h"
3578-#include "test_runner.h"
3579-#include "fakes/fake_sm_file_download.h"
3580+#include <ubuntu/download_manager/tests/base_testcase.h>
3581+#include <ubuntu/download_manager/tests/test_runner.h>
3582+#include <ubuntu/download_manager/tests/server/sm_file_download.h>
3583
3584-using namespace Ubuntu::DownloadManager::StateMachines;
3585+using namespace Ubuntu::DownloadManager::Daemon::StateMachines;
3586
3587 class TestStartDownloadTransition : public BaseTestCase {
3588 Q_OBJECT
3589
3590=== modified file 'ubuntu-download-manager-tests/downloads/state_machines/test_stop_request_transition.h'
3591--- ubuntu-download-manager-tests/downloads/state_machines/test_stop_request_transition.h 2013-11-11 16:12:38 +0000
3592+++ ubuntu-download-manager-tests/downloads/state_machines/test_stop_request_transition.h 2014-01-22 15:16:38 +0000
3593@@ -1,5 +1,5 @@
3594 /*
3595- * Copyright 2013 Canonical Ltd.
3596+ * Copyright 2013-2014 Canonical Ltd.
3597 *
3598 * This library is free software; you can redistribute it and/or
3599 * modify it under the terms of version 3 of the GNU Lesser General Public
3600@@ -24,12 +24,11 @@
3601 #include <QState>
3602 #include <QStateMachine>
3603 #include <downloads/state_machines/download_sm.h>
3604-#include "base_testcase.h"
3605-#include "test_runner.h"
3606-#include "fakes/fake_sm_file_download.h"
3607-
3608-
3609-using namespace Ubuntu::DownloadManager::StateMachines;
3610+#include <ubuntu/download_manager/tests/base_testcase.h>
3611+#include <ubuntu/download_manager/tests/test_runner.h>
3612+#include <ubuntu/download_manager/tests/server/sm_file_download.h>
3613+
3614+using namespace Ubuntu::DownloadManager::Daemon::StateMachines;
3615
3616 class TestStopRequestTransition : public BaseTestCase {
3617 Q_OBJECT
3618
3619=== modified file 'ubuntu-download-manager-tests/downloads/test_daemon.cpp'
3620--- ubuntu-download-manager-tests/downloads/test_daemon.cpp 2013-12-17 13:48:29 +0000
3621+++ ubuntu-download-manager-tests/downloads/test_daemon.cpp 2014-01-22 15:16:38 +0000
3622@@ -1,5 +1,5 @@
3623 /*
3624- * Copyright 2013 Canonical Ltd.
3625+ * Copyright 2013-2014 Canonical Ltd.
3626 *
3627 * This library is free software; you can redistribute it and/or
3628 * modify it under the terms of version 3 of the GNU Lesser General Public
3629@@ -19,6 +19,8 @@
3630 #include <QDebug>
3631 #include "test_daemon.h"
3632
3633+using namespace Ubuntu::DownloadManager;
3634+
3635 TestDaemon::TestDaemon(QObject *parent)
3636 : BaseTestCase("TestDaemon", parent) {
3637 }
3638@@ -46,7 +48,7 @@
3639 app->record();
3640 FakeDownloadManager* man = new FakeDownloadManager(app, conn);
3641
3642- QScopedPointer<Daemon> daemon(new Daemon(app, conn, timer, man, this));
3643+ QScopedPointer<Daemon::Daemon> daemon(new Daemon::Daemon(app, conn, timer, man, this));
3644 daemon->start();
3645
3646 QList<MethodData> calledMethods = conn->calledMethods();
3647@@ -79,7 +81,7 @@
3648 app->record();
3649 FakeDownloadManager* man = new FakeDownloadManager(app, conn);
3650
3651- QScopedPointer<Daemon> daemon(new Daemon(app, conn, timer, man, this));
3652+ QScopedPointer<Daemon::Daemon> daemon(new Daemon::Daemon(app, conn, timer, man, this));
3653 daemon->start(myPath);
3654
3655 QList<MethodData> calledMethods = conn->calledMethods();
3656@@ -110,7 +112,7 @@
3657 app->record();
3658 FakeDownloadManager* man = new FakeDownloadManager(app, conn);
3659
3660- QScopedPointer<Daemon> daemon(new Daemon(app, conn, timer, man, this));
3661+ QScopedPointer<Daemon::Daemon> daemon(new Daemon::Daemon(app, conn, timer, man, this));
3662 daemon->start();
3663
3664 QList<MethodData> calledMethods = conn->calledMethods();
3665@@ -135,7 +137,7 @@
3666 app->record();
3667 FakeDownloadManager* man = new FakeDownloadManager(app, conn);
3668
3669- QScopedPointer<Daemon> daemon(new Daemon(app, conn, timer, man, this));
3670+ QScopedPointer<Daemon::Daemon> daemon(new Daemon::Daemon(app, conn, timer, man, this));
3671 daemon->start();
3672
3673 QList<MethodData> calledMethods = conn->calledMethods();
3674@@ -158,7 +160,7 @@
3675 FakeDBusConnection* conn = new FakeDBusConnection();
3676 FakeApplication* app = new FakeApplication();
3677 FakeDownloadManager* man = new FakeDownloadManager(app, conn);
3678- QScopedPointer<Daemon> daemon(new Daemon(app, conn, timer, man, this));
3679+ QScopedPointer<Daemon::Daemon> daemon(new Daemon::Daemon(app, conn, timer, man, this));
3680
3681 man->emitSizeChaged(1);
3682
3683@@ -176,7 +178,7 @@
3684 FakeDBusConnection* conn = new FakeDBusConnection();
3685 FakeApplication* app = new FakeApplication();
3686 FakeDownloadManager* man = new FakeDownloadManager(app, conn);
3687- QScopedPointer<Daemon> daemon(new Daemon(app, conn, timer, man, this));
3688+ QScopedPointer<Daemon::Daemon> daemon(new Daemon::Daemon(app, conn, timer, man, this));
3689
3690 man->emitSizeChaged(0);
3691
3692@@ -192,7 +194,7 @@
3693 FakeDBusConnection* conn = new FakeDBusConnection();
3694 FakeApplication* app = new FakeApplication();
3695 FakeDownloadManager* man = new FakeDownloadManager(app, conn);
3696- QScopedPointer<Daemon> daemon(new Daemon(app, conn, timer, man, this));
3697+ QScopedPointer<Daemon::Daemon> daemon(new Daemon::Daemon(app, conn, timer, man, this));
3698 app->record();
3699
3700 // emit the timeout signal and assert that exit was called
3701@@ -217,7 +219,7 @@
3702 app->setArguments(args);
3703
3704 // assert that start is never called
3705- QScopedPointer<Daemon> daemon(new Daemon(app, conn, timer, man, this));
3706+ QScopedPointer<Daemon::Daemon> daemon(new Daemon::Daemon(app, conn, timer, man, this));
3707 QList<MethodData> calledMethods = timer->calledMethods();
3708 QCOMPARE(0, calledMethods.count());
3709 }
3710@@ -235,7 +237,7 @@
3711 app->setArguments(args);
3712
3713 // assert that we set the certs
3714- QScopedPointer<Daemon> daemon(new Daemon(app, conn, timer, man, this));
3715+ QScopedPointer<Daemon::Daemon> daemon(new Daemon::Daemon(app, conn, timer, man, this));
3716 QList<MethodData> calledMethods = man->calledMethods();
3717 QCOMPARE(1, calledMethods.count());
3718 QCOMPARE(QString("setAcceptedCertificates"), calledMethods[0].methodName());
3719@@ -253,7 +255,7 @@
3720 app->setArguments(args);
3721
3722 // assert that we do not crash
3723- QScopedPointer<Daemon> daemon(new Daemon(app, conn, timer, man, this));
3724+ QScopedPointer<Daemon::Daemon> daemon(new Daemon::Daemon(app, conn, timer, man, this));
3725 QList<MethodData> calledMethods = man->calledMethods();
3726 QCOMPARE(1, calledMethods.count());
3727 }
3728@@ -274,7 +276,7 @@
3729 FakeDownloadManager* man = new FakeDownloadManager(app, conn);
3730
3731 QFETCH(bool, enabled);
3732- QScopedPointer<Daemon> daemon(new Daemon(app, conn, timer, man, this));
3733+ QScopedPointer<Daemon::Daemon> daemon(new Daemon::Daemon(app, conn, timer, man, this));
3734 daemon->setStoppable(enabled);
3735 QCOMPARE(daemon->isStoppable(), enabled);
3736 }
3737@@ -295,7 +297,7 @@
3738 FakeDownloadManager* man = new FakeDownloadManager(app, conn);
3739
3740 QFETCH(bool, enabled);
3741- QScopedPointer<Daemon> daemon(new Daemon(app, conn, timer, man, this));
3742+ QScopedPointer<Daemon::Daemon> daemon(new Daemon::Daemon(app, conn, timer, man, this));
3743 daemon->enableTimeout(enabled);
3744 QCOMPARE(enabled, daemon->isTimeoutEnabled());
3745 }
3746@@ -309,7 +311,7 @@
3747
3748 QList<QSslCertificate> certs = QSslCertificate::fromPath(
3749 dataDirectory() + "/*.pem");
3750- QScopedPointer<Daemon> daemon(new Daemon(app, conn, timer, man, this));
3751+ QScopedPointer<Daemon::Daemon> daemon(new Daemon::Daemon(app, conn, timer, man, this));
3752 daemon->setSelfSignedCerts(certs);
3753 QList<QSslCertificate> daemonCerts = daemon->selfSignedCerts();
3754 QCOMPARE(certs.count(), daemonCerts.count());
3755
3756=== modified file 'ubuntu-download-manager-tests/downloads/test_daemon.h'
3757--- ubuntu-download-manager-tests/downloads/test_daemon.h 2013-11-29 16:18:38 +0000
3758+++ ubuntu-download-manager-tests/downloads/test_daemon.h 2014-01-22 15:16:38 +0000
3759@@ -1,5 +1,5 @@
3760 /*
3761- * Copyright 2013 Canonical Ltd.
3762+ * Copyright 2013-2014 Canonical Ltd.
3763 *
3764 * This library is free software; you can redistribute it and/or
3765 * modify it under the terms of version 3 of the GNU Lesser General Public
3766@@ -21,12 +21,12 @@
3767
3768 #include <QObject>
3769 #include <downloads/daemon.h>
3770-#include "fakes/fake_application.h"
3771-#include "fakes/fake_dbus_connection.h"
3772-#include "fakes/fake_download_manager.h"
3773-#include "fakes/fake_timer.h"
3774-#include "base_testcase.h"
3775-#include "test_runner.h"
3776+#include <ubuntu/download_manager/tests/server/application.h>
3777+#include <ubuntu/download_manager/tests/server/dbus_connection.h>
3778+#include <ubuntu/download_manager/tests/server/manager.h>
3779+#include <ubuntu/download_manager/tests/server/timer.h>
3780+#include <ubuntu/download_manager/tests/base_testcase.h>
3781+#include <ubuntu/download_manager/tests/test_runner.h>
3782
3783 class TestDaemon : public BaseTestCase {
3784 Q_OBJECT
3785
3786=== modified file 'ubuntu-download-manager-tests/downloads/test_download.cpp'
3787--- ubuntu-download-manager-tests/downloads/test_download.cpp 2014-01-16 13:34:17 +0000
3788+++ ubuntu-download-manager-tests/downloads/test_download.cpp 2014-01-22 15:16:38 +0000
3789@@ -1,5 +1,5 @@
3790 /*
3791- * Copyright 2013 Canonical Ltd.
3792+ * Copyright 2013-2014 Canonical Ltd.
3793 *
3794 * This library is free software; you can redistribute it and/or
3795 * modify it under the terms of version 3 of the GNU Lesser General Public
3796@@ -22,11 +22,11 @@
3797 #include <QSslError>
3798 #include <ubuntu/download_manager/system/hash_algorithm.h>
3799 #include <system/uuid_utils.h>
3800-#include "fakes/fake_network_reply.h"
3801-#include "fakes/fake_process.h"
3802+#include <ubuntu/download_manager/tests/server/network_reply.h>
3803+#include <ubuntu/download_manager/tests/server/process.h>
3804 #include "test_download.h"
3805
3806-using namespace Ubuntu::DownloadManager;
3807+using namespace Ubuntu::DownloadManager::Daemon;
3808
3809 TestDownload::TestDownload(QObject* parent)
3810 : BaseTestCase("TestDownload", parent) {
3811
3812=== modified file 'ubuntu-download-manager-tests/downloads/test_download.h'
3813--- ubuntu-download-manager-tests/downloads/test_download.h 2014-01-16 13:34:17 +0000
3814+++ ubuntu-download-manager-tests/downloads/test_download.h 2014-01-22 15:16:38 +0000
3815@@ -1,5 +1,5 @@
3816 /*
3817- * Copyright 2013 Canonical Ltd.
3818+ * Copyright 2013-2014 Canonical Ltd.
3819 *
3820 * This library is free software; you can redistribute it and/or
3821 * modify it under the terms of version 3 of the GNU Lesser General Public
3822@@ -23,12 +23,12 @@
3823 #include <QObject>
3824 #include <downloads/file_download.h>
3825 #include <ubuntu/download_manager/metatypes.h>
3826-#include "fakes/fake_system_network_info.h"
3827-#include "fakes/fake_request_factory.h"
3828-#include "fakes/fake_process_factory.h"
3829-#include "fakes/fake_file_manager.h"
3830-#include "base_testcase.h"
3831-#include "test_runner.h"
3832+#include <ubuntu/download_manager/tests/server/file_manager.h>
3833+#include <ubuntu/download_manager/tests/server/system_network_info.h>
3834+#include <ubuntu/download_manager/tests/server/request_factory.h>
3835+#include <ubuntu/download_manager/tests/server/process_factory.h>
3836+#include <ubuntu/download_manager/tests/base_testcase.h>
3837+#include <ubuntu/download_manager/tests/test_runner.h>
3838
3839 class TestDownload: public BaseTestCase {
3840 Q_OBJECT
3841
3842=== modified file 'ubuntu-download-manager-tests/downloads/test_download_factory.h'
3843--- ubuntu-download-manager-tests/downloads/test_download_factory.h 2013-11-27 13:06:46 +0000
3844+++ ubuntu-download-manager-tests/downloads/test_download_factory.h 2014-01-22 15:16:38 +0000
3845@@ -1,5 +1,5 @@
3846 /*
3847- * Copyright 2013 Canonical Ltd.
3848+ * Copyright 2013-2014 Canonical Ltd.
3849 *
3850 * This library is free software; you can redistribute it and/or
3851 * modify it under the terms of version 3 of the GNU Lesser General Public
3852@@ -21,15 +21,16 @@
3853
3854 #include <QObject>
3855 #include <downloads/factory.h>
3856-#include "fakes/fake_apparmor.h"
3857-#include "fakes/fake_system_network_info.h"
3858-#include "fakes/fake_request_factory.h"
3859-#include "fakes/fake_process_factory.h"
3860-#include "fakes/fake_uuid_factory.h"
3861-#include "base_testcase.h"
3862-#include "test_runner.h"
3863+#include <ubuntu/download_manager/tests/server/apparmor.h>
3864+#include <ubuntu/download_manager/tests/server/system_network_info.h>
3865+#include <ubuntu/download_manager/tests/server/request_factory.h>
3866+#include <ubuntu/download_manager/tests/server//process_factory.h>
3867+#include <ubuntu/download_manager/tests/server/uuid_factory.h>
3868+#include <ubuntu/download_manager/tests/base_testcase.h>
3869+#include <ubuntu/download_manager/tests/test_runner.h>
3870
3871 using namespace Ubuntu::DownloadManager;
3872+using namespace Ubuntu::DownloadManager::Daemon;
3873
3874 class TestDownloadFactory : public BaseTestCase {
3875 Q_OBJECT
3876
3877=== modified file 'ubuntu-download-manager-tests/downloads/test_download_manager.cpp'
3878--- ubuntu-download-manager-tests/downloads/test_download_manager.cpp 2013-12-02 12:03:18 +0000
3879+++ ubuntu-download-manager-tests/downloads/test_download_manager.cpp 2014-01-22 15:16:38 +0000
3880@@ -1,5 +1,5 @@
3881 /*
3882- * Copyright 2013 Canonical Ltd.
3883+ * Copyright 2013-2014 Canonical Ltd.
3884 *
3885 * This library is free software; you can redistribute it and/or
3886 * modify it under the terms of version 3 of the GNU Lesser General Public
3887@@ -20,8 +20,8 @@
3888 #include <downloads/factory.h>
3889 #include <ubuntu/download_manager/download_struct.h>
3890 #include <system/uuid_utils.h>
3891-#include "fakes/fake_process_factory.h"
3892-#include "fakes/fake_system_network_info.h"
3893+#include <ubuntu/download_manager/tests/server/process_factory.h>
3894+#include <ubuntu/download_manager/tests/server/system_network_info.h>
3895 #include "test_download_manager.h"
3896
3897 TestDownloadManager::TestDownloadManager(QObject *parent)
3898
3899=== modified file 'ubuntu-download-manager-tests/downloads/test_download_manager.h'
3900--- ubuntu-download-manager-tests/downloads/test_download_manager.h 2013-11-28 16:01:44 +0000
3901+++ ubuntu-download-manager-tests/downloads/test_download_manager.h 2014-01-22 15:16:38 +0000
3902@@ -1,5 +1,5 @@
3903 /*
3904- * Copyright 2013 Canonical Ltd.
3905+ * Copyright 2013-2014 Canonical Ltd.
3906 *
3907 * This library is free software; you can redistribute it and/or
3908 * modify it under the terms of version 3 of the GNU Lesser General Public
3909@@ -23,16 +23,19 @@
3910 #include <QSharedPointer>
3911 #include <downloads/manager.h>
3912 #include <downloads/file_download.h>
3913-#include "fakes/fake_application.h"
3914-#include "fakes/fake_apparmor.h"
3915-#include "fakes/fake_dbus_connection.h"
3916-#include "fakes/fake_download_queue.h"
3917-#include "fakes/fake_download_factory.h"
3918-#include "fakes/fake_request_factory.h"
3919-#include "fakes/fake_uuid_factory.h"
3920-#include "fakes/fake_system_network_info.h"
3921-#include "test_runner.h"
3922-#include "base_testcase.h"
3923+#include <ubuntu/download_manager/tests/server/application.h>
3924+#include <ubuntu/download_manager/tests/server/apparmor.h>
3925+#include <ubuntu/download_manager/tests/server/dbus_connection.h>
3926+#include <ubuntu/download_manager/tests/server/queue.h>
3927+#include <ubuntu/download_manager/tests/server/factory.h>
3928+#include <ubuntu/download_manager/tests/server/request_factory.h>
3929+#include <ubuntu/download_manager/tests/server/uuid_factory.h>
3930+#include <ubuntu/download_manager/tests/server/system_network_info.h>
3931+#include <ubuntu/download_manager/tests/test_runner.h>
3932+#include <ubuntu/download_manager/tests/base_testcase.h>
3933+
3934+using namespace Ubuntu::DownloadManager;
3935+using namespace Ubuntu::DownloadManager::Daemon;
3936
3937 class TestDownloadManager : public BaseTestCase {
3938 Q_OBJECT
3939
3940=== modified file 'ubuntu-download-manager-tests/downloads/test_download_queue.h'
3941--- ubuntu-download-manager-tests/downloads/test_download_queue.h 2014-01-16 15:42:53 +0000
3942+++ ubuntu-download-manager-tests/downloads/test_download_queue.h 2014-01-22 15:16:38 +0000
3943@@ -22,12 +22,12 @@
3944 #include <QObject>
3945 #include <downloads/download_adaptor.h>
3946 #include <downloads/queue.h>
3947-#include "fakes/fake_download.h"
3948-#include "fakes/fake_request_factory.h"
3949-#include "fakes/fake_process_factory.h"
3950-#include "fakes/fake_system_network_info.h"
3951-#include "test_runner.h"
3952-#include "base_testcase.h"
3953+#include <ubuntu/download_manager/tests/server/download.h>
3954+#include <ubuntu/download_manager/tests/server/request_factory.h>
3955+#include <ubuntu/download_manager/tests/server/process_factory.h>
3956+#include <ubuntu/download_manager/tests/server/system_network_info.h>
3957+#include <ubuntu/download_manager/tests/test_runner.h>
3958+#include <ubuntu/download_manager/tests/base_testcase.h>
3959
3960 class TestDownloadQueue : public BaseTestCase {
3961 Q_OBJECT
3962
3963=== modified file 'ubuntu-download-manager-tests/downloads/test_downloads_db.cpp'
3964--- ubuntu-download-manager-tests/downloads/test_downloads_db.cpp 2014-01-16 15:42:53 +0000
3965+++ ubuntu-download-manager-tests/downloads/test_downloads_db.cpp 2014-01-22 15:16:38 +0000
3966@@ -25,10 +25,10 @@
3967 #include <ubuntu/download_manager/metatypes.h>
3968 #include <ubuntu/download_manager/system/hash_algorithm.h>
3969 #include <system/uuid_utils.h>
3970-#include "fakes/fake_download.h"
3971-#include "fakes/fake_system_network_info.h"
3972-#include "fakes/fake_request_factory.h"
3973-#include "fakes/fake_process_factory.h"
3974+#include <ubuntu/download_manager/tests/server/download.h>
3975+#include <ubuntu/download_manager/tests/server/system_network_info.h>
3976+#include <ubuntu/download_manager/tests/server/request_factory.h>
3977+#include <ubuntu/download_manager/tests/server/process_factory.h>
3978 #include "test_downloads_db.h"
3979
3980 #define TABLE_EXISTS "SELECT count(name) FROM sqlite_master "\
3981
3982=== modified file 'ubuntu-download-manager-tests/downloads/test_downloads_db.h'
3983--- ubuntu-download-manager-tests/downloads/test_downloads_db.h 2013-10-30 11:04:37 +0000
3984+++ ubuntu-download-manager-tests/downloads/test_downloads_db.h 2014-01-22 15:16:38 +0000
3985@@ -1,5 +1,5 @@
3986 /*
3987- * Copyright 2013 Canonical Ltd.
3988+ * Copyright 2013-2014 Canonical Ltd.
3989 *
3990 * This library is free software; you can redistribute it and/or
3991 * modify it under the terms of version 3 of the GNU Lesser General Public
3992@@ -22,10 +22,10 @@
3993 #include <QObject>
3994 #include <QSqlDatabase>
3995 #include <downloads/downloads_db.h>
3996-#include "base_testcase.h"
3997-#include "test_runner.h"
3998+#include <ubuntu/download_manager/tests/base_testcase.h>
3999+#include <ubuntu/download_manager/tests/test_runner.h>
4000
4001-using namespace Ubuntu::DownloadManager;
4002+using namespace Ubuntu::DownloadManager::Daemon;
4003
4004 class TestDownloadsDb : public BaseTestCase {
4005 Q_OBJECT
4006
4007=== modified file 'ubuntu-download-manager-tests/downloads/test_group_download.cpp'
4008--- ubuntu-download-manager-tests/downloads/test_group_download.cpp 2013-11-28 15:04:52 +0000
4009+++ ubuntu-download-manager-tests/downloads/test_group_download.cpp 2014-01-22 15:16:38 +0000
4010@@ -1,5 +1,5 @@
4011 /*
4012- * Copyright 2013 Canonical Ltd.
4013+ * Copyright 2013-2014 Canonical Ltd.
4014 *
4015 * This library is free software; you can redistribute it and/or
4016 * modify it under the terms of version 3 of the GNU Lesser General Public
4017@@ -20,7 +20,7 @@
4018 #include <QSignalSpy>
4019 #include <downloads/group_download.h>
4020 #include <system/uuid_utils.h>
4021-#include "fakes/fake_download.h"
4022+#include <ubuntu/download_manager/tests/server/download.h>
4023 #include "test_group_download.h"
4024
4025 TestGroupDownload::TestGroupDownload(QObject *parent)
4026
4027=== modified file 'ubuntu-download-manager-tests/downloads/test_group_download.h'
4028--- ubuntu-download-manager-tests/downloads/test_group_download.h 2013-11-28 11:48:02 +0000
4029+++ ubuntu-download-manager-tests/downloads/test_group_download.h 2014-01-22 15:16:38 +0000
4030@@ -1,5 +1,5 @@
4031 /*
4032- * Copyright 2013 Canonical Ltd.
4033+ * Copyright 2013-2014 Canonical Ltd.
4034 *
4035 * This library is free software; you can redistribute it and/or
4036 * modify it under the terms of version 3 of the GNU Lesser General Public
4037@@ -22,14 +22,17 @@
4038 #include <QObject>
4039 #include <system/uuid_factory.h>
4040 #include <downloads/group_download.h>
4041-#include "fakes/fake_apparmor.h"
4042-#include "fakes/fake_file_manager.h"
4043-#include "fakes/fake_system_network_info.h"
4044-#include "fakes/fake_request_factory.h"
4045-#include "fakes/fake_process_factory.h"
4046-#include "fakes/fake_download_factory.h"
4047-#include "base_testcase.h"
4048-#include "test_runner.h"
4049+#include <ubuntu/download_manager/tests/server/apparmor.h>
4050+#include <ubuntu/download_manager/tests/server/file_manager.h>
4051+#include <ubuntu/download_manager/tests/server/system_network_info.h>
4052+#include <ubuntu/download_manager/tests/server/request_factory.h>
4053+#include <ubuntu/download_manager/tests/server/process_factory.h>
4054+#include <ubuntu/download_manager/tests/server/factory.h>
4055+#include <ubuntu/download_manager/tests/base_testcase.h>
4056+#include <ubuntu/download_manager/tests/test_runner.h>
4057+
4058+using namespace Ubuntu::DownloadManager;
4059+using namespace Ubuntu::DownloadManager::Daemon;
4060
4061 class TestGroupDownload : public BaseTestCase {
4062 Q_OBJECT
4063
4064=== removed directory 'ubuntu-download-manager-tests/fakes'
4065=== modified file 'ubuntu-download-manager-tests/main.cpp'
4066--- ubuntu-download-manager-tests/main.cpp 2013-07-23 18:03:37 +0000
4067+++ ubuntu-download-manager-tests/main.cpp 2014-01-22 15:16:38 +0000
4068@@ -1,5 +1,5 @@
4069 /*
4070- * Copyright 2013 Canonical Ltd.
4071+ * Copyright 2013-2014 Canonical Ltd.
4072 *
4073 * This library is free software; you can redistribute it and/or
4074 * modify it under the terms of version 3 of the GNU Lesser General Public
4075@@ -17,7 +17,7 @@
4076 */
4077
4078 #include <QCoreApplication>
4079-#include "./test_runner.h"
4080+#include <ubuntu/download_manager/tests/test_runner.h>
4081
4082 int main(int argc, char *argv[]) {
4083 QCoreApplication a(argc, argv);
4084
4085=== modified file 'ubuntu-download-manager-tests/ubuntu-download-manager-tests.pro'
4086--- ubuntu-download-manager-tests/ubuntu-download-manager-tests.pro 2013-12-04 11:14:36 +0000
4087+++ ubuntu-download-manager-tests/ubuntu-download-manager-tests.pro 2014-01-22 15:16:38 +0000
4088@@ -17,28 +17,9 @@
4089 downloads/test_group_download.cpp \
4090 downloads/test_downloads_db.cpp \
4091 downloads/test_download_factory.cpp \
4092- fakes/fake.cpp \
4093- fakes/fake_dbus_connection.cpp \
4094- fakes/fake_download.cpp \
4095- fakes/fake_network_reply.cpp \
4096- fakes/fake_qnetwork_reply.cpp \
4097- fakes/fake_request_factory.cpp \
4098- fakes/fake_download_queue.cpp \
4099- fakes/fake_uuid_factory.cpp \
4100- fakes/fake_system_network_info.cpp \
4101- fakes/fake_process.cpp \
4102- fakes/fake_process_factory.cpp \
4103- fakes/fake_application.cpp \
4104- fakes/fake_timer.cpp \
4105- fakes/fake_download_manager.cpp \
4106- fakes/fake_download_factory.cpp \
4107- fakes/fake_file_manager.cpp \
4108- fakes/fake_apparmor.cpp \
4109 main.cpp \
4110- base_testcase.cpp \
4111 downloads/state_machines/test_network_error_transition.cpp \
4112 downloads/state_machines/test_ssl_error_transition.cpp \
4113- fakes/fake_sm_file_download.cpp \
4114 downloads/state_machines/test_start_download_transition.cpp \
4115 downloads/state_machines/test_stop_request_transition.cpp \
4116 downloads/state_machines/test_cancel_download_transition.cpp \
4117@@ -54,28 +35,8 @@
4118 downloads/test_group_download.h \
4119 downloads/test_downloads_db.h \
4120 downloads/test_download_factory.h \
4121- fakes/fake.h \
4122- fakes/fake_dbus_connection.h \
4123- fakes/fake_download.h \
4124- fakes/fake_network_reply.h \
4125- fakes/fake_qnetwork_reply.h \
4126- fakes/fake_request_factory.h \
4127- fakes/fake_download_queue.h \
4128- fakes/fake_uuid_factory.h \
4129- fakes/fake_system_network_info.h \
4130- fakes/fake_process.h \
4131- fakes/fake_process_factory.h \
4132- fakes/fake_application.h \
4133- fakes/fake_timer.h \
4134- fakes/fake_download_manager.h \
4135- fakes/fake_download_factory.h \
4136- fakes/fake_file_manager.h \
4137- fakes/fake_apparmor.h \
4138- test_runner.h \
4139- base_testcase.h \
4140 downloads/state_machines/test_network_error_transition.h \
4141 downloads/state_machines/test_ssl_error_transition.h \
4142- fakes/fake_sm_file_download.h \
4143 downloads/state_machines/test_start_download_transition.h \
4144 downloads/state_machines/test_stop_request_transition.h \
4145 downloads/state_machines/test_cancel_download_transition.h \
4146@@ -93,6 +54,11 @@
4147 INCLUDEPATH += $$PWD/../ubuntu-download-manager-common
4148 DEPENDPATH += $$PWD/../ubuntu-udownload-manager-common
4149
4150+LIBS += -L$$OUT_PWD/../ubuntu-download-manager-test-lib/ -lubuntu-download-manager-test-lib
4151+
4152+INCLUDEPATH += $$PWD/../ubuntu-download-manager-test-lib
4153+DEPENDPATH += $$PWD/../ubuntu-download-manager-test-lib
4154+
4155 check.depends = $${TARGET}
4156-check.commands = LD_LIBRARY_PATH=$$OUT_PWD/../ubuntu-download-manager-common:$$OUT_PWD/../ubuntu-download-manager-priv ./$${TARGET}
4157+check.commands = LD_LIBRARY_PATH=$$OUT_PWD/../ubuntu-download-manager-common:$$OUT_PWD/../ubuntu-download-manager-priv:$$OUT_PWD/../ubuntu-download-manager-test-lib ./$${TARGET}
4158 QMAKE_EXTRA_TARGETS += check
4159
4160=== modified file 'ubuntu-download-manager/main.cpp'
4161--- ubuntu-download-manager/main.cpp 2013-10-25 11:44:53 +0000
4162+++ ubuntu-download-manager/main.cpp 2014-01-22 15:16:38 +0000
4163@@ -1,5 +1,5 @@
4164 /*
4165- * Copyright 2013 Canonical Ltd.
4166+ * Copyright 2013-2014 Canonical Ltd.
4167 *
4168 * This library is free software; you can redistribute it and/or
4169 * modify it under the terms of version 3 of the GNU Lesser General Public
4170@@ -20,11 +20,12 @@
4171 #include <QCoreApplication>
4172 #include <downloads/daemon.h>
4173
4174+using namespace Ubuntu::DownloadManager::Daemon;
4175+
4176 int main(int argc, char *argv[]) {
4177 QCoreApplication a(argc, argv);
4178
4179- Ubuntu::DownloadManager::Daemon* daemon =
4180- new Ubuntu::DownloadManager::Daemon();
4181+ Daemon* daemon = new Daemon();
4182 // use a singleShot timer so that we start after exec so that exit works
4183 QTimer::singleShot(0, daemon, SLOT(start()));
4184

Subscribers

People subscribed via source and target branches