From a92c33174ed02e6545bd9f841cc920c06351b3fc Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Fri, 26 Jan 2018 11:07:14 +0100 Subject: [PATCH] Update vnc_playback.html to follow current API We had tried to update this along the way, but a bunch of things were overlooked. Should be fully functional again now. --- tests/playback-ui.js | 5 +++-- tests/playback.js | 12 ++++++------ tests/vnc_playback.html | 3 --- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/tests/playback-ui.js b/tests/playback-ui.js index 01ad241e..a23b7fae 100644 --- a/tests/playback-ui.js +++ b/tests/playback-ui.js @@ -115,7 +115,7 @@ IterationPlayer.prototype = { this._nextIteration(); }, - _disconnected: function (rfb, clean, frame) { + _disconnected: function (clean, frame) { if (!clean) { this._state = 'failed'; } @@ -123,6 +123,7 @@ IterationPlayer.prototype = { var evt = new Event('rfbdisconnected'); evt.clean = clean; evt.frame = frame; + evt.iteration = this._iteration; this.onrfbdisconnected(evt); }, @@ -149,7 +150,7 @@ function start() { message(`Iteration ${evt.number} took ${evt.duration}ms`); }; player.onrfbdisconnected = function (evt) { - if (evt.reason) { + if (!evt.clean) { message(`noVNC sent disconnected during iteration ${evt.iteration} frame ${evt.frame}`); } }; diff --git a/tests/playback.js b/tests/playback.js index c769e88f..961cac3c 100644 --- a/tests/playback.js +++ b/tests/playback.js @@ -76,7 +76,7 @@ export default function RecordingPlayer (frames, encoding, disconnected) { RecordingPlayer.prototype = { run: function (realtime, trafficManagement) { // initialize a new RFB - this._rfb = new RFB(document.getElementById('VNC_canvas'), 'wss://test'); + this._rfb = new RFB(document.getElementById('VNC_screen'), 'wss://test'); this._rfb.viewOnly = true; this._rfb.addEventListener("disconnect", this._handleDisconnect.bind(this)); @@ -99,9 +99,9 @@ RecordingPlayer.prototype = { this._rfb._sock.send = function (arr) {}; this._rfb._sock.close = function () {}; this._rfb._sock.flush = function () {}; - this._rfb._checkEvents = function () {}; - this._rfb._connect = function () { - this._sock.init('binary', 'ws'); + this._rfb._sock.open = function () { + this.init(); + this._eventHandlers.open(); }; }, @@ -187,8 +187,8 @@ RecordingPlayer.prototype = { } }, - _handleDisconnect(rfb, clean) { + _handleDisconnect(evt) { this._running = false; - this._disconnected(rfb, clean, this._frame_index); + this._disconnected(evt.detail.clean, this._frame_index); } }; diff --git a/tests/vnc_playback.html b/tests/vnc_playback.html index 66f40576..d5f94428 100644 --- a/tests/vnc_playback.html +++ b/tests/vnc_playback.html @@ -26,9 +26,6 @@
Loading
- - Canvas not supported. -