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

View File

@ -68,21 +68,17 @@
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': message("noVNC sent '" + state + "' state during iteration " + iteration + " frame " + frame_idx);
case 'fatal': test_state = 'failed';
message("noVNC sent '" + state + "' state during iteration " + iteration + " frame " + frame_idx);
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() {
document.getElementById('startButton').value = "Running"; document.getElementById('startButton').value = "Running";
document.getElementById('startButton').disabled = true; document.getElementById('startButton').disabled = true;