aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarja Hassinen <ext-marja.2.hassinen@nokia.com>2009-10-27 14:00:41 +0200
committerMarja Hassinen <ext-marja.2.hassinen@nokia.com>2009-10-27 14:00:41 +0200
commit12916d9457d0ff1dc2fa47fbb04f3dd699ee659d (patch)
tree89624b8e89490c5d614a53f0fa5cc4a48fd0d0f2
parent9c2d4fe23f42d50d5a1efc2bd1efdd606afc359b (diff)
libcontextprovider, protocol change: Updating unit tests.
-rw-r--r--libcontextprovider/unit-tests/service/property.h52
-rw-r--r--libcontextprovider/unit-tests/service/servicebackend.h8
-rw-r--r--libcontextprovider/unit-tests/service/serviceunittest.cpp52
3 files changed, 8 insertions, 104 deletions
diff --git a/libcontextprovider/unit-tests/service/property.h b/libcontextprovider/unit-tests/service/property.h
deleted file mode 100644
index 5cb8a6dd..00000000
--- a/libcontextprovider/unit-tests/service/property.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2009 Nokia Corporation.
- *
- * Contact: Marius Vollmer <marius.vollmer@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#ifndef PROPERTY_H
-#define PROPERTY_H
-
-// This is a mock implementation
-
-#include <QObject>
-
-namespace ContextProvider {
-
-class Manager;
-class Service;
-
-class Property : public QObject
-{
- Q_OBJECT
-public:
- Property(QString key, QObject* parent = 0);
- Property(Service &service, QString key, QObject* parent = 0);
-
- void setManager(Manager *);
-
- QString key();
-
-signals:
- void firstSubscriberAppeared(const QString &key);
- void lastSubscriberDisappeared(const QString &key);
-};
-
-} // end namespace
-
-#endif
diff --git a/libcontextprovider/unit-tests/service/servicebackend.h b/libcontextprovider/unit-tests/service/servicebackend.h
index d158d5be..8233abe4 100644
--- a/libcontextprovider/unit-tests/service/servicebackend.h
+++ b/libcontextprovider/unit-tests/service/servicebackend.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Nokia Corporation.
+ * Copyright (C) 2009 Nokia Corporation.
*
* Contact: Marius Vollmer <marius.vollmer@nokia.com>
*
@@ -24,14 +24,11 @@
#include <QObject>
#include <QString>
-#include <QStringList>
#include <QDBusConnection>
-#include <QHash>
#include <QVariant>
namespace ContextProvider {
-class Manager;
class ServiceBackend : QObject
{
@@ -39,7 +36,6 @@ class ServiceBackend : QObject
public:
explicit ServiceBackend(QDBusConnection connection, const QString &busName = "");
- Manager *manager();
static ServiceBackend *defaultServiceBackend;
void setAsDefault();
@@ -52,6 +48,8 @@ public:
static ServiceBackend* instance(QDBusConnection connection);
static ServiceBackend* instance(QDBusConnection::BusType busType,
const QString &busName, bool autoStart = true);
+
+ void setValue(const QString &key, const QVariant &val);
QDBusConnection connection;
};
diff --git a/libcontextprovider/unit-tests/service/serviceunittest.cpp b/libcontextprovider/unit-tests/service/serviceunittest.cpp
index 3247e20b..7659367f 100644
--- a/libcontextprovider/unit-tests/service/serviceunittest.cpp
+++ b/libcontextprovider/unit-tests/service/serviceunittest.cpp
@@ -19,14 +19,13 @@
*
*/
+#include "servicebackend.h" // mocked
+
+#include "service.h" // to be tested
+
#include <QtTest/QtTest>
#include <QtCore>
#include <stdlib.h>
-#include "manager.h"
-#include "service.h"
-#include "servicebackend.h"
-#include "property.h"
-#include "manageradaptor.h"
using namespace ContextProvider;
@@ -39,7 +38,6 @@ int lastState = STATE_UNDEFINED;
QString *lastKey = NULL;
QVariant *lastValue = NULL;
-Manager *lastManager = NULL;
QDBusConnection *lastConnection = NULL;
/* Mocked ServiceBackend */
@@ -52,11 +50,6 @@ ServiceBackend::ServiceBackend(QDBusConnection connection, const QString &busNam
lastState = STATE_UNDEFINED;
}
-Manager* ServiceBackend::manager()
-{
- return new Manager();
-}
-
void ServiceBackend::setAsDefault()
{
defaultServiceBackend = this;
@@ -104,46 +97,12 @@ ServiceBackend* ServiceBackend::instance(QDBusConnection::BusType busType,
return r;
}
-/* Mocked Manager */
-
-Manager::Manager()
-{
-}
-
-void Manager::addKey(const QString &key)
-{
-}
-
-void Manager::setKeyValue(const QString &key, const QVariant &v)
+void ServiceBackend::setValue(const QString &key, const QVariant &v)
{
lastValue = new QVariant(v);
lastKey = new QString(key);
}
-QVariant Manager::getKeyValue(const QString &key)
-{
- return QVariant();
-}
-
-/* Mocked manager adaptor */
-
-ManagerAdaptor::ManagerAdaptor(Manager *m, QDBusConnection *c)
-{
- lastManager = m;
- lastConnection = c;
-}
-
-/* Mocked Property */
-
-void Property::setManager(Manager *)
-{
-}
-
-QString Property::key()
-{
- return "XXX";
-}
-
/* Service unit test */
class ServiceUnitTest : public QObject
@@ -178,7 +137,6 @@ void ServiceUnitTest::cleanup()
lastKey = NULL;
lastValue = NULL;
- lastManager = NULL;
lastConnection = NULL;
}