diff options
author | Milian Wolff <milian.wolff@kdab.com> | 2014-03-21 16:15:47 +0100 |
---|---|---|
committer | Pierre Rossi <pierre.rossi@gmail.com> | 2014-07-04 12:37:29 +0200 |
commit | 856dc072acb649be03e02ac64c81015d3f2675c2 (patch) | |
tree | 649985d553d6ea92360a66ca291af91c1114596e /tests/auto/qml/tst_bench.qml | |
parent | 9f78e0985d2f4fdc2588be57c5f25afdd59c6365 (diff) | |
download | qtwebchannel-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/qml/tst_bench.qml')
-rw-r--r-- | tests/auto/qml/tst_bench.qml | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/tests/auto/qml/tst_bench.qml b/tests/auto/qml/tst_bench.qml index 056dda9..833720e 100644 --- a/tests/auto/qml/tst_bench.qml +++ b/tests/auto/qml/tst_bench.qml @@ -40,13 +40,24 @@ ****************************************************************************/ import QtQuick 2.0 +import QtTest 1.0 import QtWebChannel 1.0 +import "qrc:///qwebchannel/qwebchannel.js" as Client -WebChannelTest { +TestCase { name: "Bench" id: test + Client { + id: client + } + + WebChannel { + id: webChannel + transports: [client.serverTransport] + } + Component { id: component QtObject { @@ -96,28 +107,15 @@ WebChannelTest { webChannel.registerObjects(objects); } - function benchmark_init_baseline() - { - loadUrl("bench_init.html"); - } - - function benchmark_init_webview() + function cleanup() { - useWebViewTransport = true; - loadUrl("bench_init.html"); - // init - awaitMessage(); - // idle - awaitMessage(); + client.cleanup(); } - function benchmark_init_websocket() + function benchmark_init() { - useWebViewTransport = false; - loadUrl("bench_init.html"); - // init - awaitMessage(); - // idle - awaitMessage(); + var channel = client.createChannel(function() {}); + client.awaitInit(); + client.awaitIdle(); } } |