<html>
<script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

function debug(str) {
   var li = document.createElement('li');
   li.appendChild(document.createTextNode(str));
   document.getElementById('console').appendChild(li);
}

function processStateChange() {
    if (req.readyState == 3) {
        debug(count++ + ' responseText: ' + req.responseText);
    } else if (req.readyState == 4) {
        if (window.testRunner)
            testRunner.notifyDone();
    }
}

function runTest() {
    count = 0;
    
    req = new XMLHttpRequest();
    
    req.open('GET', 'resources/small-chunks.cgi', true);
    req.onreadystatechange = processStateChange;
    req.send(null);
}
</script>
<body onload="runTest()">
<div>This tests that an open XMLHttpRequest connection will call onreadystatechange correctly when data is sent over an open connection.</div>
<ul id="console"></li>
</body>
</html>
