aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAurindam Jana <aurindam.jana@nokia.com>2012-04-24 09:23:13 +0200
committerQt by Nokia <qt-info@nokia.com>2012-04-25 14:26:42 +0200
commit87327515d70f5b66ce5f3f894f9b90ed649b200d (patch)
tree389f9536f6b6e7adacc8fd5b12726fdec5ea8b2a /tests
parent0d284ae2d62707e6c35c8d97ca73e974d35c4167 (diff)
Debugger: Change name and protocol of QDeclarativeObserverMode
Rename QDeclarativeObserverMode to QmlInspector service. This is because the current protocol has been changed completely and just a version change is misleading. Change-Id: I3b72f081f6ab77eac474dcef7a84375ef69e20dc Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp46
1 files changed, 25 insertions, 21 deletions
diff --git a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
index e033700aac..a105ff8de9 100644
--- a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
+++ b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
@@ -45,13 +45,10 @@
#include <QDebug>
#include <QThread>
-#include "../../../../../src/plugins/qmltooling/shared/qqmlinspectorprotocol.h"
#include "../shared/debugutil_p.h"
-using namespace QmlJSDebugger;
-
-#define PORT 13772
-#define STR_PORT "13772"
+#define PORT 3772
+#define STR_PORT "3772"
class QQmlInspectorClient : public QQmlDebugClient
{
@@ -59,22 +56,27 @@ class QQmlInspectorClient : public QQmlDebugClient
public:
QQmlInspectorClient(QQmlDebugConnection *connection)
- : QQmlDebugClient(QLatin1String("QDeclarativeObserverMode"), connection)
+ : QQmlDebugClient(QLatin1String("QmlInspector"), connection)
, m_showAppOnTop(false)
+ , m_requestId(0)
+ , m_requestResult(false)
{
}
- bool showAppOnTop() const { return m_showAppOnTop; }
void setShowAppOnTop(bool showOnTop);
signals:
- void showAppOnTopChanged();
+ void responseReceived();
protected:
void messageReceived(const QByteArray &message);
private:
bool m_showAppOnTop;
+ int m_requestId;
+
+public:
+ bool m_requestResult;
};
class tst_QQmlInspector : public QObject
@@ -110,7 +112,8 @@ void QQmlInspectorClient::setShowAppOnTop(bool showOnTop)
{
QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly);
- ds << InspectorProtocol::ShowAppOnTop << showOnTop;
+ ds << QByteArray("request") << m_requestId++
+ << QByteArray("showAppOnTop") << showOnTop;
sendMessage(message);
}
@@ -118,17 +121,18 @@ void QQmlInspectorClient::setShowAppOnTop(bool showOnTop)
void QQmlInspectorClient::messageReceived(const QByteArray &message)
{
QDataStream ds(message);
- InspectorProtocol::Message type;
+ QByteArray type;
ds >> type;
- switch (type) {
- case InspectorProtocol::ShowAppOnTop:
- ds >> m_showAppOnTop;
- emit showAppOnTopChanged();
- break;
- default:
- qDebug() << "Unhandled message " << (int)type;
+ if (type != QByteArray("response")) {
+ qDebug() << "Unhandled message of type" << type;
+ return;
}
+
+ m_requestResult = false;
+ int requestId;
+ ds >> requestId >> m_requestResult;
+ emit responseReceived();
}
void tst_QQmlInspector::initTestCase()
@@ -180,12 +184,12 @@ void tst_QQmlInspector::showAppOnTop()
QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
m_client->setShowAppOnTop(true);
- QVERIFY(QQmlDebugTest::waitForSignal(m_client, SIGNAL(showAppOnTopChanged())));
- QCOMPARE(m_client->showAppOnTop(), true);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_client, SIGNAL(responseReceived())));
+ QCOMPARE(m_client->m_requestResult, true);
m_client->setShowAppOnTop(false);
- QVERIFY(QQmlDebugTest::waitForSignal(m_client, SIGNAL(showAppOnTopChanged())));
- QCOMPARE(m_client->showAppOnTop(), false);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_client, SIGNAL(responseReceived())));
+ QCOMPARE(m_client->m_requestResult, true);
}
QTEST_MAIN(tst_QQmlInspector)