Fix performance tests to follow new state API

This commit is contained in:
Pierre Ossman 2016-10-24 16:39:35 +02:00
parent ab251ad9ea
commit f9e26cdb32
3 changed files with 23 additions and 30 deletions

View File

@ -30,13 +30,15 @@ enable_test_mode = function () {
this._rfb_password = (password !== undefined) ? password : ""; this._rfb_password = (password !== undefined) ? password : "";
this._rfb_path = (path !== undefined) ? path : ""; this._rfb_path = (path !== undefined) ? path : "";
this._sock.init('binary', 'ws'); this._sock.init('binary', 'ws');
this._updateState('ProtocolVersion', "Starting VNC handshake"); this._rfb_connection_state = 'connecting';
this._rfb_init_state = 'ProtocolVersion';
}; };
}; };
next_iteration = function () { next_iteration = function () {
rfb = new RFB({'target': document.getElementById('VNC_canvas'), rfb = new RFB({'target': document.getElementById('VNC_canvas'),
'onUpdateState': updateState}); 'onDisconnected': disconnected,
'onNotification': notification});
enable_test_mode(); enable_test_mode();
// Missing in older recordings // Missing in older recordings

View File

@ -74,24 +74,19 @@
} }
} }
updateState = function (rfb, state, oldstate, mesg) { disconnected = function (rfb, reason) {
switch (state) { if (reason) {
case 'failed':
case 'fatal':
msg("noVNC sent '" + state + msg("noVNC sent '" + state +
"' state during pass " + pass + "' state during pass " + pass +
", iteration " + iteration + ", iteration " + iteration +
" frame " + frame_idx); " frame " + frame_idx);
test_state = 'failed'; test_state = 'failed';
break;
case 'loaded':
document.getElementById('startButton').disabled = false;
break;
} }
if (typeof mesg !== 'undefined') { }
notification = function (rfb, mesg, level, options) {
document.getElementById('VNC_status').innerHTML = mesg; document.getElementById('VNC_status').innerHTML = mesg;
} }
}
function do_test() { function do_test() {
document.getElementById('startButton').value = "Running"; document.getElementById('startButton').value = "Running";

View File

@ -68,19 +68,15 @@
message("Must specify data=FOO in query string."); message("Must specify data=FOO in query string.");
} }
updateState = function (rfb, state, oldstate, msg) { disconnected = function (rfb, reason) {
switch (state) { if (reason) {
case 'failed':
case 'fatal':
message("noVNC sent '" + state + "' state during iteration " + iteration + " frame " + frame_idx); message("noVNC sent '" + state + "' state during iteration " + iteration + " frame " + frame_idx);
test_state = 'failed'; test_state = 'failed';
break;
case 'loaded':
break;
} }
if (typeof msg !== 'undefined') {
document.getElementById('VNC_status').innerHTML = msg;
} }
notification = function (rfb, mesg, level, options) {
document.getElementById('VNC_status').innerHTML = mesg;
} }
function start() { function start() {