Merge lp:~mandel/ubuntu-download-manager/adapt-network-changes into lp:ubuntu-download-manager

Proposed by Manuel de la Peña
Status: Merged
Approved by: Manuel de la Peña
Approved revision: 346
Merged at revision: 331
Proposed branch: lp:~mandel/ubuntu-download-manager/adapt-network-changes
Merge into: lp:ubuntu-download-manager
Diff against target: 2377 lines (+565/-611)
47 files modified
CMakeLists.txt (+0/-1)
debian/changelog (+8/-0)
debian/control (+2/-3)
src/common/priv/CMakeLists.txt (+4/-4)
src/common/priv/ubuntu/transfers/queue.cpp (+8/-11)
src/common/priv/ubuntu/transfers/queue.h (+3/-1)
src/common/priv/ubuntu/transfers/system/dbus_proxy.h (+1/-1)
src/common/priv/ubuntu/transfers/system/network_reply.cpp (+4/-1)
src/common/priv/ubuntu/transfers/system/network_session.cpp (+162/-0)
src/common/priv/ubuntu/transfers/system/network_session.h (+80/-0)
src/common/priv/ubuntu/transfers/system/nm_interface.cpp (+26/-0)
src/common/priv/ubuntu/transfers/system/nm_interface.h (+48/-0)
src/common/priv/ubuntu/transfers/system/system_network_info.cpp (+0/-237)
src/common/priv/ubuntu/transfers/system/system_network_info.h (+0/-104)
src/common/priv/ubuntu/transfers/transfer.cpp (+17/-14)
src/common/priv/ubuntu/transfers/transfer.h (+2/-2)
src/downloads/priv/CMakeLists.txt (+0/-1)
src/downloads/priv/ubuntu/downloads/download.h (+0/-1)
src/downloads/priv/ubuntu/downloads/factory.h (+0/-1)
src/downloads/priv/ubuntu/downloads/file_download.cpp (+2/-3)
src/downloads/test-daemon/CMakeLists.txt (+0/-2)
src/uploads/priv/CMakeLists.txt (+0/-1)
src/uploads/priv/ubuntu/uploads/factory.h (+0/-1)
tests/common/CMakeLists.txt (+5/-7)
tests/common/daemon_testcase.cpp (+1/-0)
tests/common/network_session.h (+54/-0)
tests/common/system_network_info.h (+0/-61)
tests/downloads/client/CMakeLists.txt (+1/-2)
tests/downloads/daemon/CMakeLists.txt (+0/-1)
tests/downloads/daemon/test_daemon.cpp (+3/-1)
tests/downloads/daemon/test_download.cpp (+114/-126)
tests/downloads/daemon/test_download.h (+3/-3)
tests/downloads/daemon/test_download_factory.cpp (+2/-1)
tests/downloads/daemon/test_download_factory.h (+0/-1)
tests/downloads/daemon/test_download_manager.cpp (+2/-2)
tests/downloads/daemon/test_download_manager.h (+1/-1)
tests/downloads/daemon/test_downloads_db.cpp (+2/-2)
tests/downloads/daemon/test_group_download.cpp (+1/-1)
tests/downloads/daemon/test_group_download.h (+2/-2)
tests/downloads/daemon/test_transfers_queue.cpp (+3/-3)
tests/downloads/daemon/test_transfers_queue.h (+2/-2)
tests/downloads/qml/CMakeLists.txt (+0/-1)
tests/uploads/daemon/CMakeLists.txt (+0/-1)
tests/uploads/daemon/test_file_upload.h (+0/-1)
tests/uploads/daemon/test_mms_upload.h (+0/-1)
tests/uploads/daemon/test_upload_factory.cpp (+1/-1)
tests/uploads/daemon/test_upload_factory.h (+1/-1)
To merge this branch: bzr merge lp:~mandel/ubuntu-download-manager/adapt-network-changes
Reviewer Review Type Date Requested Status
Manuel de la Peña (community) Approve
PS Jenkins bot continuous-integration Approve
Barry Warsaw (community) Approve
Review via email: mp+242083@code.launchpad.net

Commit message

Ensure that the download manager does track network changes correctly.

Description of the change

Remove the usage of QSystemNetworkInfo and trust the QNetworkSession that does listen to the correct network changes.

The way to test this is to perform a download (click, update or manually following the test plan) and remove the wifi connection in between of the download. The download should be paused until the network is recovered.

To post a comment you must log in.
339. By Manuel de la Peña

Connect before we open.

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

I tested this on the krillin/devel channel (i.e. vivid) with the built .debs by doing the following:

Flashed the device to r37 and then hacked channel.ini to 36 as per:

https://wiki.ubuntu.com/Process/Merges/TestPlan/ubuntu-system-image

adb shell & sudo, then

$ system-image-cli -vv

As soon as the console indicated that the data files were starting to download, I shut off my wifi. I saw the download pause. Then I waited 15 seconds and turned the wifi back on. About another 30 seconds later, the device reconnected and the download resumed.

However, the download failed with the following traceback:

[systemimage] Nov 18 20:57:50 2014 (15059) uncaught exception in state machine
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/systemimage/state.py", line 123, in __next__
    step()
  File "/usr/lib/python3/dist-packages/systemimage/state.py", line 491, in _download_files
    self.downloader.get_files(downloads, pausable=True)
  File "/usr/lib/python3/dist-packages/systemimage/download.py", line 289, in get_files
    raise FileNotFoundError(reactor.error)
FileNotFoundError: http://system-image.ubuntu.com/pool/device-5533ed5d544bfe1c12e3e756907fa3258e8f03023ea1bfe4536f0fc08122673a.tar.xz:
[systemimage] Nov 18 20:57:50 2014 (15059) system-image-cli exception
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/systemimage/main.py", line 340, in main
    list(state)
  File "/usr/lib/python3/dist-packages/systemimage/state.py", line 123, in __next__
    step()
  File "/usr/lib/python3/dist-packages/systemimage/state.py", line 491, in _download_files
    self.downloader.get_files(downloads, pausable=True)
  File "/usr/lib/python3/dist-packages/systemimage/download.py", line 289, in get_files
    raise FileNotFoundError(reactor.error)
FileNotFoundError: http://system-image.ubuntu.com/pool/device-5533ed5d544bfe1c12e3e756907fa3258e8f03023ea1bfe4536f0fc08122673a.tar.xz:

I wonder if the file whose download got paused was corrupted when the download resumed?

review: Needs Fixing (testing)
340. By Manuel de la Peña

Adding extra logging.

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

Use the NM properties change signal.

342. By Manuel de la Peña

Use the nm signal.

343. By Manuel de la Peña

Add missing headers.

344. By Manuel de la Peña

Remove qDebug msgs.

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

Yep, the latest builds work for me.

$ system-image-cli -b 0 -vv

During the download of the data files, I shut off the wifi, and the downloads paused as expected. Then after a few seconds, I turned the wifi back on and udm soon noticed the connection was re-established. The download continued, and all files verified. The reboot occurred as expected.

review: Approve
Revision history for this message
Manuel de la Peña (mandel) wrote :

\o/ awesome. I'll get a code review and will deal with the silo etc.. to land this asap

345. By Manuel de la Peña

Deal with ethernet to make sure we are ok on the desktop.

346. By Manuel de la Peña

Just emit the signal when we change.

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

Be prepared for interface errors.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2014-09-27 13:16:11 +0000
3+++ CMakeLists.txt 2014-11-26 12:24:23 +0000
4@@ -43,7 +43,6 @@
5 find_package(Qt5Core REQUIRED)
6 find_package(Qt5DBus REQUIRED)
7 find_package(Qt5Network REQUIRED)
8-find_package(Qt5SystemInfo REQUIRED)
9 find_package(Qt5Sql REQUIRED)
10 find_package(Qt5Test REQUIRED)
11 find_package(Boost COMPONENTS log program_options REQUIRED)
12
13=== modified file 'debian/changelog'
14--- debian/changelog 2014-10-14 16:08:13 +0000
15+++ debian/changelog 2014-11-26 12:24:23 +0000
16@@ -1,3 +1,11 @@
17+ubuntu-download-manager (0.9+14.10.20141014.1-0ubuntu3) UNRELEASED; urgency=medium
18+
19+ * Fix issues with the network detection. Because of the new approach two
20+ dependencies have been dropped.
21+ * Add network manager as dependency.
22+
23+ -- Manuel de la Pena <manuel.delapena@canonical.com> Wed, 26 Nov 2014 12:47:31 +0100
24+
25 ubuntu-download-manager (0.9+14.10.20141014.1-0ubuntu1) 14.09; urgency=medium
26
27 [ Manuel de la Pena ]
28
29=== modified file 'debian/control'
30--- debian/control 2014-10-14 16:07:44 +0000
31+++ debian/control 2014-11-26 12:24:23 +0000
32@@ -7,10 +7,8 @@
33 doxygen,
34 dbus-test-runner,
35 google-mock,
36- qt5-qmake,
37 qt5-default,
38 qtbase5-dev,
39- qtsystems5-dev,
40 libboost-log-dev,
41 libboost-program-options-dev,
42 libdbus-1-dev,
43@@ -19,7 +17,8 @@
44 libgoogle-glog-dev,
45 qtdeclarative5-dev,
46 qtdeclarative5-dev-tools,
47- qtdeclarative5-test-plugin
48+ qtdeclarative5-test-plugin,
49+ network-manager
50 Maintainer: Manuel de la Peña <manuel.delapena@canonical.com>
51 Standards-Version: 3.9.5
52 Homepage: https://launchpad.net/ubuntu-system-image
53
54=== modified file 'src/common/priv/CMakeLists.txt'
55--- src/common/priv/CMakeLists.txt 2014-04-23 14:51:21 +0000
56+++ src/common/priv/CMakeLists.txt 2014-11-26 12:24:23 +0000
57@@ -15,10 +15,11 @@
58 ubuntu/transfers/system/file_manager.cpp
59 ubuntu/transfers/system/filename_mutex.cpp
60 ubuntu/transfers/system/network_reply.cpp
61+ ubuntu/transfers/system/network_session.cpp
62+ ubuntu/transfers/system/nm_interface.cpp
63 ubuntu/transfers/system/process.cpp
64 ubuntu/transfers/system/process_factory.cpp
65 ubuntu/transfers/system/request_factory.cpp
66- ubuntu/transfers/system/system_network_info.cpp
67 ubuntu/transfers/system/timer.cpp
68 ubuntu/transfers/system/uuid_factory.cpp
69 ubuntu/transfers/system/uuid_utils.cpp
70@@ -41,17 +42,17 @@
71 ubuntu/transfers/system/file_manager.h
72 ubuntu/transfers/system/filename_mutex.h
73 ubuntu/transfers/system/network_reply.h
74+ ubuntu/transfers/system/network_session.h
75+ ubuntu/transfers/system/nm_interface.h
76 ubuntu/transfers/system/pending_reply.h
77 ubuntu/transfers/system/process.h
78 ubuntu/transfers/system/process_factory.h
79 ubuntu/transfers/system/request_factory.h
80- ubuntu/transfers/system/system_network_info.h
81 ubuntu/transfers/system/timer.h
82 ubuntu/transfers/system/uuid_factory.h
83 ubuntu/transfers/system/uuid_utils.h
84 )
85
86-include_directories(${Qt5SystemInfo_INCLUDE_DIRS})
87 include_directories(${Qt5DBus_INCLUDE_DIRS})
88 include_directories(${Qt5Network_INCLUDE_DIRS})
89 include_directories(${Qt5Sql_INCLUDE_DIRS})
90@@ -81,7 +82,6 @@
91 ${GLOG_LIBRARIES}
92 ${Qt5Network_LIBRARIES}
93 ${Qt5Sql_LIBRARIES}
94- ${Qt5SystemInfo_LIBRARIES}
95 ${Qt5Core_LIBRARIES}
96 ${Qt5DBus_LIBRARIES}
97 udm-common
98
99=== modified file 'src/common/priv/ubuntu/transfers/queue.cpp'
100--- src/common/priv/ubuntu/transfers/queue.cpp 2014-04-08 20:19:38 +0000
101+++ src/common/priv/ubuntu/transfers/queue.cpp 2014-11-26 12:24:23 +0000
102@@ -18,8 +18,9 @@
103
104 #include <QSignalMapper>
105 #include <glog/logging.h>
106+
107 #include "ubuntu/transfers/system/logger.h"
108-#include "ubuntu/transfers/system/system_network_info.h"
109+#include "ubuntu/transfers/system/network_session.h"
110 #include "queue.h"
111
112 namespace Ubuntu {
113@@ -29,9 +30,9 @@
114 Queue::Queue(QObject* parent)
115 : QObject(parent),
116 _current("") {
117- CHECK(connect(SystemNetworkInfo::instance(),
118- &SystemNetworkInfo::currentNetworkModeChanged,
119- this, &Queue::onCurrentNetworkModeChanged))
120+ CHECK(connect(NetworkSession::instance(),
121+ &NetworkSession::sessionTypeChanged,
122+ this, &Queue::onSessionTypeChanged))
123 << "Could not connect to signal";
124 }
125
126@@ -99,7 +100,6 @@
127 // get the appdownload that emited the signal and
128 // decide what to do with it
129 auto transfer = qobject_cast<Transfer*>(sender());
130- qDebug() << "State changed" << transfer;
131 switch (transfer->state()) {
132 case Transfer::START:
133 // only start the transfer in the update method
134@@ -113,9 +113,7 @@
135 break;
136 case Transfer::RESUME:
137 // only resume the transfer in the update method
138- qDebug() << "State changed to resume.";
139 if (_current.isEmpty()) {
140- qDebug() << "There is no current download present.";
141 updateCurrentTransfer();
142 }
143 break;
144@@ -160,9 +158,9 @@
145 }
146
147 void
148-Queue::onCurrentNetworkModeChanged(QNetworkInfo::NetworkMode mode) {
149- TRACE << mode;
150- if (mode != QNetworkInfo::UnknownMode) {
151+Queue::onSessionTypeChanged(QNetworkConfiguration::BearerType type) {
152+ TRACE << type;
153+ if (type != QNetworkConfiguration::BearerUnknown) {
154 updateCurrentTransfer();
155 }
156 }
157@@ -197,7 +195,6 @@
158 && (state == Transfer::START
159 || state == Transfer::RESUME)) {
160 _current = path;
161- qDebug() << _current;
162 if (state == Transfer::START)
163 transfer->startTransfer();
164 else
165
166=== modified file 'src/common/priv/ubuntu/transfers/queue.h'
167--- src/common/priv/ubuntu/transfers/queue.h 2014-03-25 17:28:41 +0000
168+++ src/common/priv/ubuntu/transfers/queue.h 2014-11-26 12:24:23 +0000
169@@ -24,6 +24,8 @@
170 #include <QList>
171 #include <QPair>
172 #include <QSharedPointer>
173+
174+#include "ubuntu/transfers/system/network_session.h"
175 #include "transfer.h"
176
177 namespace Ubuntu {
178@@ -55,7 +57,7 @@
179 private:
180 void onManagedTransferStateChanged();
181 void onUnmanagedTransferStateChanged();
182- void onCurrentNetworkModeChanged(QNetworkInfo::NetworkMode mode);
183+ void onSessionTypeChanged(QNetworkConfiguration::BearerType type);
184 void remove(const QString& path);
185 void updateCurrentTransfer();
186
187
188=== modified file 'src/common/priv/ubuntu/transfers/system/dbus_proxy.h'
189--- src/common/priv/ubuntu/transfers/system/dbus_proxy.h 2014-04-23 14:51:21 +0000
190+++ src/common/priv/ubuntu/transfers/system/dbus_proxy.h 2014-11-26 12:24:23 +0000
191@@ -180,7 +180,7 @@
192
193 namespace org {
194 namespace freedesktop {
195- typedef ::DBusProxy DBus;
196+ typedef ::DBusProxy DBusProxy;
197 }
198 }
199 #endif
200
201=== modified file 'src/common/priv/ubuntu/transfers/system/network_reply.cpp'
202--- src/common/priv/ubuntu/transfers/system/network_reply.cpp 2014-07-30 09:19:10 +0000
203+++ src/common/priv/ubuntu/transfers/system/network_reply.cpp 2014-11-26 12:24:23 +0000
204@@ -16,8 +16,11 @@
205 * Boston, MA 02110-1301, USA.
206 */
207
208+#include <QNetworkSession>
209+
210+#include <glog/logging.h>
211 #include <ubuntu/transfers/system/logger.h>
212-#include <glog/logging.h>
213+
214 #include "network_reply.h"
215
216 namespace Ubuntu {
217
218=== added file 'src/common/priv/ubuntu/transfers/system/network_session.cpp'
219--- src/common/priv/ubuntu/transfers/system/network_session.cpp 1970-01-01 00:00:00 +0000
220+++ src/common/priv/ubuntu/transfers/system/network_session.cpp 2014-11-26 12:24:23 +0000
221@@ -0,0 +1,162 @@
222+/*
223+ * Copyright 2013-2014 Canonical Ltd.
224+ *
225+ * This library is free software; you can redistribute it and/or
226+ * modify it under the terms of version 3 of the GNU Lesser General Public
227+ * License as published by the Free Software Foundation.
228+ *
229+ * This program is distributed in the hope that it will be useful,
230+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
231+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
232+ * General Public License for more details.
233+ *
234+ * You should have received a copy of the GNU Lesser General Public
235+ * License along with this library; if not, write to the
236+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
237+ * Boston, MA 02110-1301, USA.
238+ */
239+
240+#include <QDebug>
241+#include <QScopedPointer>
242+#include <QDBusConnection>
243+#include <QDBusInterface>
244+#include <QDBusPendingReply>
245+
246+#include <glog/logging.h>
247+
248+#include "network_session.h"
249+
250+namespace {
251+ const QString NM_PATH = "org.freedesktop.NetworkManager";
252+ const QString NM_OBJ_PATH = "/org/freedesktop/NetworkManager";
253+ const QString NM_INTERFACE = "org.freedesktop.NetworkManager";
254+ const QString PROPERTIES_INTERFACE = "org.freedesktop.DBus.Properties";
255+ const QString NM_PROPERTY = "PrimaryConnectionType";
256+}
257+
258+namespace Ubuntu {
259+
260+namespace Transfers {
261+
262+namespace System {
263+
264+NetworkSession* NetworkSession::_instance = nullptr;
265+QMutex NetworkSession::_mutex;
266+
267+NetworkSession::NetworkSession(QObject* parent)
268+ : QObject(parent) {
269+ _configManager = new QNetworkConfigurationManager();
270+
271+ CHECK(connect(_configManager, &QNetworkConfigurationManager::onlineStateChanged,
272+ this, &NetworkSession::onlineStateChanged))
273+ << "Could not connect to signal";
274+
275+ _nm = new NMInterface(NM_PATH, NM_OBJ_PATH, QDBusConnection::systemBus());
276+
277+ CHECK(connect(_nm, &NMInterface::PropertiesChanged,
278+ this, &NetworkSession::onPropertiesChanged))
279+ << "Could not connect to signal";
280+
281+ QScopedPointer<QDBusInterface> interface(new QDBusInterface(NM_PATH, NM_OBJ_PATH,
282+ PROPERTIES_INTERFACE, QDBusConnection::systemBus()));
283+
284+ QDBusPendingReply<QDBusVariant> reply =
285+ interface->call("Get", NM_INTERFACE, NM_PROPERTY);
286+
287+ reply.waitForFinished();
288+ if (!reply.isError()) {
289+ LOG(INFO) << "Connection type " << reply.value().variant().toString().toStdString();
290+ _sessionType = convertNMString(reply.value().variant().toString());
291+ } else {
292+ _error = true;
293+ _errorMsg = reply.error().message();
294+ LOG(ERROR) << _errorMsg.toStdString();
295+ }
296+
297+}
298+
299+NetworkSession::~NetworkSession() {
300+ delete _configManager;
301+}
302+
303+bool
304+NetworkSession::isError() {
305+ return _error;
306+}
307+
308+bool
309+NetworkSession::isOnline() {
310+ return _configManager->isOnline();
311+}
312+
313+QNetworkConfiguration::BearerType
314+NetworkSession::sessionType() {
315+ return _sessionType;
316+}
317+
318+NetworkSession*
319+NetworkSession::instance() {
320+ if(_instance == nullptr) {
321+ LOG(INFO) << "Instance is null";
322+ _mutex.lock();
323+ if(_instance == nullptr){
324+ LOG(INFO) << "Create new instance";
325+ _instance = new NetworkSession();
326+ }
327+ _mutex.unlock();
328+ }
329+ return _instance;
330+}
331+
332+void
333+NetworkSession::setInstance(NetworkSession* instance) {
334+ _instance = instance;
335+}
336+
337+void
338+NetworkSession::deleteInstance() {
339+ if(_instance != nullptr) {
340+ _mutex.lock();
341+ if(_instance != nullptr) {
342+ delete _instance;
343+ _instance = nullptr;
344+ }
345+ _mutex.unlock();
346+ }
347+}
348+
349+QNetworkConfiguration::BearerType
350+NetworkSession::convertNMString(const QString& str) {
351+ if (str.contains("wireless")) {
352+ return QNetworkConfiguration::BearerWLAN;
353+ }
354+
355+ if (str.contains("ethernet")) {
356+ return QNetworkConfiguration::BearerEthernet;
357+ }
358+
359+ if (str == "gsm") {
360+ return QNetworkConfiguration::Bearer3G;
361+ }
362+ return QNetworkConfiguration::BearerUnknown;
363+}
364+
365+void
366+NetworkSession::onPropertiesChanged(const QVariantMap& changedProperties) {
367+ if (changedProperties.contains(NM_PROPERTY)) {
368+ auto nmStr = changedProperties[NM_PROPERTY].toString();
369+ LOG(INFO) << "Connection type " << nmStr.toStdString();
370+ auto type = convertNMString(nmStr);
371+ if (type != _sessionType) {
372+ _sessionType = type;
373+ emit sessionTypeChanged(type);
374+ }
375+ }
376+
377+}
378+
379+}
380+
381+}
382+
383+}
384
385=== added file 'src/common/priv/ubuntu/transfers/system/network_session.h'
386--- src/common/priv/ubuntu/transfers/system/network_session.h 1970-01-01 00:00:00 +0000
387+++ src/common/priv/ubuntu/transfers/system/network_session.h 2014-11-26 12:24:23 +0000
388@@ -0,0 +1,80 @@
389+/*
390+ * Copyright 2013-2014 Canonical Ltd.
391+ *
392+ * This library is free software; you can redistribute it and/or
393+ * modify it under the terms of version 3 of the GNU Lesser General Public
394+ * License as published by the Free Software Foundation.
395+ *
396+ * This program is distributed in the hope that it will be useful,
397+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
398+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
399+ * General Public License for more details.
400+ *
401+ * You should have received a copy of the GNU Lesser General Public
402+ * License along with this library; if not, write to the
403+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
404+ * Boston, MA 02110-1301, USA.
405+ */
406+
407+#ifndef TRANSFERS_LIB_NETWORK_SESSION_H
408+#define TRANSFERS_LIB_NETWORK_SESSION_H
409+
410+#include <QMutex>
411+#include <QNetworkConfigurationManager>
412+#include <QObject>
413+
414+#include "nm_interface.h"
415+
416+namespace Ubuntu {
417+
418+namespace Transfers {
419+
420+namespace System {
421+
422+class NetworkSession : public QObject {
423+ Q_OBJECT
424+
425+ public:
426+ ~NetworkSession();
427+
428+ virtual bool isError();
429+ virtual bool isOnline();
430+ virtual QNetworkConfiguration::BearerType sessionType();
431+
432+ static NetworkSession* instance();
433+
434+ // only used for testing so that we can inject a fake
435+ static void setInstance(NetworkSession* instance);
436+ static void deleteInstance();
437+
438+ signals:
439+ void sessionTypeChanged(QNetworkConfiguration::BearerType type);
440+ void onlineStateChanged(bool state);
441+
442+ protected:
443+ explicit NetworkSession(QObject* parent=0);
444+
445+ private:
446+ QNetworkConfiguration::BearerType convertNMString(const QString& str);
447+ void onPropertiesChanged(const QVariantMap& changedProperties);
448+
449+ private:
450+ // used for the singleton
451+ static NetworkSession* _instance;
452+ static QMutex _mutex;
453+
454+ QNetworkConfigurationManager* _configManager = nullptr;
455+ NMInterface* _nm = nullptr;
456+ QNetworkConfiguration::BearerType _sessionType =
457+ QNetworkConfiguration::BearerUnknown;
458+ bool _error = false;
459+ QString _errorMsg = QString::null;
460+};
461+
462+}
463+
464+}
465+
466+}
467+
468+#endif
469
470=== added file 'src/common/priv/ubuntu/transfers/system/nm_interface.cpp'
471--- src/common/priv/ubuntu/transfers/system/nm_interface.cpp 1970-01-01 00:00:00 +0000
472+++ src/common/priv/ubuntu/transfers/system/nm_interface.cpp 2014-11-26 12:24:23 +0000
473@@ -0,0 +1,26 @@
474+/*
475+ * This file was generated by qdbusxml2cpp version 0.8
476+ * Command line was: qdbusxml2cpp properties.xml -p nm_interface -c NMInterface
477+ *
478+ * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
479+ *
480+ * This is an auto-generated file.
481+ * This file may have been hand-edited. Look for HAND-EDIT comments
482+ * before re-generating it.
483+ */
484+
485+#include "nm_interface.h"
486+
487+/*
488+ * Implementation of interface class NMInterface
489+ */
490+
491+NMInterface::NMInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
492+ : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
493+{
494+}
495+
496+NMInterface::~NMInterface()
497+{
498+}
499+
500
501=== added file 'src/common/priv/ubuntu/transfers/system/nm_interface.h'
502--- src/common/priv/ubuntu/transfers/system/nm_interface.h 1970-01-01 00:00:00 +0000
503+++ src/common/priv/ubuntu/transfers/system/nm_interface.h 2014-11-26 12:24:23 +0000
504@@ -0,0 +1,48 @@
505+/*
506+ * This file was generated by qdbusxml2cpp version 0.8
507+ * Command line was: qdbusxml2cpp properties.xml -p nm_interface -c NMInterface
508+ *
509+ * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
510+ *
511+ * This is an auto-generated file.
512+ * Do not edit! All changes made to it will be lost.
513+ */
514+
515+#ifndef NM_INTERFACE_H_1416842043
516+#define NM_INTERFACE_H_1416842043
517+
518+#include <QtCore/QObject>
519+#include <QtCore/QByteArray>
520+#include <QtCore/QList>
521+#include <QtCore/QMap>
522+#include <QtCore/QString>
523+#include <QtCore/QStringList>
524+#include <QtCore/QVariant>
525+#include <QtDBus/QtDBus>
526+
527+/*
528+ * Proxy class for interface org.freedesktop.NetworkManager
529+ */
530+class NMInterface: public QDBusAbstractInterface
531+{
532+ Q_OBJECT
533+public:
534+ static inline const char *staticInterfaceName()
535+ { return "org.freedesktop.NetworkManager"; }
536+
537+public:
538+ NMInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
539+
540+ ~NMInterface();
541+
542+public Q_SLOTS: // METHODS
543+Q_SIGNALS: // SIGNALS
544+ void PropertiesChanged(const QVariantMap &in0);
545+};
546+
547+namespace org {
548+ namespace freedesktop {
549+ typedef ::NMInterface NetworkManager;
550+ }
551+}
552+#endif
553
554=== removed file 'src/common/priv/ubuntu/transfers/system/system_network_info.cpp'
555--- src/common/priv/ubuntu/transfers/system/system_network_info.cpp 2014-04-08 20:21:07 +0000
556+++ src/common/priv/ubuntu/transfers/system/system_network_info.cpp 1970-01-01 00:00:00 +0000
557@@ -1,237 +0,0 @@
558-/*
559- * Copyright 2013-2014 Canonical Ltd.
560- *
561- * This library is free software; you can redistribute it and/or
562- * modify it under the terms of version 3 of the GNU Lesser General Public
563- * License as published by the Free Software Foundation.
564- *
565- * This program is distributed in the hope that it will be useful,
566- * but WITHOUT ANY WARRANTY; without even the implied warranty of
567- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
568- * General Public License for more details.
569- *
570- * You should have received a copy of the GNU Lesser General Public
571- * License along with this library; if not, write to the
572- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
573- * Boston, MA 02110-1301, USA.
574- */
575-
576-#include <QNetworkConfigurationManager>
577-#include <QNetworkSession>
578-#include <glog/logging.h>
579-#include <ubuntu/transfers/system/logger.h>
580-#include "system_network_info.h"
581-
582-namespace Ubuntu {
583-
584-namespace Transfers {
585-
586-namespace System {
587-
588-SystemNetworkInfo* SystemNetworkInfo::_instance = nullptr;
589-QMutex SystemNetworkInfo::_mutex;
590-
591-SystemNetworkInfo::SystemNetworkInfo(QObject* parent)
592- : QObject(parent) {
593- _info = new QNetworkInfo(this);
594- _configMan = new QNetworkConfigurationManager(this);
595-
596-#ifdef DEBUG
597- // in debug do log the changes else just fwd them
598- CHECK(connect(_info, &QNetworkInfo::cellIdChanged, this,
599- &SystemNetworkInfo::onCellIdChanged))
600- << "Could not connect to signal";
601- CHECK(connect(_info, &QNetworkInfo::currentCellDataTechnologyChanged,
602- this, &SystemNetworkInfo::onCurrentCellDataTechnologyChanged))
603- << "Could not connect to signal";
604- CHECK(connect(_info, &QNetworkInfo::currentMobileCountryCodeChanged, this,
605- &SystemNetworkInfo::onCurrentMobileCountryCodeChanged))
606- << "Could not connect to signal";
607- CHECK(connect(_info, &QNetworkInfo::currentMobileNetworkCodeChanged, this,
608- &SystemNetworkInfo::onCurrentMobileNetworkCodeChanged))
609- << "Could not connect to signal";
610- CHECK(connect(_info, &QNetworkInfo::currentNetworkModeChanged, this,
611- &SystemNetworkInfo::onCurrentNetworkModeChanged))
612- << "Could not connect to signal";
613- CHECK(connect(_info, &QNetworkInfo::locationAreaCodeChanged, this,
614- &SystemNetworkInfo::onLocationAreaCodeChanged))
615- << "Could not connect to signal";
616- CHECK(connect(_info, &QNetworkInfo::networkInterfaceCountChanged, this,
617- &SystemNetworkInfo::onNetworkInterfaceCountChanged))
618- << "Could not connect to signal";
619- CHECK(connect(_info, &QNetworkInfo::networkNameChanged, this,
620- &SystemNetworkInfo::onNetworkNameChanged))
621- << "Could not connect to signal";
622- CHECK(connect(_info, &QNetworkInfo::networkSignalStrengthChanged, this,
623- &SystemNetworkInfo::onNetworkSignalStrengthChanged))
624- << "Could not connect to signal";
625- CHECK(connect(_info, &QNetworkInfo::networkStatusChanged, this,
626- &SystemNetworkInfo::onNetworkStatusChanged))
627- << "Could not connect to signal";
628-
629- CHECK(connect(_configMan,
630- &QNetworkConfigurationManager::onlineStateChanged, this,
631- &SystemNetworkInfo::onOnlineStateChanged))
632- << "Could not connect to signal";
633-#else
634- // connect to interesting signals
635- CHECK(connect(_info, &QNetworkInfo::cellIdChanged, this,
636- &SystemNetworkInfo::cellIdChanged))
637- << "Could not connect to signal";
638- CHECK(connect(_info, &QNetworkInfo::currentCellDataTechnologyChanged,
639- this, &SystemNetworkInfo::currentCellDataTechnologyChanged))
640- << "Could not connect to signal";
641- CHECK(connect(_info, &QNetworkInfo::currentMobileCountryCodeChanged, this,
642- &SystemNetworkInfo::currentMobileCountryCodeChanged))
643- << "Could not connect to signal";
644- CHECK(connect(_info, &QNetworkInfo::currentMobileNetworkCodeChanged, this,
645- &SystemNetworkInfo::currentMobileNetworkCodeChanged))
646- << "Could not connect to signal";
647- CHECK(connect(_info, &QNetworkInfo::currentNetworkModeChanged, this,
648- &SystemNetworkInfo::currentNetworkModeChanged))
649- << "Could not connect to signal";
650- CHECK(connect(_info, &QNetworkInfo::locationAreaCodeChanged, this,
651- &SystemNetworkInfo::locationAreaCodeChanged))
652- << "Could not connect to signal";
653- CHECK(connect(_info, &QNetworkInfo::networkInterfaceCountChanged, this,
654- &SystemNetworkInfo::networkInterfaceCountChanged))
655- << "Could not connect to signal";
656- CHECK(connect(_info, &QNetworkInfo::networkNameChanged, this,
657- &SystemNetworkInfo::networkNameChanged))
658- << "Could not connect to signal";
659- CHECK(connect(_info, &QNetworkInfo::networkSignalStrengthChanged, this,
660- &SystemNetworkInfo::networkSignalStrengthChanged))
661- << "Could not connect to signal";
662- CHECK(connect(_info, &QNetworkInfo::networkStatusChanged, this,
663- &SystemNetworkInfo::networkStatusChanged))
664- << "Could not connect to signal";
665-
666- CHECK(connect(_configMan,
667- &QNetworkConfigurationManager::onlineStateChanged, this,
668- &SystemNetworkInfo::onlineStateChanged))
669- << "Could not connect to signal";
670-#endif
671-
672-}
673-
674-QNetworkInfo::NetworkMode
675-SystemNetworkInfo::currentNetworkMode() {
676- return _info->currentNetworkMode();
677-}
678-
679-bool
680-SystemNetworkInfo::isOnline() {
681- return _configMan->isOnline();
682-}
683-
684-SystemNetworkInfo*
685-SystemNetworkInfo::instance() {
686- if(_instance == nullptr) {
687- LOG(INFO) << "Instance is null";
688- _mutex.lock();
689- if(_instance == nullptr){
690- LOG(INFO) << "Create new instance";
691- _instance = new SystemNetworkInfo();
692- }
693- _mutex.unlock();
694- }
695- return _instance;
696-}
697-
698-void
699-SystemNetworkInfo::setInstance(SystemNetworkInfo* instance) {
700- _instance = instance;
701-}
702-
703-void
704-SystemNetworkInfo::deleteInstance() {
705- if(_instance != nullptr) {
706- _mutex.lock();
707- if(_instance != nullptr) {
708- delete _instance;
709- _instance = nullptr;
710- }
711- _mutex.unlock();
712- }
713-}
714-
715-void
716-SystemNetworkInfo::onOnlineStateChanged(bool online) {
717- TRACE << online;
718- emit onlineStateChanged(online);
719-}
720-
721-#if DEBUG
722-
723-void
724-SystemNetworkInfo::onCellIdChanged(int interface, const QString& id) {
725- TRACE << interface << id;
726- emit cellIdChanged(interface, id);
727-}
728-
729-void
730-SystemNetworkInfo::onCurrentCellDataTechnologyChanged(int interface,
731- QNetworkInfo::CellDataTechnology tech) {
732- TRACE << interface << tech;
733- emit currentCellDataTechnologyChanged(interface, tech);
734-}
735-
736-void
737-SystemNetworkInfo::onCurrentMobileCountryCodeChanged(int interface, const QString& mcc) {
738- TRACE << interface << mcc;
739- emit currentMobileCountryCodeChanged(interface, mcc);
740-}
741-
742-void
743-SystemNetworkInfo::onCurrentMobileNetworkCodeChanged(int interface, const QString& mnc) {
744- TRACE << interface << mnc;
745- emit currentMobileNetworkCodeChanged(interface, mnc);
746-}
747-
748-void
749-SystemNetworkInfo::onCurrentNetworkModeChanged(QNetworkInfo::NetworkMode mode) {
750- TRACE << mode;
751- emit currentNetworkModeChanged(mode);
752-}
753-
754-void
755-SystemNetworkInfo::onLocationAreaCodeChanged(int interface, const QString& lac) {
756- TRACE << interface << lac;
757- emit locationAreaCodeChanged(interface, lac);
758-}
759-
760-void
761-SystemNetworkInfo::onNetworkInterfaceCountChanged(QNetworkInfo::NetworkMode mode,
762- int count) {
763- TRACE << mode << count;
764- emit networkInterfaceCountChanged(mode, count);
765-}
766-
767-void
768-SystemNetworkInfo::onNetworkNameChanged(QNetworkInfo::NetworkMode mode, int interface,
769- const QString& name) {
770- TRACE << mode << interface << name;
771- emit networkNameChanged(mode, interface, name);
772-}
773-
774-void
775-SystemNetworkInfo::onNetworkSignalStrengthChanged(QNetworkInfo::NetworkMode mode,
776- int interface, int strength) {
777- TRACE << mode << interface << strength;
778- emit networkSignalStrengthChanged(mode, interface, strength);
779-}
780-
781-void
782-SystemNetworkInfo::onNetworkStatusChanged(QNetworkInfo::NetworkMode mode, int interface,
783- QNetworkInfo::NetworkStatus status) {
784- TRACE << mode << interface << status;
785- emit networkStatusChanged(mode, interface, status);
786-}
787-
788-#endif
789-
790-} // System
791-
792-} // Transfers
793-
794-} // Ubuntu
795
796=== removed file 'src/common/priv/ubuntu/transfers/system/system_network_info.h'
797--- src/common/priv/ubuntu/transfers/system/system_network_info.h 2014-02-27 16:53:19 +0000
798+++ src/common/priv/ubuntu/transfers/system/system_network_info.h 1970-01-01 00:00:00 +0000
799@@ -1,104 +0,0 @@
800-/*
801- * Copyright 2013-2014 Canonical Ltd.
802- *
803- * This library is free software; you can redistribute it and/or
804- * modify it under the terms of version 3 of the GNU Lesser General Public
805- * License as published by the Free Software Foundation.
806- *
807- * This program is distributed in the hope that it will be useful,
808- * but WITHOUT ANY WARRANTY; without even the implied warranty of
809- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
810- * General Public License for more details.
811- *
812- * You should have received a copy of the GNU Lesser General Public
813- * License along with this library; if not, write to the
814- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
815- * Boston, MA 02110-1301, USA.
816- */
817-
818-#ifndef DOWNLOADER_LIB_SYSTEM_NETWORK_INFO_H
819-#define DOWNLOADER_LIB_SYSTEM_NETWORK_INFO_H
820-
821-#include <QAtomicPointer>
822-#include <QMutex>
823-#include <QNetworkAccessManager>
824-#include <QNetworkConfigurationManager>
825-#include <QNetworkInfo>
826-#include <QObject>
827-
828-namespace Ubuntu {
829-
830-namespace Transfers {
831-
832-namespace System {
833-
834-class SystemNetworkInfo : public QObject {
835- Q_OBJECT
836-
837- public:
838- virtual QNetworkInfo::NetworkMode currentNetworkMode();
839- virtual bool isOnline();
840-
841- static SystemNetworkInfo* instance();
842-
843- // only used for testing so that we can inject a fake
844- static void setInstance(SystemNetworkInfo* instance);
845- static void deleteInstance();
846-
847- signals:
848-
849- // fwd QNetworkInfo signals
850- void cellIdChanged(int interface, const QString& id);
851- void currentCellDataTechnologyChanged(int interface, QNetworkInfo::CellDataTechnology tech);
852- void currentMobileCountryCodeChanged(int interface, const QString& mcc);
853- void currentMobileNetworkCodeChanged(int interface, const QString& mnc);
854- void currentNetworkModeChanged(QNetworkInfo::NetworkMode mode);
855- void locationAreaCodeChanged(int interface, const QString& lac);
856- void networkInterfaceCountChanged(QNetworkInfo::NetworkMode mode, int count);
857- void networkNameChanged(QNetworkInfo::NetworkMode mode, int interface, const QString& name);
858- void networkSignalStrengthChanged(QNetworkInfo::NetworkMode mode, int interface, int strength);
859- void networkStatusChanged(QNetworkInfo::NetworkMode mode, int interface, QNetworkInfo::NetworkStatus status);
860-
861- // network status signals
862- void onlineStateChanged(bool online);
863-
864- protected:
865- // left protected so that teh child fake class can use it
866- explicit SystemNetworkInfo(QObject *parent = 0);
867-
868- private:
869- void onOnlineStateChanged(bool);
870-
871-#if DEBUG
872- // track the changes so that we get some debug info, else we will just fwd the signals
873- void onCellIdChanged(int, const QString&);
874- void onCurrentCellDataTechnologyChanged(int,
875- QNetworkInfo::CellDataTechnology);
876- void onCurrentMobileCountryCodeChanged(int, const QString&);
877- void onCurrentMobileNetworkCodeChanged(int, const QString&);
878- void onCurrentNetworkModeChanged(QNetworkInfo::NetworkMode);
879- void onLocationAreaCodeChanged(int, const QString&);
880- void onNetworkInterfaceCountChanged(QNetworkInfo::NetworkMode, int);
881- void onNetworkNameChanged(QNetworkInfo::NetworkMode, int, const QString&);
882- void onNetworkSignalStrengthChanged(QNetworkInfo::NetworkMode, int, int);
883- void onNetworkStatusChanged(QNetworkInfo::NetworkMode, int,
884- QNetworkInfo::NetworkStatus);
885-#endif
886-
887- private:
888- // used for the singleton
889- static SystemNetworkInfo* _instance;
890- static QMutex _mutex;
891-
892- // internal vars
893- QNetworkInfo* _info;
894- QNetworkConfigurationManager* _configMan;
895-};
896-
897-} // System
898-
899-} // Transfers
900-
901-} // Ubuntu
902-
903-#endif // DOWNLOADER_LIB_SYSTEM_NETWORK_INFO_H
904
905=== modified file 'src/common/priv/ubuntu/transfers/transfer.cpp'
906--- src/common/priv/ubuntu/transfers/transfer.cpp 2014-07-16 08:41:38 +0000
907+++ src/common/priv/ubuntu/transfers/transfer.cpp 2014-11-26 12:24:23 +0000
908@@ -17,6 +17,9 @@
909 */
910
911 #include <ubuntu/transfers/system/logger.h>
912+
913+#include <glog/logging.h>
914+
915 #include "transfer.h"
916
917 namespace Ubuntu {
918@@ -38,7 +41,7 @@
919 _dbusPath(path),
920 _isConfined(isConfined),
921 _rootPath(rootPath) {
922- _networkInfo = System::SystemNetworkInfo::instance();
923+ _networkSession = System::NetworkSession::instance();
924 setObjectName(id);
925 }
926
927@@ -84,22 +87,22 @@
928 bool
929 Transfer::canTransfer() {
930 TRACE;
931- QNetworkInfo::NetworkMode mode = _networkInfo->currentNetworkMode();
932+ auto mode = _networkSession->sessionType();
933 switch (mode) {
934- case QNetworkInfo::UnknownMode:
935- qWarning() << "Network Mode unknown!";
936- return _allowMobileData;
937+ case QNetworkConfiguration::BearerUnknown:
938+ LOG(WARNING) << "Network Mode unknown!";
939+ if (_networkSession->isError())
940+ return true;
941+ else
942+ return _allowMobileData;
943 break;
944- case QNetworkInfo::GsmMode:
945- case QNetworkInfo::CdmaMode:
946- case QNetworkInfo::WcdmaMode:
947- case QNetworkInfo::WimaxMode:
948- case QNetworkInfo::TdscdmaMode:
949- case QNetworkInfo::LteMode:
950+ case QNetworkConfiguration::Bearer2G:
951+ case QNetworkConfiguration::Bearer3G:
952+ case QNetworkConfiguration::Bearer4G:
953 return _allowMobileData;
954- case QNetworkInfo::WlanMode:
955- case QNetworkInfo::EthernetMode:
956- case QNetworkInfo::BluetoothMode:
957+ case QNetworkConfiguration::BearerEthernet:
958+ case QNetworkConfiguration::BearerWLAN:
959+ case QNetworkConfiguration::BearerBluetooth:
960 return true;
961 default:
962 return false;
963
964=== modified file 'src/common/priv/ubuntu/transfers/transfer.h'
965--- src/common/priv/ubuntu/transfers/transfer.h 2014-07-16 08:41:38 +0000
966+++ src/common/priv/ubuntu/transfers/transfer.h 2014-11-26 12:24:23 +0000
967@@ -20,7 +20,7 @@
968 #define UBUNTU_GENERAL_LIB_TRANSFER_H
969
970 #include <QObject>
971-#include "ubuntu/transfers/system/system_network_info.h"
972+#include "ubuntu/transfers/system/network_session.h"
973
974 namespace Ubuntu {
975
976@@ -106,7 +106,7 @@
977 QString _dbusPath;
978 bool _isConfined;
979 QString _rootPath;
980- System::SystemNetworkInfo* _networkInfo;
981+ System::NetworkSession* _networkSession;
982 };
983
984 } // Transfers
985
986=== modified file 'src/downloads/priv/CMakeLists.txt'
987--- src/downloads/priv/CMakeLists.txt 2014-10-09 09:52:34 +0000
988+++ src/downloads/priv/CMakeLists.txt 2014-11-26 12:24:23 +0000
989@@ -42,7 +42,6 @@
990 ubuntu/downloads/state_machines/state.h
991 )
992
993-include_directories(${Qt5SystemInfo_INCLUDE_DIRS})
994 include_directories(${Qt5DBus_INCLUDE_DIRS})
995 include_directories(${Qt5Network_INCLUDE_DIRS})
996 include_directories(${Qt5Sql_INCLUDE_DIRS})
997
998=== modified file 'src/downloads/priv/ubuntu/downloads/download.h'
999--- src/downloads/priv/ubuntu/downloads/download.h 2014-09-17 15:42:53 +0000
1000+++ src/downloads/priv/ubuntu/downloads/download.h 2014-11-26 12:24:23 +0000
1001@@ -28,7 +28,6 @@
1002 #include <ubuntu/download_manager/metatypes.h>
1003 #include "ubuntu/transfers/system/process_factory.h"
1004 #include "ubuntu/transfers/system/request_factory.h"
1005-#include "ubuntu/transfers/system/system_network_info.h"
1006
1007
1008 namespace Ubuntu {
1009
1010=== modified file 'src/downloads/priv/ubuntu/downloads/factory.h'
1011--- src/downloads/priv/ubuntu/downloads/factory.h 2014-03-28 15:50:25 +0000
1012+++ src/downloads/priv/ubuntu/downloads/factory.h 2014-11-26 12:24:23 +0000
1013@@ -22,7 +22,6 @@
1014 #include <QObject>
1015 #include <ubuntu/download_manager/metatypes.h>
1016 #include <ubuntu/transfers/system/apparmor.h>
1017-#include <ubuntu/transfers/system/system_network_info.h>
1018 #include <ubuntu/transfers/system/uuid_factory.h>
1019 #include "download.h"
1020
1021
1022=== modified file 'src/downloads/priv/ubuntu/downloads/file_download.cpp'
1023--- src/downloads/priv/ubuntu/downloads/file_download.cpp 2014-10-10 10:54:15 +0000
1024+++ src/downloads/priv/ubuntu/downloads/file_download.cpp 2014-11-26 12:24:23 +0000
1025@@ -815,8 +815,7 @@
1026 FileDownload::init() {
1027 _requestFactory = RequestFactory::instance();
1028 _fileNameMutex = FileNameMutex::instance();
1029- SystemNetworkInfo* networkInfo = SystemNetworkInfo::instance();
1030- _connected = networkInfo->isOnline();
1031+ _connected = NetworkSession::instance()->isOnline();
1032 _downloading = false;
1033
1034 // applications that are confined are not allowed to set the click metadata.
1035@@ -825,7 +824,7 @@
1036 }
1037
1038 // connect to the network changed signals
1039- CHECK(connect(networkInfo, &SystemNetworkInfo::onlineStateChanged,
1040+ CHECK(connect(NetworkSession::instance(), &NetworkSession::onlineStateChanged,
1041 this, &FileDownload::onOnlineStateChanged))
1042 << "Could not connect to signal";
1043
1044
1045=== modified file 'src/downloads/test-daemon/CMakeLists.txt'
1046--- src/downloads/test-daemon/CMakeLists.txt 2014-03-27 12:54:03 +0000
1047+++ src/downloads/test-daemon/CMakeLists.txt 2014-11-26 12:24:23 +0000
1048@@ -21,7 +21,6 @@
1049 include_directories(${Qt5DBus_INCLUDE_DIRS})
1050 include_directories(${Qt5Network_INCLUDE_DIRS})
1051 include_directories(${Qt5Sql_INCLUDE_DIRS})
1052-include_directories(${Qt5SystemInfo_INCLUDE_DIRS})
1053 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
1054 include_directories(${CMAKE_CURRENT_BINARY_DIR})
1055 include_directories(${CMAKE_SOURCE_DIR}/src/common/public)
1056@@ -43,7 +42,6 @@
1057 ${Qt5DBus_LIBRARIES}
1058 ${Qt5Network_LIBRARIES}
1059 ${Qt5Sql_LIBRARIES}
1060- ${Qt5SystemInfo_LIBRARIES}
1061 udm-common
1062 udm-priv-common
1063 ubuntu-download-manager-common
1064
1065=== modified file 'src/uploads/priv/CMakeLists.txt'
1066--- src/uploads/priv/CMakeLists.txt 2014-03-28 11:08:00 +0000
1067+++ src/uploads/priv/CMakeLists.txt 2014-11-26 12:24:23 +0000
1068@@ -26,7 +26,6 @@
1069 ubuntu/uploads/upload_manager_factory.h
1070 )
1071
1072-include_directories(${Qt5SystemInfo_INCLUDE_DIRS})
1073 include_directories(${Qt5DBus_INCLUDE_DIRS})
1074 include_directories(${Qt5Network_INCLUDE_DIRS})
1075 include_directories(${Qt5Sql_INCLUDE_DIRS})
1076
1077=== modified file 'src/uploads/priv/ubuntu/uploads/factory.h'
1078--- src/uploads/priv/ubuntu/uploads/factory.h 2014-04-24 18:37:28 +0000
1079+++ src/uploads/priv/ubuntu/uploads/factory.h 2014-11-26 12:24:23 +0000
1080@@ -22,7 +22,6 @@
1081 #include <QObject>
1082 #include <ubuntu/upload_manager/metatypes.h>
1083 #include <ubuntu/transfers/system/apparmor.h>
1084-#include <ubuntu/transfers/system/system_network_info.h>
1085 #include <ubuntu/transfers/system/uuid_factory.h>
1086 #include "file_upload.h"
1087
1088
1089=== modified file 'tests/common/CMakeLists.txt'
1090--- tests/common/CMakeLists.txt 2014-07-17 08:40:07 +0000
1091+++ tests/common/CMakeLists.txt 2014-11-26 12:24:23 +0000
1092@@ -18,13 +18,11 @@
1093 process.h
1094 process_factory.h
1095 request_factory.h
1096- system_network_info.h
1097 testing_interface.h
1098 uuid_factory.h
1099 )
1100
1101 include_directories(${Qt5Core_INCLUDE_DIRS})
1102-include_directories(${Qt5SystemInfo_INCLUDE_DIRS})
1103 include_directories(${Qt5DBus_INCLUDE_DIRS})
1104 include_directories(${Qt5Network_INCLUDE_DIRS})
1105 include_directories(${Qt5Test_INCLUDE_DIRS})
1106@@ -51,12 +49,12 @@
1107 target_link_libraries(${TARGET}
1108 ${NIH_DBUS_LIBRARIES}
1109 ${GLOG_LIBRARIES}
1110- ${Qt5Core_LIBRARIES}
1111- ${Qt5Sql_LIBRARIES}
1112- ${Qt5DBus_LIBRARIES}
1113+ ${Qt5Core_LIBRARIES}
1114+ ${Qt5Sql_LIBRARIES}
1115+ ${Qt5DBus_LIBRARIES}
1116 ${Qt5Test_LIBRARIES}
1117- ${GMOCK_LIBRARY}
1118- ${GTEST_BOTH_LIBRARIES}
1119+ ${GMOCK_LIBRARY}
1120+ ${GTEST_BOTH_LIBRARIES}
1121 udm-common
1122 udm-priv-common
1123 ubuntu-download-manager-common
1124
1125=== modified file 'tests/common/daemon_testcase.cpp'
1126--- tests/common/daemon_testcase.cpp 2014-07-03 09:01:01 +0000
1127+++ tests/common/daemon_testcase.cpp 2014-11-26 12:24:23 +0000
1128@@ -219,6 +219,7 @@
1129
1130 void
1131 DaemonTestCase::startHttpServer() {
1132+ qDebug() << "Start http server";
1133 auto serverDir = httpServerDir();
1134 _httpServer = new QProcess();
1135 _httpServer->setWorkingDirectory(serverDir);
1136
1137=== added file 'tests/common/network_session.h'
1138--- tests/common/network_session.h 1970-01-01 00:00:00 +0000
1139+++ tests/common/network_session.h 2014-11-26 12:24:23 +0000
1140@@ -0,0 +1,54 @@
1141+/*
1142+ * Copyright 2014 Canonical Ltd.
1143+ *
1144+ * This library is free software; you can redistribute it and/or
1145+ * modify it under the terms of version 3 of the GNU Lesser General Public
1146+ * License as published by the Free Software Foundation.
1147+ *
1148+ * This program is distributed in the hope that it will be useful,
1149+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1150+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1151+ * General Public License for more details.
1152+ *
1153+ * You should have received a copy of the GNU Lesser General Public
1154+ * License along with this library; if not, write to the
1155+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
1156+ * Boston, MA 02110-1301, USA.
1157+ */
1158+
1159+#ifndef FAKE_NETWORK_SESSION_H
1160+#define FAKE_NETWORK_SESSION_H
1161+
1162+#include <QObject>
1163+#include <ubuntu/transfers/system/network_session.h>
1164+#include <gmock/gmock.h>
1165+
1166+namespace Ubuntu {
1167+
1168+namespace Transfers {
1169+
1170+using namespace System;
1171+
1172+namespace Tests {
1173+
1174+class MockNetworkSession : public NetworkSession {
1175+ public:
1176+ explicit MockNetworkSession(QObject* parent = 0) :
1177+ NetworkSession(parent) {}
1178+
1179+ MOCK_METHOD0(sessionType, QNetworkConfiguration::BearerType());
1180+ MOCK_METHOD0(isOnline, bool());
1181+
1182+ bool isError() override {
1183+ return false;
1184+ }
1185+
1186+};
1187+
1188+} // Ubuntu
1189+
1190+} // Transfers
1191+
1192+} // Tests
1193+
1194+#endif
1195
1196=== removed file 'tests/common/system_network_info.h'
1197--- tests/common/system_network_info.h 2014-07-07 12:16:47 +0000
1198+++ tests/common/system_network_info.h 1970-01-01 00:00:00 +0000
1199@@ -1,61 +0,0 @@
1200-/*
1201- * Copyright 2013-2014 Canonical Ltd.
1202- *
1203- * This library is free software; you can redistribute it and/or
1204- * modify it under the terms of version 3 of the GNU Lesser General Public
1205- * License as published by the Free Software Foundation.
1206- *
1207- * This program is distributed in the hope that it will be useful,
1208- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1209- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1210- * General Public License for more details.
1211- *
1212- * You should have received a copy of the GNU Lesser General Public
1213- * License along with this library; if not, write to the
1214- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
1215- * Boston, MA 02110-1301, USA.
1216- */
1217-
1218-#ifndef FAKE_SYSTEM_NETWORK_INFO_H
1219-#define FAKE_SYSTEM_NETWORK_INFO_H
1220-
1221-#include <QObject>
1222-#include <ubuntu/transfers/system/system_network_info.h>
1223-#include <gmock/gmock.h>
1224-
1225-namespace Ubuntu {
1226-
1227-namespace Transfers {
1228-
1229-using namespace System;
1230-
1231-namespace Tests {
1232-
1233-class MockSystemNetworkInfo : public SystemNetworkInfo {
1234- public:
1235- explicit MockSystemNetworkInfo(QObject* parent = 0) :
1236- SystemNetworkInfo(parent) {}
1237-
1238- MOCK_METHOD0(currentNetworkMode, QNetworkInfo::NetworkMode());
1239- MOCK_METHOD0(isOnline, bool());
1240-
1241- using SystemNetworkInfo::cellIdChanged;
1242- using SystemNetworkInfo::currentCellDataTechnologyChanged;
1243- using SystemNetworkInfo::currentMobileCountryCodeChanged;
1244- using SystemNetworkInfo::currentMobileNetworkCodeChanged;
1245- using SystemNetworkInfo::currentNetworkModeChanged;
1246- using SystemNetworkInfo::locationAreaCodeChanged;
1247- using SystemNetworkInfo::networkInterfaceCountChanged;
1248- using SystemNetworkInfo::networkNameChanged;
1249- using SystemNetworkInfo::networkSignalStrengthChanged;
1250- using SystemNetworkInfo::networkStatusChanged;
1251- using SystemNetworkInfo::onlineStateChanged;
1252-};
1253-
1254-} // Ubuntu
1255-
1256-} // Transfers
1257-
1258-} // Tests
1259-
1260-#endif // FAKE_SYSTEM_NETWORK_INFO_H
1261
1262=== modified file 'tests/downloads/client/CMakeLists.txt'
1263--- tests/downloads/client/CMakeLists.txt 2014-09-17 15:42:53 +0000
1264+++ tests/downloads/client/CMakeLists.txt 2014-11-26 12:24:23 +0000
1265@@ -35,7 +35,6 @@
1266 endforeach(test)
1267
1268 include_directories(${Qt5Core_INCLUDE_DIRS})
1269-include_directories(${Qt5SystemInfo_INCLUDE_DIRS})
1270 include_directories(${Qt5DBus_INCLUDE_DIRS})
1271 include_directories(${Qt5Network_INCLUDE_DIRS})
1272 include_directories(${Qt5Test_INCLUDE_DIRS})
1273@@ -82,7 +81,7 @@
1274 ${CLIENT_TESTS_LIBS}
1275 )
1276
1277- ADD_TEST(NAME client_${test} COMMAND dbus-test-runner -m 180 --task=${CMAKE_CURRENT_BINARY_DIR}/${test}_client -c)
1278+ ADD_TEST(NAME client_${test} COMMAND dbus-test-runner -m 360 --task=${CMAKE_CURRENT_BINARY_DIR}/${test}_client -c)
1279
1280 endforeach(test)
1281 else(DBUS_RUNNER)
1282
1283=== modified file 'tests/downloads/daemon/CMakeLists.txt'
1284--- tests/downloads/daemon/CMakeLists.txt 2014-07-16 11:46:55 +0000
1285+++ tests/downloads/daemon/CMakeLists.txt 2014-11-26 12:24:23 +0000
1286@@ -67,7 +67,6 @@
1287
1288
1289 include_directories(${Qt5Core_INCLUDE_DIRS})
1290-include_directories(${Qt5SystemInfo_INCLUDE_DIRS})
1291 include_directories(${Qt5DBus_INCLUDE_DIRS})
1292 include_directories(${Qt5Network_INCLUDE_DIRS})
1293 include_directories(${Qt5Test_INCLUDE_DIRS})
1294
1295=== modified file 'tests/downloads/daemon/test_daemon.cpp'
1296--- tests/downloads/daemon/test_daemon.cpp 2014-09-17 15:42:53 +0000
1297+++ tests/downloads/daemon/test_daemon.cpp 2014-11-26 12:24:23 +0000
1298@@ -16,6 +16,8 @@
1299 * Boston, MA 02110-1301, USA.
1300 */
1301
1302+#include <network_session.h>
1303+
1304 #include "test_daemon.h"
1305
1306 using namespace Ubuntu::DownloadManager;
1307@@ -34,7 +36,7 @@
1308 void
1309 TestDaemon::cleanup() {
1310 DefaultValue<QStringList>::Clear();
1311- SystemNetworkInfo::deleteInstance();
1312+ NetworkSession::deleteInstance();
1313 RequestFactory::deleteInstance();
1314 BaseTestCase::cleanup();
1315 }
1316
1317=== modified file 'tests/downloads/daemon/test_download.cpp'
1318--- tests/downloads/daemon/test_download.cpp 2014-09-22 23:24:34 +0000
1319+++ tests/downloads/daemon/test_download.cpp 2014-11-26 12:24:23 +0000
1320@@ -50,8 +50,8 @@
1321 _path = "random path to dbus";
1322 _url = QUrl("http://ubuntu.com/data.txt");
1323 _algo = "Sha256";
1324- _networkInfo = new MockSystemNetworkInfo();
1325- SystemNetworkInfo::setInstance(_networkInfo);
1326+ _networkSession = new MockNetworkSession();
1327+ NetworkSession::setInstance(_networkSession);
1328 _reqFactory = new MockRequestFactory();
1329 RequestFactory::setInstance(_reqFactory);
1330 _processFactory = new MockProcessFactory();
1331@@ -64,7 +64,7 @@
1332
1333 void
1334 TestDownload::verifyMocks() {
1335- QVERIFY(Mock::VerifyAndClearExpectations(_networkInfo));
1336+ QVERIFY(Mock::VerifyAndClearExpectations(_networkSession));
1337 QVERIFY(Mock::VerifyAndClearExpectations(_reqFactory));
1338 QVERIFY(Mock::VerifyAndClearExpectations(_processFactory));
1339 QVERIFY(Mock::VerifyAndClearExpectations(_fileManager));
1340@@ -75,7 +75,7 @@
1341 TestDownload::cleanup() {
1342 BaseTestCase::cleanup();
1343
1344- SystemNetworkInfo::deleteInstance();
1345+ NetworkSession::deleteInstance();
1346 RequestFactory::deleteInstance();
1347 ProcessFactory::deleteInstance();
1348 FileManager::deleteInstance();
1349@@ -107,7 +107,7 @@
1350 QFETCH(QString, path);
1351 QFETCH(QUrl, url);
1352
1353- EXPECT_CALL(*_networkInfo, isOnline())
1354+ EXPECT_CALL(*_networkSession, isOnline())
1355 .WillRepeatedly(Return(true));
1356
1357 QScopedPointer<FileDownload> download(new FileDownload(id, appId, path,
1358@@ -158,7 +158,7 @@
1359 QFETCH(QString, hash);
1360 QFETCH(QString, algo);
1361
1362- EXPECT_CALL(*_networkInfo, isOnline())
1363+ EXPECT_CALL(*_networkSession, isOnline())
1364 .WillRepeatedly(Return(true));
1365
1366 QScopedPointer<FileDownload> download(new FileDownload(id, appId, path,
1367@@ -181,7 +181,7 @@
1368 QVariantMap metadata;
1369 metadata[Ubuntu::Transfers::Metadata::CLICK_PACKAGE_KEY] = "click";
1370
1371- EXPECT_CALL(*_networkInfo, isOnline())
1372+ EXPECT_CALL(*_networkSession, isOnline())
1373 .WillRepeatedly(Return(true));
1374
1375 QScopedPointer<FileDownload> download(new FileDownload(_id, _appId, _path,
1376@@ -195,7 +195,7 @@
1377 QVariantMap metadata;
1378 metadata[Ubuntu::Transfers::Metadata::CLICK_PACKAGE_KEY] = "click";
1379
1380- EXPECT_CALL(*_networkInfo, isOnline())
1381+ EXPECT_CALL(*_networkSession, isOnline())
1382 .WillRepeatedly(Return(true));
1383
1384 QScopedPointer<FileDownload> download(new FileDownload(_id, _appId, _path,
1385@@ -220,7 +220,7 @@
1386 // create an app download and assert that the returned data is correct
1387 QFETCH(QString, path);
1388
1389- EXPECT_CALL(*_networkInfo, isOnline())
1390+ EXPECT_CALL(*_networkSession, isOnline())
1391 .WillRepeatedly(Return(true));
1392
1393 QScopedPointer<FileDownload> download(new FileDownload(_id, _appId, path,
1394@@ -245,7 +245,7 @@
1395 // create an app download and assert that the returned data is correct
1396 QFETCH(QUrl, url);
1397
1398- EXPECT_CALL(*_networkInfo, isOnline())
1399+ EXPECT_CALL(*_networkSession, isOnline())
1400 .WillRepeatedly(Return(true));
1401
1402 QScopedPointer<FileDownload> download(new FileDownload(_id, _appId, _path,
1403@@ -278,7 +278,7 @@
1404 auto file = new MockFile("test");
1405 auto reply = new MockNetworkReply();
1406
1407- EXPECT_CALL(*_networkInfo, isOnline())
1408+ EXPECT_CALL(*_networkSession, isOnline())
1409 .WillRepeatedly(Return(true));
1410
1411 // set expectations to get the request and the reply correctly
1412@@ -366,7 +366,7 @@
1413 auto file = new MockFile("test");
1414 auto reply = new MockNetworkReply();
1415
1416- EXPECT_CALL(*_networkInfo, isOnline())
1417+ EXPECT_CALL(*_networkSession, isOnline())
1418 .WillRepeatedly(Return(true));
1419
1420 // set expectations to get the request and the reply correctly
1421@@ -440,7 +440,7 @@
1422 auto file = new MockFile("test");
1423 auto reply = new MockNetworkReply();
1424
1425- EXPECT_CALL(*_networkInfo, isOnline())
1426+ EXPECT_CALL(*_networkSession, isOnline())
1427 .WillRepeatedly(Return(true));
1428
1429 // set expectations to get the request and the reply correctly
1430@@ -511,7 +511,7 @@
1431
1432 void
1433 TestDownload::testTotalSizeNoProgress() {
1434- EXPECT_CALL(*_networkInfo, isOnline())
1435+ EXPECT_CALL(*_networkSession, isOnline())
1436 .WillRepeatedly(Return(true));
1437
1438 QScopedPointer<FileDownload> download(new FileDownload(_id, _appId, _path,
1439@@ -533,7 +533,7 @@
1440 void
1441 TestDownload::testSetThrottleNoReply() {
1442 QFETCH(qulonglong, speed);
1443- EXPECT_CALL(*_networkInfo, isOnline())
1444+ EXPECT_CALL(*_networkSession, isOnline())
1445 .WillRepeatedly(Return(true));
1446
1447 QScopedPointer<FileDownload> download(new FileDownload(_id, _appId, _path,
1448@@ -560,7 +560,7 @@
1449 auto file = new MockFile("test");
1450 auto reply = new MockNetworkReply();
1451
1452- EXPECT_CALL(*_networkInfo, isOnline())
1453+ EXPECT_CALL(*_networkSession, isOnline())
1454 .WillRepeatedly(Return(true));
1455
1456 // set expectations to get the request and the reply correctly
1457@@ -614,7 +614,7 @@
1458 TestDownload::testSetGSMDownloadSame() {
1459 QFETCH(bool, value);
1460
1461- EXPECT_CALL(*_networkInfo, isOnline())
1462+ EXPECT_CALL(*_networkSession, isOnline())
1463 .WillRepeatedly(Return(true));
1464
1465 QScopedPointer<FileDownload> download(new FileDownload(_id, _appId, _path,
1466@@ -641,7 +641,7 @@
1467 QFETCH(bool, oldValue);
1468 QFETCH(bool, newValue);
1469
1470- EXPECT_CALL(*_networkInfo, isOnline())
1471+ EXPECT_CALL(*_networkSession, isOnline())
1472 .WillRepeatedly(Return(true));
1473
1474 QScopedPointer<FileDownload> download(new FileDownload(_id, _appId, _path,
1475@@ -659,40 +659,35 @@
1476 TestDownload::testCanDownloadGSM_data() {
1477 QTest::addColumn<QVariant>("mode");
1478
1479- QVariant gsmMode, cdmaMode, wCdmaMode, wlanMode, ethernetMode,
1480- bluetoothMode, wimaxMode, lteMode, tdscdmaMode;
1481-
1482- gsmMode.setValue(QNetworkInfo::GsmMode);
1483- cdmaMode.setValue(QNetworkInfo::CdmaMode);
1484- wCdmaMode.setValue(QNetworkInfo::WcdmaMode);
1485- wlanMode.setValue(QNetworkInfo::WlanMode);
1486- ethernetMode.setValue(QNetworkInfo::EthernetMode);
1487- bluetoothMode.setValue(QNetworkInfo::BluetoothMode);
1488- wimaxMode.setValue(QNetworkInfo::WimaxMode);
1489- lteMode.setValue(QNetworkInfo::LteMode);
1490- tdscdmaMode.setValue(QNetworkInfo::TdscdmaMode);
1491-
1492- QTest::newRow("GSM Mode") << gsmMode;
1493- QTest::newRow("CDMA Mode") << cdmaMode;
1494- QTest::newRow("WCDMA Mode") << wCdmaMode;
1495- QTest::newRow("Wlan Mode") << wlanMode;
1496- QTest::newRow("Ethernet Mode") << ethernetMode;
1497- QTest::newRow("Bluetooth Mode") << bluetoothMode;
1498- QTest::newRow("WIMAX Mode") << wimaxMode;
1499- QTest::newRow("LTE Mode") << lteMode;
1500- QTest::newRow("TDSCDMA Mode") << tdscdmaMode;
1501+ QVariant unknown, twoG, ethernet, wlan, bluetooth, threeG, fourG;
1502+
1503+ unknown.setValue(QNetworkConfiguration::BearerUnknown);
1504+ twoG.setValue(QNetworkConfiguration::Bearer2G);
1505+ ethernet.setValue(QNetworkConfiguration::BearerEthernet);
1506+ wlan.setValue(QNetworkConfiguration::BearerWLAN);
1507+ bluetooth.setValue(QNetworkConfiguration::BearerBluetooth);
1508+ threeG.setValue(QNetworkConfiguration::Bearer3G);
1509+ fourG.setValue(QNetworkConfiguration::Bearer4G);
1510+
1511+ QTest::newRow("Unknown Mode") << unknown;
1512+ QTest::newRow("2G Mode") << twoG;
1513+ QTest::newRow("Ethernet Mode") << ethernet;
1514+ QTest::newRow("WLAN Mode") << wlan;
1515+ QTest::newRow("Bluetooth Mode") << bluetooth;
1516+ QTest::newRow("3G Mode") << threeG;
1517+ QTest::newRow("4G Mode") << fourG;
1518 }
1519
1520 void
1521 TestDownload::testCanDownloadGSM() {
1522 QFETCH(QVariant, mode);
1523
1524- EXPECT_CALL(*_networkInfo, isOnline())
1525+ EXPECT_CALL(*_networkSession, isOnline())
1526 .WillRepeatedly(Return(true));
1527
1528- EXPECT_CALL(*_networkInfo, currentNetworkMode())
1529+ EXPECT_CALL(*_networkSession, sessionType())
1530 .Times(1)
1531- .WillOnce(Return(mode.value<QNetworkInfo::NetworkMode>()));
1532+ .WillOnce(Return(mode.value<QNetworkConfiguration::BearerType>()));
1533
1534 QScopedPointer<FileDownload> download(new FileDownload(_id, _appId, _path,
1535 _isConfined, _rootPath, _url, _metadata, _headers));
1536@@ -706,30 +701,23 @@
1537 QTest::addColumn<QVariant>("mode");
1538 QTest::addColumn<bool>("result");
1539
1540- QVariant unknownMode, gsmMode, cdmaMode, wCdmaMode, wlanMode, ethernetMode,
1541- bluetoothMode, wimaxMode, lteMode, tdscdmaMode;
1542-
1543- unknownMode.setValue(QNetworkInfo::UnknownMode);
1544- gsmMode.setValue(QNetworkInfo::GsmMode);
1545- cdmaMode.setValue(QNetworkInfo::CdmaMode);
1546- wCdmaMode.setValue(QNetworkInfo::WcdmaMode);
1547- wlanMode.setValue(QNetworkInfo::WlanMode);
1548- ethernetMode.setValue(QNetworkInfo::EthernetMode);
1549- bluetoothMode.setValue(QNetworkInfo::BluetoothMode);
1550- wimaxMode.setValue(QNetworkInfo::WimaxMode);
1551- lteMode.setValue(QNetworkInfo::LteMode);
1552- tdscdmaMode.setValue(QNetworkInfo::TdscdmaMode);
1553-
1554- QTest::newRow("Unknown Mode") << unknownMode << false;
1555- QTest::newRow("GSM Mode") << gsmMode << false;
1556- QTest::newRow("CDMA Mode") << cdmaMode << false;
1557- QTest::newRow("WCDMA Mode") << wCdmaMode << false;
1558- QTest::newRow("Wlan Mode") << wlanMode << true;
1559- QTest::newRow("Ethernet Mode") << ethernetMode << true;
1560- QTest::newRow("Bluetooth Mode") << bluetoothMode << true;
1561- QTest::newRow("WIMAX Mode") << wimaxMode << false;
1562- QTest::newRow("LTE Mode") << lteMode << false;
1563- QTest::newRow("TDSCDMA Mode") << tdscdmaMode << false;
1564+ QVariant unknown, twoG, ethernet, wlan, bluetooth, threeG, fourG;
1565+
1566+ unknown.setValue(QNetworkConfiguration::BearerUnknown);
1567+ twoG.setValue(QNetworkConfiguration::Bearer2G);
1568+ ethernet.setValue(QNetworkConfiguration::BearerEthernet);
1569+ wlan.setValue(QNetworkConfiguration::BearerWLAN);
1570+ bluetooth.setValue(QNetworkConfiguration::BearerBluetooth);
1571+ threeG.setValue(QNetworkConfiguration::Bearer3G);
1572+ fourG.setValue(QNetworkConfiguration::Bearer4G);
1573+
1574+ QTest::newRow("Unknown Mode") << unknown << false;
1575+ QTest::newRow("2G Mode") << twoG << false;
1576+ QTest::newRow("Ethernet Mode") << ethernet << true;
1577+ QTest::newRow("WLAN Mode") << wlan << true;
1578+ QTest::newRow("Bluetooth Mode") << bluetooth << true;
1579+ QTest::newRow("3G Mode") << threeG << false;
1580+ QTest::newRow("4G Mode") << fourG << false;
1581 }
1582
1583 void
1584@@ -737,12 +725,12 @@
1585 QFETCH(QVariant, mode);
1586 QFETCH(bool, result);
1587
1588- EXPECT_CALL(*_networkInfo, isOnline())
1589+ EXPECT_CALL(*_networkSession, isOnline())
1590 .WillRepeatedly(Return(true));
1591
1592- EXPECT_CALL(*_networkInfo, currentNetworkMode())
1593+ EXPECT_CALL(*_networkSession, sessionType())
1594 .Times(1)
1595- .WillOnce(Return(mode.value<QNetworkInfo::NetworkMode>()));
1596+ .WillOnce(Return(mode.value<QNetworkConfiguration::BearerType>()));
1597
1598 QScopedPointer<FileDownload> download(new FileDownload(_id, _appId, _path,
1599 _isConfined, _rootPath, _url, _metadata, _headers));
1600@@ -754,7 +742,7 @@
1601
1602 void
1603 TestDownload::testCancel() {
1604- EXPECT_CALL(*_networkInfo, isOnline())
1605+ EXPECT_CALL(*_networkSession, isOnline())
1606 .WillRepeatedly(Return(true));
1607
1608 QScopedPointer<FileDownload> download(new FileDownload(_id, _appId, _path,
1609@@ -770,7 +758,7 @@
1610
1611 void
1612 TestDownload::testPause() {
1613- EXPECT_CALL(*_networkInfo, isOnline())
1614+ EXPECT_CALL(*_networkSession, isOnline())
1615 .WillRepeatedly(Return(true));
1616
1617 QScopedPointer<FileDownload> download(new FileDownload(_id, _appId, _path,
1618@@ -786,7 +774,7 @@
1619
1620 void
1621 TestDownload::testResume() {
1622- EXPECT_CALL(*_networkInfo, isOnline())
1623+ EXPECT_CALL(*_networkSession, isOnline())
1624 .WillRepeatedly(Return(true));
1625
1626 QScopedPointer<FileDownload> download(new FileDownload(_id, _appId, _path,
1627@@ -802,7 +790,7 @@
1628
1629 void
1630 TestDownload::testStart() {
1631- EXPECT_CALL(*_networkInfo, isOnline())
1632+ EXPECT_CALL(*_networkSession, isOnline())
1633 .WillRepeatedly(Return(true));
1634
1635 QScopedPointer<FileDownload> download(new FileDownload(_id, _appId, _path,
1636@@ -824,7 +812,7 @@
1637 // write the expectations of the reply which is what we are
1638 // really testing
1639
1640- EXPECT_CALL(*_networkInfo, isOnline())
1641+ EXPECT_CALL(*_networkSession, isOnline())
1642 .WillRepeatedly(Return(true));
1643
1644 EXPECT_CALL(*_reqFactory, get(_))
1645@@ -875,7 +863,7 @@
1646 // write the expectations of the reply which is what we are
1647 // really testing
1648
1649- EXPECT_CALL(*_networkInfo, isOnline())
1650+ EXPECT_CALL(*_networkSession, isOnline())
1651 .WillRepeatedly(Return(true));
1652
1653 EXPECT_CALL(*_reqFactory, get(_))
1654@@ -904,7 +892,7 @@
1655 // write the expectations of the reply which is what we are
1656 // really testing
1657
1658- EXPECT_CALL(*_networkInfo, isOnline())
1659+ EXPECT_CALL(*_networkSession, isOnline())
1660 .WillRepeatedly(Return(true));
1661
1662 EXPECT_CALL(*_reqFactory, get(_))
1663@@ -968,7 +956,7 @@
1664
1665 void
1666 TestDownload::testPauseDownloadNotStarted() {
1667- EXPECT_CALL(*_networkInfo, isOnline())
1668+ EXPECT_CALL(*_networkSession, isOnline())
1669 .WillRepeatedly(Return(true));
1670
1671 QScopedPointer<FileDownload> download(new FileDownload(_id, _appId, _path,
1672@@ -995,7 +983,7 @@
1673 // write the expectations of the reply which is what we are
1674 // really testing
1675
1676- EXPECT_CALL(*_networkInfo, isOnline())
1677+ EXPECT_CALL(*_networkSession, isOnline())
1678 .WillRepeatedly(Return(true));
1679
1680 EXPECT_CALL(*_reqFactory, get(_))
1681@@ -1054,7 +1042,7 @@
1682 // write the expectations of the reply which is what we are
1683 // really testing
1684
1685- EXPECT_CALL(*_networkInfo, isOnline())
1686+ EXPECT_CALL(*_networkSession, isOnline())
1687 .WillRepeatedly(Return(true));
1688
1689 EXPECT_CALL(*_reqFactory, get(_))
1690@@ -1149,7 +1137,7 @@
1691 // write the expectations of the reply which is what we are
1692 // really testing
1693
1694- EXPECT_CALL(*_networkInfo, isOnline())
1695+ EXPECT_CALL(*_networkSession, isOnline())
1696 .WillRepeatedly(Return(true));
1697
1698 EXPECT_CALL(*_reqFactory, get(_))
1699@@ -1202,7 +1190,7 @@
1700 // write the expectations of the reply which is what we are
1701 // really testing
1702
1703- EXPECT_CALL(*_networkInfo, isOnline())
1704+ EXPECT_CALL(*_networkSession, isOnline())
1705 .WillRepeatedly(Return(true));
1706
1707 EXPECT_CALL(*_reqFactory, get(_))
1708@@ -1259,7 +1247,7 @@
1709 // write the expectations of the reply which is what we are
1710 // really testing
1711
1712- EXPECT_CALL(*_networkInfo, isOnline())
1713+ EXPECT_CALL(*_networkSession, isOnline())
1714 .WillRepeatedly(Return(true));
1715
1716 EXPECT_CALL(*_reqFactory, get(_))
1717@@ -1328,7 +1316,7 @@
1718 // write the expectations of the reply which is what we are
1719 // really testing
1720
1721- EXPECT_CALL(*_networkInfo, isOnline())
1722+ EXPECT_CALL(*_networkSession, isOnline())
1723 .WillRepeatedly(Return(true));
1724
1725 EXPECT_CALL(*_reqFactory, get(_))
1726@@ -1418,7 +1406,7 @@
1727 // write the expectations of the reply which is what we are
1728 // really testing
1729
1730- EXPECT_CALL(*_networkInfo, isOnline())
1731+ EXPECT_CALL(*_networkSession, isOnline())
1732 .WillRepeatedly(Return(true));
1733
1734 EXPECT_CALL(*_reqFactory, get(_))
1735@@ -1517,7 +1505,7 @@
1736 // write the expectations of the reply which is what we are
1737 // really testing
1738
1739- EXPECT_CALL(*_networkInfo, isOnline())
1740+ EXPECT_CALL(*_networkSession, isOnline())
1741 .WillRepeatedly(Return(true));
1742
1743 EXPECT_CALL(*_reqFactory, get(_))
1744@@ -1582,7 +1570,7 @@
1745 // write the expectations of the reply which is what we are
1746 // really testing
1747
1748- EXPECT_CALL(*_networkInfo, isOnline())
1749+ EXPECT_CALL(*_networkSession, isOnline())
1750 .WillRepeatedly(Return(true));
1751
1752 EXPECT_CALL(*_reqFactory, get(_))
1753@@ -1650,7 +1638,7 @@
1754 // write the expectations of the reply which is what we are
1755 // really testing
1756
1757- EXPECT_CALL(*_networkInfo, isOnline())
1758+ EXPECT_CALL(*_networkSession, isOnline())
1759 .WillRepeatedly(Return(true));
1760
1761 EXPECT_CALL(*_reqFactory, get(_))
1762@@ -1714,7 +1702,7 @@
1763 // write the expectations of the reply which is what we are
1764 // really testing
1765
1766- EXPECT_CALL(*_networkInfo, isOnline())
1767+ EXPECT_CALL(*_networkSession, isOnline())
1768 .WillRepeatedly(Return(true));
1769
1770 EXPECT_CALL(*_reqFactory, get(_))
1771@@ -1784,7 +1772,7 @@
1772 // write the expectations of the reply which is what we are
1773 // really testing
1774
1775- EXPECT_CALL(*_networkInfo, isOnline())
1776+ EXPECT_CALL(*_networkSession, isOnline())
1777 .WillRepeatedly(Return(true));
1778
1779 EXPECT_CALL(*_reqFactory, get(_))
1780@@ -1877,7 +1865,7 @@
1781 // write the expectations of the reply which is what we are
1782 // really testing
1783
1784- EXPECT_CALL(*_networkInfo, isOnline())
1785+ EXPECT_CALL(*_networkSession, isOnline())
1786 .WillRepeatedly(Return(true));
1787
1788 EXPECT_CALL(*_reqFactory, get(RequestHeadersEq(headers)))
1789@@ -1952,7 +1940,7 @@
1790 // write the expectations of the reply which is what we are
1791 // really testing
1792
1793- EXPECT_CALL(*_networkInfo, isOnline())
1794+ EXPECT_CALL(*_networkSession, isOnline())
1795 .WillRepeatedly(Return(true));
1796
1797 EXPECT_CALL(*_reqFactory,
1798@@ -2030,7 +2018,7 @@
1799 // write the expectations of the reply which is what we are
1800 // really testing
1801
1802- EXPECT_CALL(*_networkInfo, isOnline())
1803+ EXPECT_CALL(*_networkSession, isOnline())
1804 .WillRepeatedly(Return(true));
1805
1806 QPair<QString, QString> rangeHeader("Range", QString::number(size));
1807@@ -2140,7 +2128,7 @@
1808 // write the expectations of the reply which is what we are
1809 // really testing
1810
1811- EXPECT_CALL(*_networkInfo, isOnline())
1812+ EXPECT_CALL(*_networkSession, isOnline())
1813 .WillRepeatedly(Return(true));
1814
1815 EXPECT_CALL(*_reqFactory, get(_))
1816@@ -2251,7 +2239,7 @@
1817 // write the expectations of the reply which is what we are
1818 // really testing
1819
1820- EXPECT_CALL(*_networkInfo, isOnline())
1821+ EXPECT_CALL(*_networkSession, isOnline())
1822 .WillRepeatedly(Return(true));
1823
1824 EXPECT_CALL(*_reqFactory, get(_))
1825@@ -2362,7 +2350,7 @@
1826 // write the expectations of the reply which is what we are
1827 // really testing
1828
1829- EXPECT_CALL(*_networkInfo, isOnline())
1830+ EXPECT_CALL(*_networkSession, isOnline())
1831 .WillRepeatedly(Return(true));
1832
1833 EXPECT_CALL(*_reqFactory, get(_))
1834@@ -2455,7 +2443,7 @@
1835 // write the expectations of the reply which is what we are
1836 // really testing
1837
1838- EXPECT_CALL(*_networkInfo, isOnline())
1839+ EXPECT_CALL(*_networkSession, isOnline())
1840 .WillRepeatedly(Return(true));
1841
1842 EXPECT_CALL(*_reqFactory, get(_))
1843@@ -2569,7 +2557,7 @@
1844 // write the expectations of the reply which is what we are
1845 // really testing
1846
1847- EXPECT_CALL(*_networkInfo, isOnline())
1848+ EXPECT_CALL(*_networkSession, isOnline())
1849 .WillRepeatedly(Return(true));
1850
1851 EXPECT_CALL(*_reqFactory, get(_))
1852@@ -2674,7 +2662,7 @@
1853 // write the expectations of the reply which is what we are
1854 // really testing
1855
1856- EXPECT_CALL(*_networkInfo, isOnline())
1857+ EXPECT_CALL(*_networkSession, isOnline())
1858 .WillRepeatedly(Return(true));
1859
1860 EXPECT_CALL(*_reqFactory, get(_))
1861@@ -2764,7 +2752,7 @@
1862 // write the expectations of the reply which is what we are
1863 // really testing
1864
1865- EXPECT_CALL(*_networkInfo, isOnline())
1866+ EXPECT_CALL(*_networkSession, isOnline())
1867 .WillRepeatedly(Return(true));
1868
1869 QPair<QString, QString> encodingHeader("Accept-Encoding",
1870@@ -2822,7 +2810,7 @@
1871 // write the expectations of the reply which is what we are
1872 // really testing
1873
1874- EXPECT_CALL(*_networkInfo, isOnline())
1875+ EXPECT_CALL(*_networkSession, isOnline())
1876 .WillRepeatedly(Return(true));
1877
1878 QPair<QString, QString> encodingHeader("Accept-Encoding",
1879@@ -2887,7 +2875,7 @@
1880 // write the expectations of the reply which is what we are
1881 // really testing
1882
1883- EXPECT_CALL(*_networkInfo, isOnline())
1884+ EXPECT_CALL(*_networkSession, isOnline())
1885 .WillRepeatedly(Return(true));
1886
1887 QPair<QString, QString> encodingHeader("Accept-Encoding",
1888@@ -2942,7 +2930,7 @@
1889
1890 void
1891 TestDownload::testLocalPathConfined() {
1892- EXPECT_CALL(*_networkInfo, isOnline())
1893+ EXPECT_CALL(*_networkSession, isOnline())
1894 .WillRepeatedly(Return(true));
1895
1896 // assert that the root path used is not the one in the metadata
1897@@ -2959,7 +2947,7 @@
1898
1899 void
1900 TestDownload::testLocalPathNotConfined() {
1901- EXPECT_CALL(*_networkInfo, isOnline())
1902+ EXPECT_CALL(*_networkSession, isOnline())
1903 .WillRepeatedly(Return(true));
1904
1905 QVariantMap metadata;
1906@@ -2975,7 +2963,7 @@
1907
1908 void
1909 TestDownload::testInvalidUrl() {
1910- EXPECT_CALL(*_networkInfo, isOnline())
1911+ EXPECT_CALL(*_networkSession, isOnline())
1912 .WillRepeatedly(Return(true));
1913
1914 QScopedPointer<FileDownload> download(new FileDownload(_id, _appId, _path,
1915@@ -2987,7 +2975,7 @@
1916
1917 void
1918 TestDownload::testValidUrl() {
1919- EXPECT_CALL(*_networkInfo, isOnline())
1920+ EXPECT_CALL(*_networkSession, isOnline())
1921 .WillRepeatedly(Return(true));
1922
1923 QScopedPointer<FileDownload> download(new FileDownload(_id, _appId, _path,
1924@@ -2999,7 +2987,7 @@
1925
1926 void
1927 TestDownload::testInvalidHashAlgorithm() {
1928- EXPECT_CALL(*_networkInfo, isOnline())
1929+ EXPECT_CALL(*_networkSession, isOnline())
1930 .WillRepeatedly(Return(true));
1931
1932 QScopedPointer<FileDownload> download(new FileDownload(_id, _appId, _path,
1933@@ -3025,7 +3013,7 @@
1934 void
1935 TestDownload::testValidHashAlgorithm() {
1936 QFETCH(QString, algo);
1937- EXPECT_CALL(*_networkInfo, isOnline())
1938+ EXPECT_CALL(*_networkSession, isOnline())
1939 .WillRepeatedly(Return(true));
1940
1941 QScopedPointer<FileDownload> download(new FileDownload(_id, _appId, _path,
1942@@ -3036,7 +3024,7 @@
1943
1944 void
1945 TestDownload::testInvalidFilePresent() {
1946- EXPECT_CALL(*_networkInfo, isOnline())
1947+ EXPECT_CALL(*_networkSession, isOnline())
1948 .WillRepeatedly(Return(true));
1949
1950 // create a file so that we get an error
1951@@ -3057,7 +3045,7 @@
1952
1953 void
1954 TestDownload::testValidFileNotPresent() {
1955- EXPECT_CALL(*_networkInfo, isOnline())
1956+ EXPECT_CALL(*_networkSession, isOnline())
1957 .WillRepeatedly(Return(true));
1958
1959 QString filePath = testDirectory() + QDir::separator() + "test_file.jpg";
1960@@ -3073,7 +3061,7 @@
1961
1962 void
1963 TestDownload::testDownloadPresent() {
1964- EXPECT_CALL(*_networkInfo, isOnline())
1965+ EXPECT_CALL(*_networkSession, isOnline())
1966 .WillRepeatedly(Return(true));
1967
1968 // create a download and get the filename to use, then write it
1969@@ -3108,7 +3096,7 @@
1970
1971 void
1972 TestDownload::testDownloadPresentSeveralFiles() {
1973- EXPECT_CALL(*_networkInfo, isOnline())
1974+ EXPECT_CALL(*_networkSession, isOnline())
1975 .WillRepeatedly(Return(true));
1976
1977 QFETCH(int, count);
1978@@ -3166,7 +3154,7 @@
1979 // write the expectations of the reply which is what we are
1980 // really testing
1981
1982- EXPECT_CALL(*_networkInfo, isOnline())
1983+ EXPECT_CALL(*_networkSession, isOnline())
1984 .WillRepeatedly(Return(true));
1985
1986 EXPECT_CALL(*_reqFactory, get(_))
1987@@ -3253,7 +3241,7 @@
1988 QScopedPointer<MockFile> file(new MockFile("test"));
1989 QScopedPointer<MockNetworkReply> reply(new MockNetworkReply());
1990
1991- EXPECT_CALL(*_networkInfo, isOnline())
1992+ EXPECT_CALL(*_networkSession, isOnline())
1993 .WillRepeatedly(Return(true));
1994
1995 // set expectations to get the request and the reply correctly
1996@@ -3326,7 +3314,7 @@
1997 QScopedPointer<MockFile> file(new MockFile("test"));
1998 QScopedPointer<MockNetworkReply> reply(new MockNetworkReply());
1999
2000- EXPECT_CALL(*_networkInfo, isOnline())
2001+ EXPECT_CALL(*_networkSession, isOnline())
2002 .WillRepeatedly(Return(true));
2003
2004 // set expectations to get the request and the reply correctly
2005@@ -3409,7 +3397,7 @@
2006 // write the expectations of the reply which is what we are
2007 // really testing
2008
2009- EXPECT_CALL(*_networkInfo, isOnline())
2010+ EXPECT_CALL(*_networkSession, isOnline())
2011 .WillRepeatedly(Return(true));
2012
2013 EXPECT_CALL(*_reqFactory, get(_))
2014@@ -3495,7 +3483,7 @@
2015 // write the expectations of the reply which is what we are
2016 // really testing
2017
2018- EXPECT_CALL(*_networkInfo, isOnline())
2019+ EXPECT_CALL(*_networkSession, isOnline())
2020 .WillRepeatedly(Return(true));
2021
2022 EXPECT_CALL(*_reqFactory, get(_))
2023@@ -3664,7 +3652,7 @@
2024 // write the expectations of the reply which is what we are
2025 // really testing
2026
2027- EXPECT_CALL(*_networkInfo, isOnline())
2028+ EXPECT_CALL(*_networkSession, isOnline())
2029 .WillRepeatedly(Return(true));
2030
2031 EXPECT_CALL(*_reqFactory, get(_))
2032@@ -3780,7 +3768,7 @@
2033 auto path = testDirectory() + QDir::separator() + "test";
2034 QDir().mkpath(path);
2035
2036- EXPECT_CALL(*_networkInfo, isOnline())
2037+ EXPECT_CALL(*_networkSession, isOnline())
2038 .WillRepeatedly(Return(true));
2039
2040 QScopedPointer<FileDownload> download(new FileDownload(_id, _appId, _path,
2041@@ -3795,7 +3783,7 @@
2042 void
2043 TestDownload::testSetLocalDirectoryNotAbsolute() {
2044 auto path = QString("./path");
2045- EXPECT_CALL(*_networkInfo, isOnline())
2046+ EXPECT_CALL(*_networkSession, isOnline())
2047 .WillRepeatedly(Return(true));
2048
2049 QScopedPointer<FileDownload> download(new FileDownload(_id, _appId, _path,
2050@@ -3810,7 +3798,7 @@
2051 void
2052 TestDownload::testSetLocalDirectoryNotPresent() {
2053 auto path = QString("/not/present/path");
2054- EXPECT_CALL(*_networkInfo, isOnline())
2055+ EXPECT_CALL(*_networkSession, isOnline())
2056 .WillRepeatedly(Return(true));
2057
2058 QScopedPointer<FileDownload> download(new FileDownload(_id, _appId, _path,
2059@@ -3830,7 +3818,7 @@
2060 file.write(QByteArray(100, 'w'));
2061 file.close();
2062
2063- EXPECT_CALL(*_networkInfo, isOnline())
2064+ EXPECT_CALL(*_networkSession, isOnline())
2065 .WillRepeatedly(Return(true));
2066
2067 QScopedPointer<FileDownload> download(new FileDownload(_id, _appId, _path,
2068@@ -3847,7 +3835,7 @@
2069 auto path = testDirectory() + QDir::separator() + "test";
2070 QDir().mkpath(path);
2071
2072- EXPECT_CALL(*_networkInfo, isOnline())
2073+ EXPECT_CALL(*_networkSession, isOnline())
2074 .WillRepeatedly(Return(true));
2075
2076 QScopedPointer<FileDownload> download(new FileDownload(_id, _appId, _path,
2077@@ -3866,7 +3854,7 @@
2078 QVariantMap metadata;
2079 metadata[Ubuntu::Transfers::Metadata::DEFLATE_KEY] = true;
2080
2081- EXPECT_CALL(*_networkInfo, isOnline())
2082+ EXPECT_CALL(*_networkSession, isOnline())
2083 .WillRepeatedly(Return(true));
2084
2085 QScopedPointer<FileDownload> download(new FileDownload(_id, _appId, _path,
2086@@ -3882,7 +3870,7 @@
2087 QVariantMap metadata;
2088 metadata[Ubuntu::Transfers::Metadata::DEFLATE_KEY] = false;
2089
2090- EXPECT_CALL(*_networkInfo, isOnline())
2091+ EXPECT_CALL(*_networkSession, isOnline())
2092 .WillRepeatedly(Return(true));
2093
2094 QScopedPointer<FileDownload> download(new FileDownload(_id, _appId, _path,
2095@@ -3903,7 +3891,7 @@
2096 // write the expectations of the reply which is what we are
2097 // really testing
2098
2099- EXPECT_CALL(*_networkInfo, isOnline())
2100+ EXPECT_CALL(*_networkSession, isOnline())
2101 .WillRepeatedly(Return(true));
2102
2103 // assert that we do have gzip and deflate in the content-encoding header
2104
2105=== modified file 'tests/downloads/daemon/test_download.h'
2106--- tests/downloads/daemon/test_download.h 2014-09-22 23:24:34 +0000
2107+++ tests/downloads/daemon/test_download.h 2014-11-26 12:24:23 +0000
2108@@ -28,7 +28,7 @@
2109 #include <file_manager.h>
2110 #include <process_factory.h>
2111 #include <request_factory.h>
2112-#include <system_network_info.h>
2113+#include <network_session.h>
2114
2115 #include "base_testcase.h"
2116 #include "cryptographic_hash.h"
2117@@ -196,13 +196,13 @@
2118 QString _path;
2119 QUrl _url;
2120 QString _algo;
2121- MockSystemNetworkInfo* _networkInfo;
2122+ MockNetworkSession* _networkSession;
2123 MockRequestFactory* _reqFactory;
2124 MockProcessFactory* _processFactory;
2125 MockFileManager* _fileManager;
2126 MockCryptographicHashFactory* _cryptoFactory;
2127 };
2128
2129-Q_DECLARE_METATYPE(QNetworkInfo::NetworkMode)
2130+Q_DECLARE_METATYPE(QNetworkConfiguration::BearerType)
2131
2132 #endif // TEST_APP_DOWNLOAD_H
2133
2134=== modified file 'tests/downloads/daemon/test_download_factory.cpp'
2135--- tests/downloads/daemon/test_download_factory.cpp 2014-07-04 15:29:48 +0000
2136+++ tests/downloads/daemon/test_download_factory.cpp 2014-11-26 12:24:23 +0000
2137@@ -22,6 +22,7 @@
2138 #include <ubuntu/transfers/system/hash_algorithm.h>
2139 #include <ubuntu/transfers/system/file_manager.h>
2140 #include <ubuntu/transfers/system/uuid_utils.h>
2141+#include <network_session.h>
2142 #include "test_download_factory.h"
2143
2144 using ::testing::_;
2145@@ -39,7 +40,7 @@
2146 TestDownloadFactory::cleanup() {
2147 BaseTestCase::cleanup();
2148
2149- SystemNetworkInfo::deleteInstance();
2150+ NetworkSession::deleteInstance();
2151 delete _downFactory;
2152 FileManager::deleteInstance();
2153 RequestFactory::deleteInstance();
2154
2155=== modified file 'tests/downloads/daemon/test_download_factory.h'
2156--- tests/downloads/daemon/test_download_factory.h 2014-07-07 12:16:47 +0000
2157+++ tests/downloads/daemon/test_download_factory.h 2014-11-26 12:24:23 +0000
2158@@ -24,7 +24,6 @@
2159 #include <apparmor.h>
2160 #include <process_factory.h>
2161 #include <request_factory.h>
2162-#include <system_network_info.h>
2163
2164 #include "uuid_factory.h"
2165 #include "base_testcase.h"
2166
2167=== modified file 'tests/downloads/daemon/test_download_manager.cpp'
2168--- tests/downloads/daemon/test_download_manager.cpp 2014-07-03 09:01:01 +0000
2169+++ tests/downloads/daemon/test_download_manager.cpp 2014-11-26 12:24:23 +0000
2170@@ -20,7 +20,7 @@
2171 #include <ubuntu/download_manager/download_struct.h>
2172 #include <ubuntu/transfers/system/uuid_utils.h>
2173 #include <ubuntu/transfers/system/process_factory.h>
2174-#include <ubuntu/transfers/system/system_network_info.h>
2175+#include <ubuntu/transfers/system/network_session.h>
2176 #include <gmock/gmock.h>
2177 #include "dbus_proxy.h"
2178 #include "download.h"
2179@@ -54,7 +54,7 @@
2180 TestDownloadManager::cleanup() {
2181 BaseTestCase::cleanup();
2182
2183- SystemNetworkInfo::deleteInstance();
2184+ NetworkSession::deleteInstance();
2185 RequestFactory::deleteInstance();
2186 ProcessFactory::deleteInstance();
2187 DownloadsDb::deleteInstance();
2188
2189=== modified file 'tests/downloads/daemon/test_download_manager.h'
2190--- tests/downloads/daemon/test_download_manager.h 2014-07-07 12:16:47 +0000
2191+++ tests/downloads/daemon/test_download_manager.h 2014-11-26 12:24:23 +0000
2192@@ -26,7 +26,7 @@
2193 #include <ubuntu/downloads/file_download.h>
2194 #include <apparmor.h>
2195 #include <request_factory.h>
2196-#include <system_network_info.h>
2197+#include <network_session.h>
2198
2199 #include "application.h"
2200 #include "base_testcase.h"
2201
2202=== modified file 'tests/downloads/daemon/test_downloads_db.cpp'
2203--- tests/downloads/daemon/test_downloads_db.cpp 2014-07-03 09:01:01 +0000
2204+++ tests/downloads/daemon/test_downloads_db.cpp 2014-11-26 12:24:23 +0000
2205@@ -24,7 +24,7 @@
2206 #include <ubuntu/download_manager/metatypes.h>
2207 #include <ubuntu/transfers/system/hash_algorithm.h>
2208 #include <ubuntu/transfers/system/uuid_utils.h>
2209-#include <ubuntu/transfers/system/system_network_info.h>
2210+#include <ubuntu/transfers/system/network_session.h>
2211 #include <ubuntu/downloads/file_download.h>
2212 #include "test_downloads_db.h"
2213
2214@@ -59,7 +59,7 @@
2215 _db = nullptr;
2216
2217 QFile::remove(dbFile);
2218- SystemNetworkInfo::deleteInstance();
2219+ NetworkSession::deleteInstance();
2220 FileManager::deleteInstance();
2221 FileNameMutex::deleteInstance();
2222 }
2223
2224=== modified file 'tests/downloads/daemon/test_group_download.cpp'
2225--- tests/downloads/daemon/test_group_download.cpp 2014-07-03 09:01:01 +0000
2226+++ tests/downloads/daemon/test_group_download.cpp 2014-11-26 12:24:23 +0000
2227@@ -56,7 +56,7 @@
2228 TestGroupDownload::cleanup() {
2229 BaseTestCase::cleanup();
2230
2231- SystemNetworkInfo::deleteInstance();
2232+ NetworkSession::deleteInstance();
2233 FileManager::deleteInstance();
2234 delete _factory;
2235 }
2236
2237=== modified file 'tests/downloads/daemon/test_group_download.h'
2238--- tests/downloads/daemon/test_group_download.h 2014-07-07 12:16:47 +0000
2239+++ tests/downloads/daemon/test_group_download.h 2014-11-26 12:24:23 +0000
2240@@ -24,7 +24,7 @@
2241 #include <ubuntu/downloads/group_download.h>
2242 #include <process_factory.h>
2243 #include <request_factory.h>
2244-#include <system_network_info.h>
2245+#include <network_session.h>
2246
2247 #include "base_testcase.h"
2248 #include "factory.h"
2249@@ -97,7 +97,7 @@
2250 bool _isGSMDownloadAllowed;
2251 QVariantMap _metadata;
2252 QMap<QString, QString> _headers;
2253- MockSystemNetworkInfo* _networkInfo;
2254+ MockNetworkSession* _networkSession;
2255 MockDownloadFactory* _factory;
2256 MockFileManager* _fileManager;
2257 };
2258
2259=== modified file 'tests/downloads/daemon/test_transfers_queue.cpp'
2260--- tests/downloads/daemon/test_transfers_queue.cpp 2014-07-16 08:41:38 +0000
2261+++ tests/downloads/daemon/test_transfers_queue.cpp 2014-11-26 12:24:23 +0000
2262@@ -38,8 +38,8 @@
2263 BaseTestCase::init();
2264 _isConfined = true;
2265 _rootPath = "/random/root/path";
2266- _networkInfo = new MockSystemNetworkInfo();
2267- SystemNetworkInfo::setInstance(_networkInfo);
2268+ _networkInfo = new MockNetworkSession();
2269+ NetworkSession::setInstance(_networkInfo);
2270 _first = new MockTransfer(UuidUtils::getDBusString(QUuid::createUuid()),
2271 "first-path", _isConfined, "/root/path");
2272 _second = new MockTransfer(UuidUtils::getDBusString(QUuid::createUuid()),
2273@@ -51,7 +51,7 @@
2274 TestTransferQueue::cleanup() {
2275 BaseTestCase::cleanup();
2276
2277- SystemNetworkInfo::deleteInstance();
2278+ NetworkSession::deleteInstance();
2279 delete _first;
2280 delete _second;
2281 delete _q;
2282
2283=== modified file 'tests/downloads/daemon/test_transfers_queue.h'
2284--- tests/downloads/daemon/test_transfers_queue.h 2014-07-07 12:16:47 +0000
2285+++ tests/downloads/daemon/test_transfers_queue.h 2014-11-26 12:24:23 +0000
2286@@ -23,7 +23,7 @@
2287 #include <ubuntu/transfers/queue.h>
2288 #include <process_factory.h>
2289 #include <request_factory.h>
2290-#include <system_network_info.h>
2291+#include <network_session.h>
2292
2293 #include "base_testcase.h"
2294 #include "transfer.h"
2295@@ -73,7 +73,7 @@
2296 private:
2297 bool _isConfined;
2298 QString _rootPath;
2299- MockSystemNetworkInfo* _networkInfo;
2300+ MockNetworkSession* _networkInfo;
2301 MockTransfer* _first;
2302 MockTransfer* _second;
2303 Queue* _q;
2304
2305=== modified file 'tests/downloads/qml/CMakeLists.txt'
2306--- tests/downloads/qml/CMakeLists.txt 2014-09-18 13:22:31 +0000
2307+++ tests/downloads/qml/CMakeLists.txt 2014-11-26 12:24:23 +0000
2308@@ -36,7 +36,6 @@
2309 endforeach(test)
2310
2311 include_directories(${Qt5Core_INCLUDE_DIRS})
2312-include_directories(${Qt5SystemInfo_INCLUDE_DIRS})
2313 include_directories(${Qt5DBus_INCLUDE_DIRS})
2314 include_directories(${Qt5Network_INCLUDE_DIRS})
2315 include_directories(${Qt5Test_INCLUDE_DIRS})
2316
2317=== modified file 'tests/uploads/daemon/CMakeLists.txt'
2318--- tests/uploads/daemon/CMakeLists.txt 2014-07-17 08:40:07 +0000
2319+++ tests/uploads/daemon/CMakeLists.txt 2014-11-26 12:24:23 +0000
2320@@ -35,7 +35,6 @@
2321
2322
2323 include_directories(${Qt5Core_INCLUDE_DIRS})
2324-include_directories(${Qt5SystemInfo_INCLUDE_DIRS})
2325 include_directories(${Qt5DBus_INCLUDE_DIRS})
2326 include_directories(${Qt5Network_INCLUDE_DIRS})
2327 include_directories(${Qt5Test_INCLUDE_DIRS})
2328
2329=== modified file 'tests/uploads/daemon/test_file_upload.h'
2330--- tests/uploads/daemon/test_file_upload.h 2014-07-16 12:28:32 +0000
2331+++ tests/uploads/daemon/test_file_upload.h 2014-11-26 12:24:23 +0000
2332@@ -23,7 +23,6 @@
2333 #include <ubuntu/uploads/file_upload.h>
2334 #include <file_manager.h>
2335 #include <request_factory.h>
2336-#include <system_network_info.h>
2337
2338 #include "uuid_factory.h"
2339 #include "base_testcase.h"
2340
2341=== modified file 'tests/uploads/daemon/test_mms_upload.h'
2342--- tests/uploads/daemon/test_mms_upload.h 2014-07-16 14:43:56 +0000
2343+++ tests/uploads/daemon/test_mms_upload.h 2014-11-26 12:24:23 +0000
2344@@ -23,7 +23,6 @@
2345 #include <ubuntu/uploads/mms_file_upload.h>
2346 #include <file_manager.h>
2347 #include <request_factory.h>
2348-#include <system_network_info.h>
2349
2350 #include "uuid_factory.h"
2351 #include "base_testcase.h"
2352
2353=== modified file 'tests/uploads/daemon/test_upload_factory.cpp'
2354--- tests/uploads/daemon/test_upload_factory.cpp 2014-07-07 12:16:47 +0000
2355+++ tests/uploads/daemon/test_upload_factory.cpp 2014-11-26 12:24:23 +0000
2356@@ -34,7 +34,7 @@
2357 TestUploadFactory::cleanup() {
2358 BaseTestCase::cleanup();
2359
2360- SystemNetworkInfo::deleteInstance();
2361+ NetworkSession::deleteInstance();
2362 delete _upFactory;
2363 FileManager::deleteInstance();
2364 RequestFactory::deleteInstance();
2365
2366=== modified file 'tests/uploads/daemon/test_upload_factory.h'
2367--- tests/uploads/daemon/test_upload_factory.h 2014-07-07 12:16:47 +0000
2368+++ tests/uploads/daemon/test_upload_factory.h 2014-11-26 12:24:23 +0000
2369@@ -24,7 +24,7 @@
2370 #include <apparmor.h>
2371 #include <process_factory.h>
2372 #include <request_factory.h>
2373-#include <system_network_info.h>
2374+#include <network_session.h>
2375
2376 #include "uuid_factory.h"
2377 #include "base_testcase.h"

Subscribers

People subscribed via source and target branches