Log user agent for reference tests.

This commit is contained in:
Brendan Dahl 2012-12-04 10:28:25 -08:00
parent bcbc21a51c
commit 50e21bb103
2 changed files with 25 additions and 5 deletions

View File

@ -50,6 +50,7 @@ function load() {
canvas.mozOpaque = true; canvas.mozOpaque = true;
stdout = document.getElementById('stdout'); stdout = document.getElementById('stdout');
info('User Agent: ' + navigator.userAgent);
log('load...\n'); log('load...\n');
log('Harness thinks this browser is "' + browser + '" with path "' + log('Harness thinks this browser is "' + browser + '" with path "' +
@ -343,20 +344,34 @@ function sendTaskResult(snapshot, task, failure, result) {
}); });
} }
send('/submit_task_results', result);
}
function send(url, message) {
var r = new XMLHttpRequest(); var r = new XMLHttpRequest();
// (The POST URI is ignored atm.) // (The POST URI is ignored atm.)
r.open('POST', '/submit_task_results', true); r.open('POST', url, true);
r.setRequestHeader('Content-Type', 'application/json'); r.setRequestHeader('Content-Type', 'application/json');
r.onreadystatechange = function sendTaskResultOnreadystatechange(e) { r.onreadystatechange = function sendTaskResultOnreadystatechange(e) {
if (r.readyState == 4) { if (r.readyState == 4) {
inFlightRequests--; inFlightRequests--;
// Retry until successful // Retry until successful
if (r.status !== 200) if (r.status !== 200) {
sendTaskResult(null, null, null, result); setTimeout(function() {
send(url, message);
});
}
} }
}; };
document.getElementById('inFlightCount').innerHTML = inFlightRequests++; document.getElementById('inFlightCount').innerHTML = inFlightRequests++;
r.send(result); r.send(message);
}
function info(message) {
send('/info', JSON.stringify({
browser: browser,
message: message
}));
} }
function clear(ctx) { function clear(ctx) {

View File

@ -314,8 +314,13 @@ class PDFTestHandler(TestHandlerBase):
return return
result = json.loads(self.rfile.read(numBytes)) result = json.loads(self.rfile.read(numBytes))
browser, id, failure, round, page, snapshot = result['browser'], result['id'], result['failure'], result['round'], result['page'], result['snapshot'] browser = result['browser']
State.lastPost[browser] = int(time.time()) State.lastPost[browser] = int(time.time())
if url.path == "/info":
print result['message']
return
id, failure, round, page, snapshot = result['id'], result['failure'], result['round'], result['page'], result['snapshot']
taskResults = State.taskResults[browser][id] taskResults = State.taskResults[browser][id]
taskResults[round].append(Result(snapshot, failure, page)) taskResults[round].append(Result(snapshot, failure, page))