diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2009-11-10 13:44:00 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2009-11-13 14:26:20 (GMT) |
commit | 3c9985fc34fdaf51fc5e63567a2f5c03e1c2b6f6 (patch) | |
tree | cf3ff5f56b4cd04c40098f5738b1f9b7a588138e /tests | |
parent | 5d8fac963f67dfaa210469907a438871d6853416 (diff) | |
download | Qt-3c9985fc34fdaf51fc5e63567a2f5c03e1c2b6f6.zip Qt-3c9985fc34fdaf51fc5e63567a2f5c03e1c2b6f6.tar.gz Qt-3c9985fc34fdaf51fc5e63567a2f5c03e1c2b6f6.tar.bz2 |
Autotest: use the new QDBusServiceWatcher class
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qdbusperformance/tst_qdbusperformance.cpp | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/tests/auto/qdbusperformance/tst_qdbusperformance.cpp b/tests/auto/qdbusperformance/tst_qdbusperformance.cpp index 7227d5d..066b5b2 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); |