summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/iframe_harness.js
blob: 2b43c54e2f2e885b8d41e9d39b90be2fe8e1f8c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
function get_test_results(id) {
    async_test(function(test) {
        test.step_timeout(loop, 100);
        function loop() {
            var xhr = new XMLHttpRequest();
            xhr.open('GET', 'stash.py?id=' + id);
            xhr.onload = test.step_func(function() {
                assert_equals(xhr.status, 200);
                if (xhr.responseText) {
                    assert_equals(xhr.responseText, "OK");
                    test.done();
                } else {
                    test.step_timeout(loop, 100);
                }
            });
            xhr.send();
        }
    });
}

function send_test_results(results) {
    var ok = true;
    for (result in results) { ok = ok && results[result]; }
    var xhr = new XMLHttpRequest();
    xhr.open('POST', 'stash.py?id=' + results.id);
    xhr.send(ok ? "OK" : "FAIL: " + JSON.stringify(results));
}