Debugger: Move server into it's own thread
[profile/ivi/qtdeclarative.git] / tests / auto / declarative / debugger / qdeclarativedebugclient / tst_qdeclarativedebugclient.cpp
index 82e2559..46a711a 100644 (file)
@@ -80,11 +80,16 @@ void tst_QDeclarativeDebugClient::initTestCase()
     QDeclarativeDebugTestClient client("tst_QDeclarativeDebugClient::handshake()", m_conn);
     QDeclarativeDebugTestService service("tst_QDeclarativeDebugClient::handshake()");
 
-    m_conn->connectToHost("127.0.0.1", PORT);
-
     QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Connection established");
-    bool ok = m_conn->waitForConnected();
-    QVERIFY(ok);
+    for (int i = 0; i < 50; ++i) {
+        // try for 5 seconds ...
+        m_conn->connectToHost("127.0.0.1", PORT);
+        if (m_conn->waitForConnected())
+            break;
+        QTest::qSleep(100);
+    }
+
+    QVERIFY(m_conn->isConnected());
 
     QTRY_VERIFY(QDeclarativeDebugService::hasDebuggingClient());
     QTRY_COMPARE(client.status(), QDeclarativeDebugClient::Enabled);