aboutsummaryrefslogtreecommitdiff
path: root/tests/service-mocks/accounts-mock
diff options
context:
space:
mode:
Diffstat (limited to 'tests/service-mocks/accounts-mock')
-rw-r--r--tests/service-mocks/accounts-mock/AccountsDefs.h37
-rw-r--r--tests/service-mocks/accounts-mock/AccountsMock.cpp40
-rw-r--r--tests/service-mocks/accounts-mock/AccountsMock.h50
-rw-r--r--tests/service-mocks/accounts-mock/AccountsServiceSoundMock.cpp48
-rw-r--r--tests/service-mocks/accounts-mock/AccountsServiceSoundMock.h58
-rw-r--r--tests/service-mocks/accounts-mock/CMakeLists.txt42
-rw-r--r--tests/service-mocks/accounts-mock/com.ubuntu.AccountsService.Sound.Mock.xml6
-rw-r--r--tests/service-mocks/accounts-mock/main.cpp63
-rw-r--r--tests/service-mocks/accounts-mock/org.freedesktop.Accounts.Mock.xml15
9 files changed, 0 insertions, 359 deletions
diff --git a/tests/service-mocks/accounts-mock/AccountsDefs.h b/tests/service-mocks/accounts-mock/AccountsDefs.h
deleted file mode 100644
index 0e4f270..0000000
--- a/tests/service-mocks/accounts-mock/AccountsDefs.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2015 Canonical, Ltd.
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 3, as published
- * by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranties of
- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author: Xavi Garcia <xavi.garcia.mena@canonical.com>
- */
-#pragma once
-
-namespace ubuntu
-{
-
-namespace indicators
-{
-
-namespace testing
-{
- constexpr const char ACCOUNTS_SERVICE[] = "org.freedesktop.Accounts";
- constexpr const char USER_PATH[] = "/org/freedesktop/Accounts/UserTest";
- constexpr const char ACCOUNTS_PATH[] = "/org/freedesktop/Accounts";
- constexpr const char ACCOUNTS_SOUND_INTERFACE[] = "com.ubuntu.AccountsService.Sound";
-} // namespace testing
-
-} // namespace indicators
-
-} // namespace ubuntu
-
diff --git a/tests/service-mocks/accounts-mock/AccountsMock.cpp b/tests/service-mocks/accounts-mock/AccountsMock.cpp
deleted file mode 100644
index 5c92dc5..0000000
--- a/tests/service-mocks/accounts-mock/AccountsMock.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2015 Canonical, Ltd.
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 3, as published
- * by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranties of
- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author: Xavi Garcia <xavi.garcia.mena@canonical.com>
- */
-#include <QDebug>
-
-#include "AccountsMock.h"
-#include "AccountsDefs.h"
-
-using namespace ubuntu::indicators::testing;
-
-AccountsMock::AccountsMock(QObject* parent)
- : QObject(parent)
-{
-}
-
-AccountsMock::~AccountsMock() = default;
-
-QDBusObjectPath AccountsMock::FindUserByName(QString const & username) const
-{
- return QDBusObjectPath(USER_PATH);
-}
-
-QDBusObjectPath AccountsMock::FindUserById(int64_t uid) const
-{
- return QDBusObjectPath(USER_PATH);
-}
diff --git a/tests/service-mocks/accounts-mock/AccountsMock.h b/tests/service-mocks/accounts-mock/AccountsMock.h
deleted file mode 100644
index 72372e0..0000000
--- a/tests/service-mocks/accounts-mock/AccountsMock.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2015 Canonical, Ltd.
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 3, as published
- * by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranties of
- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author: Xavi Garcia <xavi.garcia.mena@canonical.com>
- */
-#pragma once
-
-#include <QDBusContext>
-#include <QDBusObjectPath>
-#include <QObject>
-
-namespace ubuntu
-{
-
-namespace indicators
-{
-
-namespace testing
-{
-
-class AccountsMock : public QObject, protected QDBusContext
-{
- Q_OBJECT
-
-public Q_SLOTS:
- QDBusObjectPath FindUserByName(QString const & username) const;
- QDBusObjectPath FindUserById(int64_t uid) const;
-
-public:
- AccountsMock(QObject* parent = 0);
- virtual ~AccountsMock();
-};
-
-} // namespace testing
-
-} // namespace indicators
-
-} // namespace ubuntu
diff --git a/tests/service-mocks/accounts-mock/AccountsServiceSoundMock.cpp b/tests/service-mocks/accounts-mock/AccountsServiceSoundMock.cpp
deleted file mode 100644
index 37de377..0000000
--- a/tests/service-mocks/accounts-mock/AccountsServiceSoundMock.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2015 Canonical, Ltd.
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 3, as published
- * by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranties of
- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author: Xavi Garcia <xavi.garcia.mena@canonical.com>
- */
-#include <QDebug>
-#include <QDBusMessage>
-#include <QDBusConnection>
-
-#include "AccountsServiceSoundMock.h"
-#include "AccountsDefs.h"
-
-using namespace ubuntu::indicators::testing;
-
-AccountsServiceSoundMock::AccountsServiceSoundMock(QObject* parent)
- : QObject(parent)
- , volume_(0.0)
-{
-}
-
-AccountsServiceSoundMock::~AccountsServiceSoundMock() = default;
-
-double AccountsServiceSoundMock::volume() const
-{
- return volume_;
-}
-
-void AccountsServiceSoundMock::setVolume(double volume)
-{
- volume_ = volume;
- notifier_.notifyPropertyChanged(QDBusConnection::systemBus(),
- ACCOUNTS_SOUND_INTERFACE,
- USER_PATH,
- "Volume",
- property("Volume"));
-}
diff --git a/tests/service-mocks/accounts-mock/AccountsServiceSoundMock.h b/tests/service-mocks/accounts-mock/AccountsServiceSoundMock.h
deleted file mode 100644
index bb3dbe8..0000000
--- a/tests/service-mocks/accounts-mock/AccountsServiceSoundMock.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2015 Canonical, Ltd.
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 3, as published
- * by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranties of
- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author: Xavi Garcia <xavi.garcia.mena@canonical.com>
- */
-#pragma once
-
-#include <QDBusContext>
-#include <QObject>
-
-#include "DBusPropertiesNotifier.h"
-
-namespace ubuntu
-{
-
-namespace indicators
-{
-
-namespace testing
-{
-
-class DBusPropertiesNotifier;
-
-class AccountsServiceSoundMock : public QObject, protected QDBusContext
-{
- Q_OBJECT
- Q_PROPERTY(double Volume READ volume WRITE setVolume)
-
-public Q_SLOTS:
- double volume() const;
- void setVolume(double volume);
-
-public:
- AccountsServiceSoundMock(QObject* parent = 0);
- virtual ~AccountsServiceSoundMock();
-
-private:
- double volume_;
- DBusPropertiesNotifier notifier_;
-};
-
-} // namespace testing
-
-} // namespace indicators
-
-} // namespace ubuntu
diff --git a/tests/service-mocks/accounts-mock/CMakeLists.txt b/tests/service-mocks/accounts-mock/CMakeLists.txt
deleted file mode 100644
index ad858bd..0000000
--- a/tests/service-mocks/accounts-mock/CMakeLists.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-find_package(Qt5DBus REQUIRED)
-include_directories(${Qt5DBus_INCLUDE_DIRS}
- "${CMAKE_SOURCE_DIR}/tests/service-mocks")
-
-add_definitions(-DQT_NO_KEYWORDS=1)
-
-set(dbusinterface_sound_xml "com.ubuntu.AccountsService.Sound.Mock.xml")
-set_source_files_properties(${dbusinterface_sound_xml} PROPERTIES
- CLASSNAME AccountsServiceSoundMockInterface)
-
-qt5_add_dbus_interface(interface_files ${dbusinterface_sound_xml} accountsservice_sound_interface)
-
-qt5_add_dbus_adaptor(adaptor_files
- com.ubuntu.AccountsService.Sound.Mock.xml
- AccountsServiceSoundMock.h
- ubuntu::indicators::testing::AccountsServiceSoundMock
- AccountsServiceSoundMockAdaptor)
-
-qt5_add_dbus_adaptor(adaptor_files
- ${CMAKE_SOURCE_DIR}/tests/dbus-types/org.freedesktop.Accounts.xml
- AccountsMock.h
- ubuntu::indicators::testing::AccountsMock
- AccountsMockAdaptor)
-
-add_executable(
- accounts-service-sound
- ${interface_files}
- ${adaptor_files}
- AccountsServiceSoundMock.cpp
- AccountsMock.cpp
- ${CMAKE_SOURCE_DIR}/tests/service-mocks/DBusPropertiesNotifier.cpp
- main.cpp
-)
-
-qt5_use_modules(
- accounts-service-sound
- Core
- DBus
-)
diff --git a/tests/service-mocks/accounts-mock/com.ubuntu.AccountsService.Sound.Mock.xml b/tests/service-mocks/accounts-mock/com.ubuntu.AccountsService.Sound.Mock.xml
deleted file mode 100644
index 859cd46..0000000
--- a/tests/service-mocks/accounts-mock/com.ubuntu.AccountsService.Sound.Mock.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
-<node>
- <interface name="com.ubuntu.AccountsService.Sound">
- <property name="Volume" type="d" access="readwrite"/>
- </interface>
-</node> \ No newline at end of file
diff --git a/tests/service-mocks/accounts-mock/main.cpp b/tests/service-mocks/accounts-mock/main.cpp
deleted file mode 100644
index d6cd1d3..0000000
--- a/tests/service-mocks/accounts-mock/main.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2015 Canonical, Ltd.
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 3, as published
- * by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranties of
- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author: Xavi Garcia <xavi.garcia.mena@canonical.com>
- */
-#include <QtDBus/QDBusConnection>
-#include <QtDBus/QDBusConnectionInterface>
-
-#include <string>
-
-#include "AccountsDefs.h"
-#include "AccountsServiceSoundMock.h"
-#include "AccountsServiceSoundMockAdaptor.h"
-#include "AccountsMock.h"
-#include "AccountsMockAdaptor.h"
-
-using namespace ubuntu::indicators::testing;
-
-int main(int argc, char *argv[])
-{
- QCoreApplication app(argc, argv);
- QDBusConnection connection = QDBusConnection::systemBus();
- if (!connection.interface()->isServiceRegistered(ACCOUNTS_SERVICE))
- {
- auto service = new AccountsServiceSoundMock(&app);
- new SoundAdaptor(service);
-
- auto accounts_service = new AccountsMock(&app);
- new AccountsAdaptor(accounts_service);
-
- if (!connection.registerService(ACCOUNTS_SERVICE))
- {
- qFatal("Could not register AccountsService Volume service.");
- }
-
- if (!connection.registerObject(USER_PATH, service))
- {
- qFatal("Could not register AccountsService Volume object.");
- }
-
- if (!connection.registerObject(ACCOUNTS_PATH, accounts_service))
- {
- qFatal("Could not register Accounts object.");
- }
- }
- else
- {
- qDebug() << "Service is already registered!.";
- }
- return app.exec();
-}
diff --git a/tests/service-mocks/accounts-mock/org.freedesktop.Accounts.Mock.xml b/tests/service-mocks/accounts-mock/org.freedesktop.Accounts.Mock.xml
deleted file mode 100644
index f977e7c..0000000
--- a/tests/service-mocks/accounts-mock/org.freedesktop.Accounts.Mock.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
-<node>
- <interface name="org.freedesktop.Accounts">
- <method name="FindUserByName">
- <arg direction="in" type="s" name="user" />
- <arg direction="out" type="o" name="path" />
- </method>
- <method name="FindUserById">
- <arg direction="in" type="x" name="uid" />
- <arg direction="out" type="o" name="path" />
- </method>
- <signal name="FindUserByIdInvoked">
- </signal>
- </interface>
-</node>