Commit fa8f14d5 authored by Joel Martin's avatar Joel Martin

Fix playback of recorded VNC.

- Update test mode calls to work with separate websock module.

- Pull in include/websock.js update 7f487fdbd from websockify.
parent 2270c7b5
...@@ -1512,12 +1512,10 @@ that.clipboardPasteFrom = function(text) { ...@@ -1512,12 +1512,10 @@ that.clipboardPasteFrom = function(text) {
//Util.Debug("<< clipboardPasteFrom"); //Util.Debug("<< clipboardPasteFrom");
}; };
// Override internal functions for testing
that.testMode = function(override_send) { that.testMode = function(override_send) {
// Overridable internal functions for testing
test_mode = true; test_mode = true;
// TODO figure out what to do here that.recv_message = ws.testMode(override_send);
ws.send = override_send;
that.recv_message = ws.recv_message; // Expose it
checkEvents = function () { /* Stub Out */ }; checkEvents = function () { /* Stub Out */ };
that.connect = function(host, port, password) { that.connect = function(host, port, password) {
......
...@@ -59,7 +59,9 @@ var api = {}, // Public API ...@@ -59,7 +59,9 @@ var api = {}, // Public API
'open' : function() {}, 'open' : function() {},
'close' : function() {}, 'close' : function() {},
'error' : function() {} 'error' : function() {}
}; },
test_mode = false;
// //
...@@ -253,9 +255,13 @@ function init() { ...@@ -253,9 +255,13 @@ function init() {
function open(uri) { function open(uri) {
init(); init();
websocket = new WebSocket(uri, 'base64'); if (test_mode) {
// TODO: future native binary support websocket = {};
//websocket = new WebSocket(uri, ['binary', 'base64']); } else {
websocket = new WebSocket(uri, 'base64');
// TODO: future native binary support
//websocket = new WebSocket(uri, ['binary', 'base64']);
}
websocket.onmessage = recv_message; websocket.onmessage = recv_message;
websocket.onopen = function() { websocket.onopen = function() {
...@@ -289,6 +295,15 @@ function close() { ...@@ -289,6 +295,15 @@ function close() {
} }
} }
// Override internal functions for testing
// Takes a send function, returns reference to recv function
function testMode(override_send) {
test_mode = true;
api.send = override_send;
api.close = function () {};
return recv_message;
}
function constructor() { function constructor() {
// Configuration settings // Configuration settings
api.maxBufferedAmount = 200; api.maxBufferedAmount = 200;
...@@ -319,6 +334,7 @@ function constructor() { ...@@ -319,6 +334,7 @@ function constructor() {
api.init = init; api.init = init;
api.open = open; api.open = open;
api.close = close; api.close = close;
api.testMode = testMode;
return api; return api;
} }
......
...@@ -95,6 +95,7 @@ ...@@ -95,6 +95,7 @@
mode = 'realtime'; mode = 'realtime';
} }
recv_message = rfb.testMode(send_array);
next_iteration(); next_iteration();
} }
...@@ -106,7 +107,9 @@ ...@@ -106,7 +107,9 @@
iter_time = parseInt(total_time / iterations, 10); iter_time = parseInt(total_time / iterations, 10);
message(iterations + " iterations took " + total_time + "ms, " + message(iterations + " iterations took " + total_time + "ms, " +
iter_time + "ms per iteration"); iter_time + "ms per iteration");
rfb.get_canvas().stop(); // Shut-off event interception // Shut-off event interception
rfb.get_mouse().ungrab();
rfb.get_keyboard().ungrab();
$D('startButton').disabled = false; $D('startButton').disabled = false;
$D('startButton').value = "Start"; $D('startButton').value = "Start";
...@@ -125,7 +128,6 @@ ...@@ -125,7 +128,6 @@
message("VNC_frame_data.length: " + VNC_frame_data.length); message("VNC_frame_data.length: " + VNC_frame_data.length);
rfb = new RFB({'target': $D('VNC_canvas'), rfb = new RFB({'target': $D('VNC_canvas'),
'updateState': updateState}); 'updateState': updateState});
rfb.testMode(send_array);
} }
} }
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment