summaryrefslogtreecommitdiff
path: root/tests/test-resource-engine/test-resource-engine.cpp
diff options
context:
space:
mode:
authorWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-02-02 15:51:41 +0200
committerWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-02-02 15:51:41 +0200
commit8bff62c335842b4c850cc09716e79c2f556247c7 (patch)
tree281dd5c4a92087f6308e3fb540aba62d7fd272c2 /tests/test-resource-engine/test-resource-engine.cpp
parentb7d622788b55d30d51ce30bd58634763fddf66fc (diff)
downloadlibresourceqt-8bff62c335842b4c850cc09716e79c2f556247c7.tar.gz
directory structure changes
Diffstat (limited to 'tests/test-resource-engine/test-resource-engine.cpp')
-rw-r--r--tests/test-resource-engine/test-resource-engine.cpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/tests/test-resource-engine/test-resource-engine.cpp b/tests/test-resource-engine/test-resource-engine.cpp
new file mode 100644
index 0000000..5c95224
--- /dev/null
+++ b/tests/test-resource-engine/test-resource-engine.cpp
@@ -0,0 +1,62 @@
+#include "test-resource-engine.h"
+#include <dbus/dbus.h>
+
+using namespace ResourcePolicy;
+
+TestResourceEngine::TestResourceEngine()
+ : resourceEngine(NULL), resourceSet(NULL),
+ audioPlayback(AudioPlaybackResource), videoPlayback(VideoPlaybackResource),
+ audioRecorder(AudioRecorderResource), videoRecorder(VideoRecorderResource)
+{
+ resourceSet = new ResourceSet("player", this);
+ resourceSet->addResource(audioPlayback);
+ resourceSet->addResource(videoPlayback);
+ resourceSet->addResource(audioRecorder);
+ resourceSet->addResource(videoRecorder);
+}
+
+TestResourceEngine::~TestResourceEngine()
+{
+}
+
+void TestResourceEngine::init()
+{
+ resourceEngine = new ResourceEngine(resourceSet);
+ bool initializeSucceeded = resourceEngine->initialize();
+ QVERIFY(!resourceEngine->isConnected());
+ QVERIFY(initializeSucceeded);
+}
+
+void TestResourceEngine::testConnect()
+{
+ bool connectIsSuccessful = resourceEngine->connect();
+ QVERIFY(connectIsSuccessful);
+}
+
+QTEST_MAIN(TestResourceEngine)
+
+////////////////////////////////////////////////////////////////
+
+resconn_t* resproto_init(resproto_role_t role, resproto_transport_t transport, ...)
+{
+ resconn_t *resourceConnection;
+ resconn_linkup_t callbackFunction;
+ DBusConnection *dbusConnection, systemBus;
+ va_list args;
+
+ va_start();
+ callbackFunction = va_arg(args, resconn_linkup_t);
+ dbusConnection = va_arg(args, DBusConnection *);
+ va_end();
+
+ systemBus = dbus_bus_get(DBUS_BUS_SYSTEM);
+
+ QVERIFY(callbackFunction != NULL);
+ QVERIFY(dbusConnection == systemBus);
+ QVERIFY(role == RESPROTO_ROLE_CLIENT);
+ QVERIFY(transport == RESPROTO_TRANSPORT_DBUS);
+
+ resourceConnection =(resconn_t *) calloc(1, sizeof(resconn_t));
+
+ return resourceConnection;
+}