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