chromium/third_party/blink/web_tests/http/tests/xmlhttprequest/web-apps/013.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html lang="en-Hixie">
 <head>
  <title>statusText</title>
 </head>
 <body>
  <p>FAIL: Script did not run.</p>
  <script type="text/javascript">
   if (window.testRunner) {
     testRunner.dumpAsText();
     testRunner.waitUntilDone();
   }

   var p = document.getElementsByTagName('p')[0];
   p.firstChild.data = 'FAIL: Test script did not finish.';
   if (!window.XMLHttpRequest)
     window.XMLHttpRequest = function () { return new ActiveXObject("Microsoft.XMLHTTP"); }
   var r = new XMLHttpRequest();
   r.open('GET', '013-test.cgi', true);
   p.firstChild.data = 'FAIL: Test script blocked on async request.';
   r.send(null);
   p.firstChild.data = 'FAIL: readyState did not change to 3 (Receiving). (Wait a few seconds, just in case it does.)';
   setTimeout(function () {
     r.onreadystatechange = function() {
       if (r.readyState == 3) {
         p.firstChild.data = 'FAIL: Exceptions were probably raised while accessing status or statusText.';
         setTimeout(function() {
           var c1 = r.status;
           var c2 = r.statusText;
           p.firstChild.data = c1 == 400 && c2 == 'Good work' ? 'PASS' : 'FAIL: Status at readyState 3 was: ' + c1 + ', "' + c2 + '"';

           if (window.testRunner)
             testRunner.notifyDone();
         }, 500);
       }
     }
   }, 1000);
  </script>
 </body>
</html>