OLD | NEW |
(Empty) | |
| 1 function get_test_results(id) { |
| 2 async_test(function(test) { |
| 3 var timer = window.setInterval(test.step_func(loop), 100); |
| 4 function loop() { |
| 5 var xhr = new XMLHttpRequest(); |
| 6 xhr.open('GET', 'stash.py?id=' + id); |
| 7 xhr.onreadystatechange = test.step_func(function() { |
| 8 assert_equals(xhr.status, 200); |
| 9 if (xhr.responseText) { |
| 10 assert_equals(xhr.responseText, "OK"); |
| 11 test.done(); |
| 12 window.clearTimeout(timer); |
| 13 } |
| 14 }); |
| 15 xhr.send(); |
| 16 } |
| 17 }); |
| 18 } |
| 19 |
| 20 function send_test_results(results) { |
| 21 var ok = true; |
| 22 for (result in results) { ok = ok && results[result]; } |
| 23 var xhr = new XMLHttpRequest(); |
| 24 xhr.open('POST', 'stash.py?id=' + results.id); |
| 25 xhr.send(ok ? "OK" : "FAIL: " + JSON.stringify(results)); |
| 26 } |
OLD | NEW |