78 }; |
78 }; |
79 Q_DECLARE_METATYPE(QVariant) |
79 Q_DECLARE_METATYPE(QVariant) |
80 |
80 |
81 void tst_QDBusPerformance::initTestCase() |
81 void tst_QDBusPerformance::initTestCase() |
82 { |
82 { |
|
83 QDBusConnection con = QDBusConnection::sessionBus(); |
|
84 QVERIFY(con.isConnected()); |
|
85 |
|
86 QDBusServiceWatcher watcher(serviceName, con, |
|
87 QDBusServiceWatcher::WatchForRegistration); |
|
88 connect(&watcher, SIGNAL(serviceRegistered(QString)), |
|
89 &QTestEventLoop::instance(), SLOT(exitLoop())); |
|
90 |
83 #ifdef Q_OS_WIN |
91 #ifdef Q_OS_WIN |
84 proc.start("server"); |
92 proc.start("server"); |
85 #else |
93 #else |
86 proc.start("./server/server"); |
94 proc.start("./server/server"); |
87 #endif |
95 #endif |
88 QVERIFY(proc.waitForStarted()); |
96 QVERIFY(proc.waitForStarted()); |
89 |
97 |
90 QDBusConnection con = QDBusConnection::sessionBus(); |
98 QTestEventLoop::instance().enterLoop(5); |
91 QVERIFY(con.isConnected()); |
|
92 |
|
93 connect(con.interface(), SIGNAL(serviceOwnerChanged(QString,QString,QString)), |
|
94 &QTestEventLoop::instance(), SLOT(exitLoop())); |
|
95 QTime timer; |
|
96 timer.start(); |
|
97 |
|
98 while (timer.elapsed() < 5000) { |
|
99 QTestEventLoop::instance().enterLoop(5); |
|
100 if (con.interface()->isServiceRegistered(serviceName)) |
|
101 break; |
|
102 } |
|
103 QVERIFY(con.interface()->isServiceRegistered(serviceName)); |
99 QVERIFY(con.interface()->isServiceRegistered(serviceName)); |
104 |
100 |
105 remote = new QDBusInterface(serviceName, "/", "com.trolltech.autotests.Performance", con, this); |
101 remote = new QDBusInterface(serviceName, "/", "com.trolltech.autotests.Performance", con, this); |
106 QVERIFY(remote->isValid()); |
102 QVERIFY(remote->isValid()); |
107 |
103 |