[Telepathy-commits] [telepathy-qt4/master] Add Test::processDBusQueue to finish processing outstanding messages on services
Olli Salli
olli.salli at collabora.co.uk
Thu Jan 29 10:57:04 PST 2009
---
tests/dbus/handles.cpp | 7 +------
tests/lib/test.cpp | 17 +++++++++++++++++
tests/lib/test.h | 9 +++++++++
3 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/tests/dbus/handles.cpp b/tests/dbus/handles.cpp
index 385bf96..e071707 100644
--- a/tests/dbus/handles.cpp
+++ b/tests/dbus/handles.cpp
@@ -197,12 +197,7 @@ void TestHandles::testRequestAndRelease()
// Start releasing the handles, RAII style, and complete the asynchronous process doing that
handles = ReferencedHandles();
mLoop->processEvents();
-
- // Make sure the service side has processed the release as well, by calling a method
- QVERIFY(connect(mConn->requestConnect(),
- SIGNAL(finished(Telepathy::Client::PendingOperation*)),
- SLOT(expectSuccessfulCall(Telepathy::Client::PendingOperation*))));
- QCOMPARE(mLoop->exec(), 0);
+ processDBusQueue(mConn);
// Check that the handles have been released
for (int i = 0; i < 3; i++) {
diff --git a/tests/lib/test.cpp b/tests/lib/test.cpp
index c00ad18..1a75bf2 100644
--- a/tests/lib/test.cpp
+++ b/tests/lib/test.cpp
@@ -7,6 +7,7 @@
#include <TelepathyQt4/Types>
#include <TelepathyQt4/Debug>
#include <TelepathyQt4/Client/DBus>
+#include <TelepathyQt4/Client/PendingVoidMethodCall>
using Telepathy::Client::PendingOperation;
@@ -65,4 +66,20 @@ void Test::expectSuccessfulCall(QDBusPendingCallWatcher *watcher)
mLoop->exit(0);
}
+void Test::processDBusQueue(Telepathy::Client::DBusProxy *proxy)
+{
+ using Telepathy::Client::DBus::PeerInterface;
+ using Telepathy::Client::PendingVoidMethodCall;
+
+ // Call method Ping on the D-Bus Peer interface
+ PeerInterface peer(proxy);
+ PendingVoidMethodCall *call = new PendingVoidMethodCall(this, peer.Ping());
+
+ // Wait for the reply to the Ping call
+ QVERIFY(connect(call,
+ SIGNAL(finished(Telepathy::Client::PendingOperation*)),
+ SLOT(expectSuccessfulCall(Telepathy::Client::PendingOperation*))));
+ QCOMPARE(mLoop->exec(), 0);
+}
+
#include "_gen/test.h.moc.hpp"
diff --git a/tests/lib/test.h b/tests/lib/test.h
index 06edefc..cfd55be 100644
--- a/tests/lib/test.h
+++ b/tests/lib/test.h
@@ -5,6 +5,14 @@
#include <TelepathyQt4/Client/PendingOperation>
#include <TelepathyQt4/Constants>
+namespace Telepathy
+{
+namespace Client
+{
+class DBusProxy;
+}
+}
+
class Test : public QObject
{
Q_OBJECT
@@ -16,6 +24,7 @@ public:
virtual ~Test();
QEventLoop *mLoop;
+ void processDBusQueue(Telepathy::Client::DBusProxy *proxy);
protected Q_SLOTS:
void expectSuccessfulCall(QDBusPendingCallWatcher*);
--
1.5.6.5
More information about the telepathy-commits
mailing list