summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMilian Wolff <milian.wolff@kdab.com>2015-01-05 18:06:43 +0100
committerMilian Wolff <milian.wolff@kdab.com>2015-01-16 19:17:36 +0100
commit9d705911391c456813ce54a52f70aa2ccbc5b553 (patch)
tree9951fd051c82599ddfecdb95184faf72f0c0a62c /src
parent3ed29bca08dec484003cf573dd428b73627ffa81 (diff)
downloadqtwebchannel-9d705911391c456813ce54a52f70aa2ccbc5b553.tar.gz
Make the tests less flaky and don't send empty property updates.
The tests have been flaky on the CI. And indeed, running the tests locally under valgrind, which heavily influences the timings, I could reproduce failures on my local machine as well. The failure was due to multiple things, but most notably boils down to intermittend property update noficiations. To reduce that, the myFactory.lastObj property is propagated up. This way, any change to that property won't be propagated to the clients and influence the test. Furthermore, the failing tests are hardened by also checking the server messages, which is crucial to correct the flow of messages. Finally, a bug was found, where an empty property change could be broadcasted to all clients, when only a specific client's object got its properties changed. This is also fixed by this patch now. Change-Id: I2c7ba53253e2841db1a290872dacb097a7b984cf Reviewed-by: Bernd Lamecker <bernd.lamecker@basyskom.com> Reviewed-by: Risto Avila <risto.avila@theqtcompany.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/webchannel/qmetaobjectpublisher.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/webchannel/qmetaobjectpublisher.cpp b/src/webchannel/qmetaobjectpublisher.cpp
index a141035..c476011 100644
--- a/src/webchannel/qmetaobjectpublisher.cpp
+++ b/src/webchannel/qmetaobjectpublisher.cpp
@@ -315,16 +315,18 @@ void QMetaObjectPublisher::sendPendingPropertyUpdates()
pendingPropertyUpdates.clear();
QJsonObject message;
message[KEY_TYPE] = TypePropertyUpdate;
- message[KEY_DATA] = data; // data does not contain specific updates
- setClientIsIdle(false);
+ // data does not contain specific updates
+ if (!data.isEmpty()) {
+ setClientIsIdle(false);
- broadcastMessage(message);
+ message[KEY_DATA] = data;
+ broadcastMessage(message);
+ }
// send every property update which is not supposed to be broadcasted
const QHash<QWebChannelAbstractTransport*, QJsonArray>::const_iterator suend = specificUpdates.constEnd();
for (QHash<QWebChannelAbstractTransport*, QJsonArray>::const_iterator it = specificUpdates.constBegin(); it != suend; ++it) {
- message[KEY_TYPE] = TypePropertyUpdate;
message[KEY_DATA] = it.value();
it.key()->sendMessage(message);
}