summaryrefslogtreecommitdiff
path: root/tests/auto/webchannel/tst_webchannel.h
diff options
context:
space:
mode:
authorMilian Wolff <milian.wolff@kdab.com>2014-03-21 16:15:47 +0100
committerPierre Rossi <pierre.rossi@gmail.com>2014-07-04 12:37:29 +0200
commit856dc072acb649be03e02ac64c81015d3f2675c2 (patch)
tree649985d553d6ea92360a66ca291af91c1114596e /tests/auto/webchannel/tst_webchannel.h
parent9f78e0985d2f4fdc2588be57c5f25afdd59c6365 (diff)
downloadqtwebchannel-856dc072acb649be03e02ac64c81015d3f2675c2.tar.gz
Refactor code to use QWebChannelAbstractTransport and QtWebSockets.
This is a quite big changeset, but necessary to get the roadmap implemented that was discussed at QtCS. With this patchset landed, the QWebChannel does not depend on QtWebKit anymore, not even for the tests. Rather, we will introduce the dependency in the other way (i.e. QtWebKit will optionally use QtWebChannel if available). For the pure Qt/C++ use-case, we ship a utility implementation of a QWebChannelAbstractTransport that uses a QWebSocket for the server-client communication. This way, we can get rid of the custom WebSocket implementation. The tests are refactored to run the qwebchannel.js code directly inside QML. Integration tests for QtWebKit/QtWebEngine as well as examples will be added to these repositories. Change-Id: Icc1c1c5918ec46e31d5070937c14c4ca25a3e2d6 Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
Diffstat (limited to 'tests/auto/webchannel/tst_webchannel.h')
-rw-r--r--tests/auto/webchannel/tst_webchannel.h19
1 files changed, 8 insertions, 11 deletions
diff --git a/tests/auto/webchannel/tst_webchannel.h b/tests/auto/webchannel/tst_webchannel.h
index 314fe99..4811a5c 100644
--- a/tests/auto/webchannel/tst_webchannel.h
+++ b/tests/auto/webchannel/tst_webchannel.h
@@ -44,24 +44,22 @@
#include <QObject>
#include <QVariant>
-#include <qwebchanneltransportinterface.h>
-class DummyTransport : public QObject, public QWebChannelTransportInterface
+#include <QtWebChannel/QWebChannelAbstractTransport>
+
+class DummyTransport : public QWebChannelAbstractTransport
{
Q_OBJECT
- Q_INTERFACES(QWebChannelTransportInterface)
public:
explicit DummyTransport(QObject *parent)
- : QObject(parent)
+ : QWebChannelAbstractTransport(parent)
{}
~DummyTransport() {};
- void sendMessage(const QString &/*message*/, int /*clientId*/) const Q_DECL_OVERRIDE
- {}
- void sendMessage(const QByteArray &/*message*/, int /*clientId*/) const Q_DECL_OVERRIDE
- {}
- void setMessageHandler(QWebChannelMessageHandlerInterface * /*handler*/) Q_DECL_OVERRIDE
- {}
+public slots:
+ void sendTextMessage(const QString &/*message*/) Q_DECL_OVERRIDE
+ {
+ }
};
class TestObject : public QObject
@@ -216,7 +214,6 @@ public:
Q_INVOKABLE void setVariant(const QVariant &v);
private slots:
- void testInitWebSocketTransport();
void testRegisterObjects();
void testInfoForObject();
void testInvokeMethodConversion();