diff options
author | Kai Koehne <kai.koehne@nokia.com> | 2011-08-24 13:51:07 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-11-22 13:45:27 +0100 |
commit | 43e20d57011bbddd3beec773f6a8efb1269a8ead (patch) | |
tree | e07e5b858582e6d689a188073a82249687be4c0e /tests | |
parent | 774eebf9978ac3bf68b124a9e88729cd21068433 (diff) |
Debugger: Move server into it's own thread
So far the debugger infrastructure was running in the GUI thread,
which required e.g. nested event loops to implement blocking behavior.
The server and networking code are now running in their own thread,
while the services are still running in the main thread.
Because v8 isn't thread safe, we're adding two new JSEngines + isolates
to qv8debugservice: One to decode JSON messages in the debugger thread,
and one in the GUI thread.
Change-Id: I746f5e203968f7bcc510fb66118c88ef0fd0cd14
Reviewed-by: Christiaan Janssen <christiaan.janssen@nokia.com>
Diffstat (limited to 'tests')
2 files changed, 23 insertions, 9 deletions
diff --git a/tests/auto/declarative/debugger/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp b/tests/auto/declarative/debugger/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp index 82e25598e9..46a711ae78 100644 --- a/tests/auto/declarative/debugger/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp +++ b/tests/auto/declarative/debugger/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp @@ -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); diff --git a/tests/auto/declarative/debugger/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp b/tests/auto/declarative/debugger/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp index 8f829a6468..6063c1fdcb 100644 --- a/tests/auto/declarative/debugger/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp +++ b/tests/auto/declarative/debugger/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp @@ -53,6 +53,8 @@ #include "../../shared/util.h" #include "../shared/debugutil_p.h" +#define PORT 13769 +#define STR_PORT "13769" class tst_QDeclarativeDebugService : public QObject { @@ -73,15 +75,22 @@ private slots: void tst_QDeclarativeDebugService::initTestCase() { - QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Waiting for connection on port 13769..."); + const QString waitingMsg = QString("QDeclarativeDebugServer: Waiting for connection on port %1...").arg(PORT); + QTest::ignoreMessage(QtWarningMsg, waitingMsg.toAscii().constData()); new QDeclarativeEngine(this); m_conn = new QDeclarativeDebugConnection(this); - m_conn->connectToHost("127.0.0.1", 13769); + 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()); } @@ -187,7 +196,7 @@ int main(int argc, char *argv[]) char **_argv = new char*[_argc]; for (int i = 0; i < argc; ++i) _argv[i] = argv[i]; - char arg[] = "-qmljsdebugger=port:13769"; + char arg[] = "-qmljsdebugger=port:" STR_PORT; _argv[_argc - 1] = arg; QGuiApplication app(_argc, _argv); |