Skip to content

Commit

Permalink
Update vnc_playback.html to follow current API
Browse files Browse the repository at this point in the history
We had tried to update this along the way, but a bunch of things
were overlooked. Should be fully functional again now.
  • Loading branch information
CendioOssman committed Jan 26, 2018
1 parent 2a4e84a commit a92c331
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
5 changes: 3 additions & 2 deletions tests/playback-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,15 @@ IterationPlayer.prototype = {
this._nextIteration();
},

_disconnected: function (rfb, clean, frame) {
_disconnected: function (clean, frame) {
if (!clean) {
this._state = 'failed';
}

var evt = new Event('rfbdisconnected');
evt.clean = clean;
evt.frame = frame;
evt.iteration = this._iteration;

this.onrfbdisconnected(evt);
},
Expand All @@ -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}`);
}
};
Expand Down
12 changes: 6 additions & 6 deletions tests/playback.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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();
};
},

Expand Down Expand Up @@ -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);
}
};
3 changes: 0 additions & 3 deletions tests/vnc_playback.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
<td><div id="VNC_status">Loading</div></td>
</tr></table>
</div>
<canvas id="VNC_canvas" width="640px" height="20px">
Canvas not supported.
</canvas>
</div>

</body>
Expand Down

0 comments on commit a92c331

Please sign in to comment.