on xenial help sign in
Remove usage of the deprecated (and non-functional) system-image-dbus service.

Approved by: Michael Terry, Unity8 CI Bot

commit78ebe21b2027217a4d4580953c4d4576b444aa60 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateTue 28 Mar 2017, 21:44 (10 years ago) parentdbab3b1ac6f7e2
23 files changed−749
plugins/Ubuntu/CMakeLists.txt−1 plugins/Ubuntu/SystemImage/CMakeLists.txt−15 plugins/Ubuntu/SystemImage/SystemImage.cpp−155 plugins/Ubuntu/SystemImage/SystemImage.h−84 plugins/Ubuntu/SystemImage/plugin.cpp−28 plugins/Ubuntu/SystemImage/plugin.h−31 plugins/Ubuntu/SystemImage/qmldir−3 qml/Greeter/Greeter.qml−11 qml/Greeter/NarrowView.qml−14 qml/Greeter/WideView.qml−4 qml/Wizard/Pages/30-wifi.qml−4 qml/Wizard/Pages/77-system-update.qml−156 tests/mocks/Ubuntu/CMakeLists.txt−1 tests/mocks/Ubuntu/SystemImage/CMakeLists.txt−10 tests/mocks/Ubuntu/SystemImage/MockSystemImage.cpp−50 tests/mocks/Ubuntu/SystemImage/MockSystemImage.h−56 tests/mocks/Ubuntu/SystemImage/plugin.cpp−34 tests/mocks/Ubuntu/SystemImage/plugin.h−31 tests/mocks/Ubuntu/SystemImage/qmldir−3 tests/qmltests/Greeter/TestView.qml−5 tests/qmltests/Greeter/tst_Greeter.qml−7 tests/qmltests/Wizard/tst_Wizard.qml−6 tests/qmltests/tst_ShellWithPin.qml−40
plugins/Ubuntu/CMakeLists.txt−1
@@ -1,3 +1,2 @@
11add_subdirectory(Gestures)
22add_subdirectory(DownloadDaemonListener)
3−add_subdirectory(SystemImage)
plugins/Ubuntu/SystemImage/CMakeLists.txtdeleted−15
@@ -1,15 +0,0 @@
1−include_directories(
2− ${GLIB_INCLUDE_DIRS}
3−)
4−
5−set(SYSTEMIMAGE_SOURCES
6− plugin.cpp
7− SystemImage.cpp
8−)
9−
10−add_library(SystemImage MODULE ${SYSTEMIMAGE_SOURCES})
11−
12−qt5_use_modules(SystemImage Qml DBus Core)
13−target_link_libraries(SystemImage ${GLIB_LIBRARIES})
14−
15−add_unity8_plugin(Ubuntu.SystemImage 0.1 Ubuntu/SystemImage TARGETS SystemImage)
plugins/Ubuntu/SystemImage/SystemImage.cppdeleted−155
@@ -1,155 +0,0 @@
1−/*
2− * Copyright (C) 2014-2016 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−#include <QDBusConnection>
18−#include <QDBusPendingCall>
19−#include <QDBusReply>
20−#include <QDebug>
21−
22−#include <glib.h>
23−
24−#include "SystemImage.h"
25−
26−#define SYSTEMIMAGE_SERVICE QStringLiteral("com.canonical.SystemImage")
27−#define SYSTEMIMAGE_PATH QStringLiteral("/Service")
28−#define SYSTEMIMAGE_IFACE QStringLiteral("com.canonical.SystemImage")
29−
30−Q_LOGGING_CATEGORY(SYSTEMIMAGEPLUGIN, "unity8.systemimage", QtWarningMsg)
31−
32−#define DEBUG_MSG qCDebug(SYSTEMIMAGEPLUGIN).nospace().noquote() << Q_FUNC_INFO
33−#define WARNING_MSG qCWarning(SYSTEMIMAGEPLUGIN).nospace().noquote() << Q_FUNC_INFO
34−
35−SystemImage::SystemImage(QObject *parent)
36− : QObject(parent)
37−{
38− QDBusConnection::systemBus().connect(SYSTEMIMAGE_SERVICE, SYSTEMIMAGE_PATH, SYSTEMIMAGE_IFACE, QStringLiteral("UpdateAvailableStatus"),
39− this, SLOT(onUpdateAvailableStatus(bool,bool,QString,int,QString,QString)));
40− QDBusConnection::systemBus().connect(SYSTEMIMAGE_SERVICE, SYSTEMIMAGE_PATH, SYSTEMIMAGE_IFACE, QStringLiteral("UpdateDownloaded"),
41− this, SLOT(onUpdateDownloaded()));
42− QDBusConnection::systemBus().connect(SYSTEMIMAGE_SERVICE, SYSTEMIMAGE_PATH, SYSTEMIMAGE_IFACE, QStringLiteral("UpdateFailed"),
43− this, SLOT(onUpdateFailed(int,QString)));
44− QDBusConnection::systemBus().connect(SYSTEMIMAGE_SERVICE, SYSTEMIMAGE_PATH, SYSTEMIMAGE_IFACE, QStringLiteral("Applied"),
45− this, SLOT(onUpdateApplied(bool)));
46− QDBusConnection::systemBus().connect(SYSTEMIMAGE_SERVICE, SYSTEMIMAGE_PATH, SYSTEMIMAGE_IFACE, QStringLiteral("Rebooting"),
47− this, SLOT(onRebooting(bool)));
48−}
49−
50−void SystemImage::checkForUpdate()
51−{
52− DEBUG_MSG << "Checking for update";
53− const QDBusMessage msg = QDBusMessage::createMethodCall(SYSTEMIMAGE_SERVICE, SYSTEMIMAGE_PATH, SYSTEMIMAGE_IFACE,
54− QStringLiteral("CheckForUpdate"));
55− QDBusConnection::systemBus().asyncCall(msg);
56−}
57−
58−void SystemImage::applyUpdate()
59−{
60− DEBUG_MSG << "Applying update";
61− setUpdateApplying(true);
62−
63− const QDBusMessage msg = QDBusMessage::createMethodCall(SYSTEMIMAGE_SERVICE, SYSTEMIMAGE_PATH, SYSTEMIMAGE_IFACE,
64− QStringLiteral("ApplyUpdate"));
65− QDBusConnection::systemBus().asyncCall(msg);
66−}
67−
68−void SystemImage::factoryReset()
69−{
70− const QDBusMessage msg = QDBusMessage::createMethodCall(SYSTEMIMAGE_SERVICE, SYSTEMIMAGE_PATH, SYSTEMIMAGE_IFACE,
71− QStringLiteral("FactoryReset"));
72− QDBusConnection::systemBus().asyncCall(msg);
73−}
74−
75−void SystemImage::onUpdateAvailableStatus(bool is_available, bool downloading, const QString &available_version, int update_size,
76− const QString &last_update_date, const QString &error_reason)
77−{
78− DEBUG_MSG << "A new update is " << (is_available ? "" : "NOT") << "available";
79−
80− if (is_available == m_updateAvailable) {
81− return;
82− }
83−
84− m_updateAvailable = is_available;
85− m_downloading = downloading;
86− m_availableVersion = available_version;
87− m_updateSize = formatSize(update_size);
88− m_lastUpdateDate = last_update_date;
89− m_errorReason = error_reason;
90− Q_EMIT updateAvailableStatus();
91−
92− DEBUG_MSG << "Downloading: " << downloading << ", version: " << available_version << ", last update: " << last_update_date <<
93− ", size: " << m_updateSize;
94−}
95−
96−void SystemImage::onUpdateDownloaded()
97−{
98− DEBUG_MSG << "Update downloaded";
99−
100− m_downloaded = true;
101− Q_EMIT updateDownloadedChanged();
102−}
103−
104−void SystemImage::onUpdateFailed(int /*consecutive_failure_count*/, const QString &last_reason)
105−{
106− WARNING_MSG << "System Update failed: " << last_reason;
107− setUpdateApplying(false);
108−}
109−
110−void SystemImage::onUpdateApplied(bool applied)
111−{
112− DEBUG_MSG << "System Update applied with status: " << applied;
113− setUpdateApplying(false);
114− if (applied) {
115− resetUpdateStatus();
116− Q_EMIT updateAvailableStatus();
117− }
118−}
119−
120−void SystemImage::onRebooting(bool status)
121−{
122− setUpdateApplying(false);
123− DEBUG_MSG << "Rebooting: " << status;
124−}
125−
126−void SystemImage::setUpdateApplying(bool status)
127−{
128− if (status != m_updateApplying) {
129− m_updateApplying = status;
130− Q_EMIT updateApplyingChanged();
131− }
132−}
133−
134−void SystemImage::resetUpdateStatus()
135−{
136− m_updateAvailable = false;
137− m_updateApplying = false;
138− m_downloading = false;
139− m_downloaded = false;
140− m_availableVersion.clear();
141− m_updateSize.clear();
142− m_lastUpdateDate.clear();
143− m_errorReason.clear();
144−}
145−
146−QString SystemImage::formatSize(quint64 size) const
147−{
148− guint64 g_size = size;
149−
150− gchar * formatted_size = g_format_size(g_size);
151− QString q_formatted_size = QString::fromLocal8Bit(formatted_size);
152− g_free(formatted_size);
153−
154− return q_formatted_size;
155−}
plugins/Ubuntu/SystemImage/SystemImage.hdeleted−84
@@ -1,84 +0,0 @@
1−/*
2− * Copyright (C) 2014-2016 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−#ifndef SYSTEMIMAGE_H
18−#define SYSTEMIMAGE_H
19−
20−#include <QObject>
21−#include <QLoggingCategory>
22−
23−Q_DECLARE_LOGGING_CATEGORY(SYSTEMIMAGEPLUGIN)
24−
25−class SystemImage : public QObject
26−{
27− Q_OBJECT
28− Q_DISABLE_COPY(SystemImage)
29−
30− Q_PROPERTY(bool updateAvailable READ updateAvailable NOTIFY updateAvailableStatus)
31− Q_PROPERTY(bool updateDownloading READ updateDownloading NOTIFY updateAvailableStatus)
32− Q_PROPERTY(QString availableVersion READ availableVersion NOTIFY updateAvailableStatus)
33− Q_PROPERTY(QString updateSize READ updateSize NOTIFY updateAvailableStatus)
34− Q_PROPERTY(bool updateApplying READ updateApplying NOTIFY updateApplyingChanged)
35− Q_PROPERTY(bool updateDownloaded READ updateDownloaded NOTIFY updateDownloadedChanged)
36−
37−public:
38− explicit SystemImage(QObject *parent = nullptr);
39− ~SystemImage() = default;
40−
41− bool updateAvailable() const { return m_updateAvailable; }
42− bool updateDownloading() const { return m_downloading; }
43− QString availableVersion() const { return m_availableVersion; }
44− QString updateSize() const { return m_updateSize; }
45− bool updateApplying() const { return m_updateApplying; }
46− bool updateDownloaded() const { return m_downloaded; }
47−
48−public Q_SLOTS:
49− Q_INVOKABLE void checkForUpdate();
50− Q_INVOKABLE void applyUpdate();
51− Q_INVOKABLE void factoryReset();
52−
53−private Q_SLOTS:
54− void onUpdateAvailableStatus(bool is_available, bool updateDownloading, const QString &available_version,
55− int update_size, const QString &last_update_date, const QString &error_reason);
56− void onUpdateDownloaded();
57− void onUpdateFailed(int consecutive_failure_count, const QString & last_reason);
58− void onUpdateApplied(bool applied);
59− void onRebooting(bool status);
60−
61−Q_SIGNALS:
62− void updateAvailableStatus();
63− void updateDownloadedChanged();
64− void updateApplyingChanged();
65−
66−private Q_SLOTS:
67− void setUpdateApplying(bool status);
68−
69−private:
70− void resetUpdateStatus();
71− QString formatSize(quint64 size) const;
72−
73−private:
74− bool m_updateAvailable = false;
75− bool m_updateApplying = false;
76− bool m_downloading = false;
77− bool m_downloaded = false;
78− QString m_availableVersion;
79− QString m_updateSize;
80− QString m_lastUpdateDate;
81− QString m_errorReason;
82−};
83−
84−#endif // SYSTEMIMAGE_H
plugins/Ubuntu/SystemImage/plugin.cppdeleted−28
@@ -1,28 +0,0 @@
1−/*
2− * Copyright (C) 2014-2016 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−#include "plugin.h"
18−#include "SystemImage.h"
19−
20−#include <QtQml>
21−
22−void BackendPlugin::registerTypes(const char *uri)
23−{
24− Q_ASSERT(uri == QLatin1String("Ubuntu.SystemImage"));
25−
26− qmlRegisterSingletonType<SystemImage>(uri, 0, 1, "SystemImage",
27− [](QQmlEngine*, QJSEngine*) -> QObject* { return new SystemImage; });
28−}
plugins/Ubuntu/SystemImage/plugin.hdeleted−31
@@ -1,31 +0,0 @@
1−/*
2− * Copyright (C) 2014 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−#ifndef SYSTEMIMAGE_PLUGIN_H
18−#define SYSTEMIMAGE_PLUGIN_H
19−
20−#include <QQmlExtensionPlugin>
21−
22−class BackendPlugin : public QQmlExtensionPlugin
23−{
24− Q_OBJECT
25− Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
26−
27−public:
28− void registerTypes(const char *uri) override;
29−};
30−
31−#endif // SYSTEMIMAGE_PLUGIN_H
plugins/Ubuntu/SystemImage/qmldirdeleted−3
@@ -1,3 +0,0 @@
1−module Ubuntu.SystemImage
2−plugin SystemImage
3−typeinfo SystemImage.qmltypes
qml/Greeter/Greeter.qml−11
@@ -20,7 +20,6 @@ import Biometryd 0.0
2020import GSettings 1.0
2121import Powerd 0.1
2222import Ubuntu.Components 1.3
23−import Ubuntu.SystemImage 0.1
2423import Unity.Launcher 0.1
2524import Unity.Session 0.1
2625
@@ -56,7 +55,6 @@ Showable {
5655 property bool tabletMode
5756 property url viewSource // only used for testing
5857
59− property int maxFailedLogins: -1 // disabled by default for now, will enable via settings in future
6058 property int failedLoginsDelayAttempts: 7 // number of failed logins
6159 property real failedLoginsDelayMinutes: 5 // minutes of forced waiting
6260 property int failedFingerprintLoginsDisableAttempts: 3 // number of failed fingerprint logins
@@ -469,15 +467,6 @@ Showable {
469467 if (!automatic) {
470468 AccountsService.failedLogins++;
471469
472− // Check if we should initiate a factory reset
473− if (maxFailedLogins >= 2) { // require at least a warning
474− if (AccountsService.failedLogins === maxFailedLogins - 1) {
475− loader.item.showLastChance();
476− } else if (AccountsService.failedLogins >= maxFailedLogins) {
477− SystemImage.factoryReset(); // Ouch!
478− }
479− }
480−
481470 // Check if we should initiate a forced login delay
482471 if (failedLoginsDelayAttempts > 0
483472 && AccountsService.failedLogins > 0
qml/Greeter/NarrowView.qml−14
@@ -48,20 +48,6 @@ FocusScope {
4848 signal tease()
4949 signal emergencyCall()
5050
51− function showLastChance() {
52− /* TODO: when we finish support for resetting device after too many
53− failed logins, we should re-add this popup.
54− var title = lockscreen.alphaNumeric ?
55− i18n.tr("Sorry, incorrect passphrase.") :
56− i18n.tr("Sorry, incorrect passcode.");
57− var text = i18n.tr("This will be your last attempt.") + " " +
58− (lockscreen.alphaNumeric ?
59− i18n.tr("If passphrase is entered incorrectly, your phone will conduct a factory reset and all personal data will be deleted.") :
60− i18n.tr("If passcode is entered incorrectly, your phone will conduct a factory reset and all personal data will be deleted."));
61− lockscreen.showInfoPopup(title, text);
62− */
63− }
64−
6551 function hide() {
6652 lockscreen.hide();
6753 coverPage.hide();
qml/Greeter/WideView.qml−4
@@ -80,10 +80,6 @@ FocusScope {
8080 loginList.showFakePassword();
8181 }
8282
83− function showLastChance() {
84− // TODO
85− }
86−
8783 Rectangle {
8884 anchors.fill: parent
8985 color: "black"
qml/Wizard/Pages/30-wifi.qml−4
@@ -20,7 +20,6 @@ import QMenuModel 0.1 as QMenuModel
2020import Ubuntu.Components 1.3
2121import Wizard 0.1
2222import Ubuntu.Connectivity 1.0
23−import Ubuntu.SystemImage 0.1
2423import ".." as LocalComponents
2524import "../../Components"
2625
@@ -206,9 +205,6 @@ LocalComponents.Page {
206205 LocalComponents.StackButton {
207206 text: (connected || listview.count === 0) ? i18n.tr("Next") : i18n.tr("Skip")
208207 onClicked: {
209− if (connected) {
210− SystemImage.checkForUpdate(); // initiate the background check for System Update
211− }
212208 pageStack.next();
213209 }
214210 }
qml/Wizard/Pages/77-system-update.qmldeleted−156
@@ -1,156 +0,0 @@
1−/*
2− * Copyright (C) 2016 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.4
18−import QtQuick.Layouts 1.1
19−import Ubuntu.Components 1.3
20−import Ubuntu.SystemImage 0.1
21−import Wizard 0.1
22−import ".." as LocalComponents
23−
24−LocalComponents.Page {
25− id: systemUpdatePage
26− objectName: "systemUpdatePage"
27−
28− title: i18n.tr("Update Device")
29− forwardButtonSourceComponent: forwardButton
30−
31− skip: !SystemImage.updateDownloaded // skip the page when the system update is not ready to install
32−
33− Column {
34− id: column
35− anchors {
36− fill: content
37− leftMargin: systemUpdatePage.leftMargin
38− rightMargin: systemUpdatePage.rightMargin
39− topMargin: systemUpdatePage.customMargin
40− }
41− spacing: units.gu(3)
42− opacity: spinner.running ? 0.5 : 1
43− Behavior on opacity {
44− UbuntuNumberAnimation {}
45− }
46−
47− Label {
48− anchors.left: parent.left
49− anchors.right: parent.right
50− anchors.leftMargin: column.anchors.leftMargin == 0 ? staticMargin : 0
51− font.weight: Font.Light
52− color: textColor
53− wrapMode: Text.Wrap
54− fontSize: "small"
55− text: i18n.tr("There is a system update available and ready to install. Afterwards, the device will automatically restart.")
56− }
57−
58− GridLayout {
59− rows: 3
60− columns: 2
61− rowSpacing: units.gu(1)
62− columnSpacing: units.gu(2)
63−
64− Image {
65− Layout.rowSpan: 3
66− Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
67− sourceSize: Qt.size(units.gu(3), units.gu(3))
68− fillMode: Image.PreserveAspectFit
69− source: "image://theme/distributor-logo"
70− }
71−
72− Label {
73− color: textColor
74− font.weight: Font.Normal
75− fontSize: "small"
76− text: i18n.ctr("string identifying name of the update", "Ubuntu system")
77− }
78−
79− Label {
80− font.weight: Font.Light
81− fontSize: "small"
82− color: textColor
83− text: i18n.ctr("version of the system update", "Version %1").arg(SystemImage.availableVersion)
84− }
85−
86− Label {
87− font.weight: Font.Light
88− fontSize: "small"
89− color: textColor
90− text: SystemImage.updateSize
91− }
92− }
93−
94− Label {
95− anchors.left: parent.left
96− anchors.right: parent.right
97− anchors.leftMargin: column.anchors.leftMargin == 0 ? staticMargin : 0
98− font.weight: Font.Light
99− color: textColor
100− wrapMode: Text.Wrap
101− fontSize: "small"
102− text: i18n.tr("This could take a few minutes...")
103− }
104−
105− Rectangle {
106− anchors.left: parent.left
107− anchors.leftMargin: column.anchors.leftMargin == 0 ? staticMargin : 0
108− color: theme.palette.normal.foreground
109− radius: units.dp(4)
110− width: buttonLabel.paintedWidth + units.gu(3)
111− height: buttonLabel.paintedHeight + units.gu(1.8)
112−
113− Label {
114− id: buttonLabel
115− color: textColor
116− text: i18n.tr("Install and restart now")
117− font.weight: Font.Light
118− anchors.centerIn: parent
119− }
120−
121− AbstractButton {
122− id: button
123− objectName: "installButton"
124− anchors.fill: parent
125− onClicked: {
126− System.skipUntilFinishedPage();
127− SystemImage.applyUpdate();
128− }
129− }
130−
131− transformOrigin: Item.Top
132− scale: button.pressed ? 0.98 : 1.0
133− Behavior on scale {
134− ScaleAnimator {
135− duration: UbuntuAnimation.SnapDuration
136− easing.type: Easing.Linear
137− }
138− }
139− }
140− }
141−
142− ActivityIndicator {
143− id: spinner
144− anchors.centerIn: systemUpdatePage
145− running: SystemImage.updateApplying
146− visible: running
147− }
148−
149− Component {
150− id: forwardButton
151− LocalComponents.StackButton {
152− text: i18n.tr("Skip")
153− onClicked: pageStack.next()
154− }
155− }
156−}
tests/mocks/Ubuntu/CMakeLists.txt−1
@@ -1,6 +1,5 @@
11add_subdirectory(Connectivity)
22add_subdirectory(DownloadDaemonListener)
3−add_subdirectory(SystemImage)
43add_subdirectory(SystemSettings)
54add_subdirectory(Telephony)
65add_subdirectory(Thumbnailer)
tests/mocks/Ubuntu/SystemImage/CMakeLists.txtdeleted−10
@@ -1,10 +0,0 @@
1−set(MOCK_SYSTEMIMAGE_SOURCES
2− plugin.cpp
3− MockSystemImage.cpp
4−)
5−
6−add_library(MockSystemImage MODULE ${MOCK_SYSTEMIMAGE_SOURCES})
7−
8−qt5_use_modules(MockSystemImage Qml Quick Core)
9−
10−add_unity8_mock(Ubuntu.SystemImage 0.1 Ubuntu/SystemImage TARGETS MockSystemImage)
tests/mocks/Ubuntu/SystemImage/MockSystemImage.cppdeleted−50
@@ -1,50 +0,0 @@
1−/*
2− * Copyright (C) 2014-2016 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−#include <QDebug>
18−#include <QTimer>
19−
20−#include "MockSystemImage.h"
21−
22−MockSystemImage::MockSystemImage(QObject *parent)
23− : QObject(parent)
24−{
25−}
26−
27−void MockSystemImage::checkForUpdate()
28−{
29− qDebug() << "Doing a fake system update check";
30−}
31−
32−void MockSystemImage::applyUpdate()
33−{
34− qDebug() << "Applying a fake system update";
35− setUpdateApplying(true);
36− QTimer::singleShot(3000, [this] {setUpdateApplying(false);});
37−}
38−
39−void MockSystemImage::factoryReset()
40−{
41− Q_EMIT resettingDevice();
42−}
43−
44−void MockSystemImage::setUpdateApplying(bool status)
45−{
46− if (status != m_updateApplying) {
47− m_updateApplying = status;
48− Q_EMIT updateApplyingChanged();
49− }
50−}
tests/mocks/Ubuntu/SystemImage/MockSystemImage.hdeleted−56
@@ -1,56 +0,0 @@
1−/*
2− * Copyright (C) 2014-2016 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−#ifndef MOCK_SYSTEMIMAGE_H
18−#define MOCK_SYSTEMIMAGE_H
19−
20−#include <QObject>
21−
22−class MockSystemImage : public QObject
23−{
24− Q_OBJECT
25− Q_DISABLE_COPY(MockSystemImage)
26−
27− Q_PROPERTY(bool updateDownloaded READ updateDownloaded CONSTANT)
28− Q_PROPERTY(QString availableVersion READ availableVersion CONSTANT)
29− Q_PROPERTY(QString updateSize READ updateSize CONSTANT)
30− Q_PROPERTY(bool updateApplying READ updateApplying NOTIFY updateApplyingChanged)
31−
32−public:
33− explicit MockSystemImage(QObject *parent = nullptr);
34−
35− Q_INVOKABLE void checkForUpdate();
36− Q_INVOKABLE void applyUpdate();
37− Q_INVOKABLE void factoryReset();
38−
39− bool updateApplying() const { return m_updateApplying; }
40− // these are const only in mock
41− bool updateDownloaded() const { return true; }
42− QString availableVersion() const { return QStringLiteral("42"); }
43− QString updateSize() const { return QStringLiteral("4.2 MB"); }
44−
45−Q_SIGNALS:
46− void resettingDevice(); // only for mock
47− void updateApplyingChanged();
48−
49−private Q_SLOTS:
50− void setUpdateApplying(bool status);
51−
52−private:
53− bool m_updateApplying = false;
54−};
55−
56−#endif // MOCK_SYSTEMIMAGE_H
tests/mocks/Ubuntu/SystemImage/plugin.cppdeleted−34
@@ -1,34 +0,0 @@
1−/*
2− * Copyright (C) 2014 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−#include "plugin.h"
18−#include "MockSystemImage.h"
19−
20−#include <QtQml>
21−
22−static QObject *service_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
23−{
24− Q_UNUSED(engine)
25− Q_UNUSED(scriptEngine)
26− return new MockSystemImage();
27−}
28−
29−void BackendPlugin::registerTypes(const char *uri)
30−{
31− Q_ASSERT(uri == QLatin1String("Ubuntu.SystemImage"));
32−
33− qmlRegisterSingletonType<MockSystemImage>(uri, 0, 1, "SystemImage", service_provider);
34−}
tests/mocks/Ubuntu/SystemImage/plugin.hdeleted−31
@@ -1,31 +0,0 @@
1−/*
2− * Copyright (C) 2014 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−#ifndef MOCK_SYSTEMIMAGE_PLUGIN_H
18−#define MOCK_SYSTEMIMAGE_PLUGIN_H
19−
20−#include <QQmlExtensionPlugin>
21−
22−class BackendPlugin : public QQmlExtensionPlugin
23−{
24− Q_OBJECT
25− Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
26−
27−public:
28− void registerTypes(const char *uri) override;
29−};
30−
31−#endif // MOCK_SYSTEMIMAGE_PLUGIN_H
tests/mocks/Ubuntu/SystemImage/qmldirdeleted−3
@@ -1,3 +0,0 @@
1−module Ubuntu.SystemImage
2−plugin MockSystemImage
3−typeinfo SystemImage.qmltypes
tests/qmltests/Greeter/TestView.qml−5
@@ -46,7 +46,6 @@ Item {
4646 signal tease()
4747 signal emergencyCall()
4848
49− signal _showLastChanceCalled()
5049 signal _hideCalled()
5150 signal _showFakePasswordCalled()
5251 signal _notifyAuthenticationFailedCalled()
@@ -54,10 +53,6 @@ Item {
5453 signal _forceShowCalled()
5554 signal _tryToUnlockCalled(bool toTheRight)
5655
57− function showLastChance() {
58− _showLastChanceCalled();
59− }
60−
6156 function hide() {
6257 _hideCalled();
6358 _required = false;
tests/qmltests/Greeter/tst_Greeter.qml−7
@@ -94,12 +94,6 @@ Item {
9494 property Item greeter: loader.status === Loader.Ready ? loader.item : null
9595 property Item view
9696
97− SignalSpy {
98− id: viewShowLastChanceSpy
99− target: testCase.view
100− signalName: "_showLastChanceCalled"
101− }
102−
10397 SignalSpy {
10498 id: viewHideSpy
10599 target: testCase.view
@@ -147,7 +141,6 @@ Item {
147141 Biometryd.available = true;
148142 AccountsService.enableFingerprintIdentification = true;
149143 AccountsService.failedFingerprintLogins = 0;
150− viewShowLastChanceSpy.clear();
151144 viewHideSpy.clear();
152145 viewShowFakePasswordSpy.clear();
153146 viewAuthenticationFailedSpy.clear();
tests/qmltests/Wizard/tst_Wizard.qml−6
@@ -336,8 +336,6 @@ Item {
336336 // now finish up
337337 page = waitForPage("reportingPage");
338338 tap(findChild(page, "forwardButton"));
339− page = waitForPage("systemUpdatePage");
340− tap(findChild(page, "forwardButton"));
341339 page = waitForPage("finishedPage");
342340 waitUntilTransitionsEnd(page);
343341 tap(findChild(page, "finishButton"));
@@ -378,8 +376,6 @@ Item {
378376 // now finish up
379377 page = waitForPage("reportingPage");
380378 tap(findChild(page, "forwardButton"));
381− page = waitForPage("systemUpdatePage");
382− tap(findChild(page, "forwardButton"));
383379 page = waitForPage("finishedPage");
384380 waitUntilTransitionsEnd(page);
385381 tap(findChild(page, "finishButton"));
@@ -398,8 +394,6 @@ Item {
398394 tap(findChild(page, "forwardButton"));
399395 page = waitForPage("reportingPage");
400396 tap(findChild(page, "forwardButton"));
401− page = waitForPage("systemUpdatePage");
402− tap(findChild(page, "forwardButton"));
403397 page = waitForPage("finishedPage");
404398 waitUntilTransitionsEnd(page);
405399 tap(findChild(page, "finishButton"));
tests/qmltests/tst_ShellWithPin.qml−40
@@ -21,7 +21,6 @@ import AccountsService 0.1
2121import GSettings 1.0
2222import LightDMController 0.1
2323import LightDM.FullLightDM 0.1 as LightDM
24−import Ubuntu.SystemImage 0.1
2524import Ubuntu.Telephony 0.1 as Telephony
2625import Unity.Application 0.1
2726import Unity.Test 0.1 as UT
@@ -90,19 +89,6 @@ Item {
9089 text: "Show Greeter"
9190 onClicked: LightDM.Greeter.showGreeter()
9291 }
93−
94− Label {
95− text: "Max retries:"
96− color: "black"
97− }
98− TextField {
99− id: maxRetriesTextField
100− text: "-1"
101− onTextChanged: {
102− var greeter = testCase.findChild(shellLoader.item, "greeter");
103− greeter.maxFailedLogins = text;
104− }
105− }
10692 }
10793 }
10894 }
@@ -112,12 +98,6 @@ Item {
11298 signalName: "sessionStarted"
11399 }
114100
115− SignalSpy {
116− id: resetSpy
117− target: SystemImage
118− signalName: "resettingDevice"
119− }
120−
121101 Telephony.CallEntry {
122102 id: phoneCall
123103 phoneNumber: "+447812221111"
@@ -150,7 +130,6 @@ Item {
150130 sessionSpy.target = greeter;
151131 swipeAwayGreeter(true);
152132 greeter.failedLoginsDelayAttempts = -1;
153− greeter.maxFailedLogins = -1;
154133
155134 var launcher = findChild(shell, "launcher");
156135 var panel = findChild(launcher, "launcherPanel");
@@ -373,25 +352,6 @@ Item {
373352 tryCompare(delayedLockscreen, "delayMinutes", greeter.failedLoginsDelayMinutes);
374353 }
375354
376− function test_factoryReset() {
377− skip("Factory reset support is not finished")
378−
379− maxRetriesTextField.text = "3"
380− resetSpy.clear()
381−
382− enterPin("1111")
383− enterPin("1111")
384−
385− var dialog = findChild(root, "infoPopup")
386− var button = findChild(dialog, "infoPopupOkButton")
387− tap(button)
388− tryCompareFunction(function() {return findChild(root, "infoPopup", 0 /* timeout */)}, null)
389−
390− tryCompare(resetSpy, "count", 0)
391− enterPin("1111")
392− tryCompare(resetSpy, "count", 1)
393− }
394−
395355 function test_emergencyDialerLockOut() {
396356 // This is a theoretical attack on the lockscreen: Enter emergency
397357 // dialer mode on a phone, then plug into a larger screen,