summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilian Wolff <milian.wolff@kdab.com>2013-11-06 17:57:51 +0100
committerMilian Wolff <milian.wolff@kdab.com>2013-11-20 13:26:13 +0100
commitd711e1cfb0e7a08c6c9c1309905a19b6addebb4d (patch)
treea9e79eb6db3c848ea365ac00a1b8ba8ba215a4fd
parent1ec37d6f216cae021990cfea6fb8034af499dbfc (diff)
downloadqtwebchannel-d711e1cfb0e7a08c6c9c1309905a19b6addebb4d.tar.gz
Add test for QWebChannel::ping-sending and pong-receival.
Change-Id: Ia449851bd0312435882c0238ab46f8316e38b72f Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
-rw-r--r--tests/qml/tst_webchannel.qml14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/qml/tst_webchannel.qml b/tests/qml/tst_webchannel.qml
index 36fa18c..10f885d 100644
--- a/tests/qml/tst_webchannel.qml
+++ b/tests/qml/tst_webchannel.qml
@@ -72,6 +72,12 @@ TestCase {
signalName: "onRawMessageReceived"
}
+ SignalSpy {
+ id: pongSpy
+ target: webChannel
+ signalName: "onPongReceived"
+ }
+
function loadUrl(url)
{
verify(webChannel.baseUrl != "", "webChannel.baseUrl is empty");
@@ -117,5 +123,13 @@ TestCase {
rawMessageSpy.wait(500);
compare(rawMessageSpy.signalArguments[1][0], "received:barfoo");
}
+
+ function test_ping()
+ {
+ loadUrl("respond.html");
+ webChannel.ping();
+ pongSpy.wait(500);
+ compare(pongSpy.count, 1);
+ }
//END TESTS
}