summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Kiagiadakis <george.kiagiadakis@collabora.com>2012-04-10 22:15:37 +0300
committerGeorge Kiagiadakis <george.kiagiadakis@collabora.com>2012-04-10 22:15:37 +0300
commit5bf254fc18c499f578f7863c7a954bae4c99fddb (patch)
tree2c4d1d782f01263a7a86d5dd61815510872ab444
parent11feef12ef5138c703f9974bbd9a35c670cfcc76 (diff)
test-base-cm: Port to use TestThreadHelper
-rw-r--r--tests/dbus/base-cm.cpp37
1 files changed, 26 insertions, 11 deletions
diff --git a/tests/dbus/base-cm.cpp b/tests/dbus/base-cm.cpp
index 3cc35e0f..b4809db9 100644
--- a/tests/dbus/base-cm.cpp
+++ b/tests/dbus/base-cm.cpp
@@ -1,4 +1,5 @@
#include <tests/lib/test.h>
+#include <tests/lib/test-thread-helper.h>
#define TP_QT_ENABLE_LOWLEVEL_API
@@ -30,6 +31,9 @@ private Q_SLOTS:
void cleanup();
void cleanupTestCase();
+private:
+ static void testNoProtocolsCreateCM(BaseConnectionManagerPtr &cm);
+ static void testProtocolsCreateCM(BaseConnectionManagerPtr &cm);
};
void TestBaseCM::initTestCase()
@@ -42,6 +46,16 @@ void TestBaseCM::init()
initImpl();
}
+void TestBaseCM::testNoProtocolsCreateCM(BaseConnectionManagerPtr &cm)
+{
+ cm = BaseConnectionManager::create(QLatin1String("testcm"));
+ Tp::DBusError err;
+ QVERIFY(cm->registerObject(&err));
+ QVERIFY(!err.isValid());
+
+ QCOMPARE(cm->protocols().size(), 0);
+}
+
void TestBaseCM::testNoProtocols()
{
qDebug() << "Introspecting non-existing CM";
@@ -55,13 +69,8 @@ void TestBaseCM::testNoProtocols()
qDebug() << "Creating CM";
- BaseConnectionManagerPtr cm = BaseConnectionManager::create(
- QLatin1String("testcm"));
- Tp::DBusError err;
- QVERIFY(cm->registerObject(&err));
- QVERIFY(!err.isValid());
-
- QCOMPARE(cm->protocols().size(), 0);
+ TestThreadHelper<BaseConnectionManagerPtr> helper;
+ TEST_THREAD_HELPER_EXECUTE(&helper, &testNoProtocolsCreateCM);
qDebug() << "Introspecting new CM";
@@ -83,11 +92,9 @@ void TestBaseCM::testNoProtocols()
QCOMPARE(mLastError, TP_QT_ERROR_NOT_IMPLEMENTED);
}
-void TestBaseCM::testProtocols()
+void TestBaseCM::testProtocolsCreateCM(BaseConnectionManagerPtr &cm)
{
- qDebug() << "Creating CM";
-
- BaseConnectionManagerPtr cm = BaseConnectionManager::create(QLatin1String("testcm"));
+ cm = BaseConnectionManager::create(QLatin1String("testcm"));
BaseProtocolPtr protocol = BaseProtocol::create(QLatin1String("myprotocol"));
QVERIFY(!protocol.isNull());
@@ -121,6 +128,14 @@ void TestBaseCM::testProtocols()
props[TP_QT_IFACE_CONNECTION_MANAGER + QLatin1String(".Protocols")]);
QVERIFY(protocols.contains(QLatin1String("myprotocol")));
QVERIFY(!protocols.contains(QLatin1String("otherprotocol")));
+}
+
+void TestBaseCM::testProtocols()
+{
+ qDebug() << "Creating CM";
+
+ TestThreadHelper<BaseConnectionManagerPtr> helper;
+ TEST_THREAD_HELPER_EXECUTE(&helper, &testProtocolsCreateCM);
qDebug() << "Introspecting CM";