summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-11-10 14:44:00 +0100
committerThiago Macieira <thiago.macieira@nokia.com>2009-11-13 15:26:20 +0100
commit3c9985fc34fdaf51fc5e63567a2f5c03e1c2b6f6 (patch)
treecf3ff5f56b4cd04c40098f5738b1f9b7a588138e /tests
parent5d8fac963f67dfaa210469907a438871d6853416 (diff)
Autotest: use the new QDBusServiceWatcher class
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qdbusperformance/tst_qdbusperformance.cpp22
1 files changed, 9 insertions, 13 deletions
diff --git a/tests/auto/qdbusperformance/tst_qdbusperformance.cpp b/tests/auto/qdbusperformance/tst_qdbusperformance.cpp
index 7227d5d991..066b5b28f4 100644
--- a/tests/auto/qdbusperformance/tst_qdbusperformance.cpp
+++ b/tests/auto/qdbusperformance/tst_qdbusperformance.cpp
@@ -80,6 +80,14 @@ Q_DECLARE_METATYPE(QVariant)
void tst_QDBusPerformance::initTestCase()
{
+ QDBusConnection con = QDBusConnection::sessionBus();
+ QVERIFY(con.isConnected());
+
+ QDBusServiceWatcher watcher(serviceName, con,
+ QDBusServiceWatcher::WatchForRegistration);
+ connect(&watcher, SIGNAL(serviceRegistered(QString)),
+ &QTestEventLoop::instance(), SLOT(exitLoop()));
+
#ifdef Q_OS_WIN
proc.start("server");
#else
@@ -87,19 +95,7 @@ void tst_QDBusPerformance::initTestCase()
#endif
QVERIFY(proc.waitForStarted());
- QDBusConnection con = QDBusConnection::sessionBus();
- QVERIFY(con.isConnected());
-
- connect(con.interface(), SIGNAL(serviceOwnerChanged(QString,QString,QString)),
- &QTestEventLoop::instance(), SLOT(exitLoop()));
- QTime timer;
- timer.start();
-
- while (timer.elapsed() < 5000) {
- QTestEventLoop::instance().enterLoop(5);
- if (con.interface()->isServiceRegistered(serviceName))
- break;
- }
+ QTestEventLoop::instance().enterLoop(5);
QVERIFY(con.interface()->isServiceRegistered(serviceName));
remote = new QDBusInterface(serviceName, "/", "com.trolltech.autotests.Performance", con, this);