Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <html> | |
| 2 <body> | |
| 3 <pre id='console'></pre> | |
| 4 <script type="text/javascript"> | |
| 5 function log(message) | |
| 6 { | |
| 7 document.getElementById('console').appendChild(document.createTextNode(messa ge + "\n")); | |
| 8 } | |
| 9 | |
| 10 if (window.testRunner) { | |
| 11 testRunner.dumpAsText(); | |
| 12 testRunner.waitUntilDone(); | |
| 13 } | |
| 14 | |
| 15 (function() { | |
| 16 var xhr = new XMLHttpRequest; | |
| 17 var error = false; | |
| 18 var errorCalled = false; | |
| 19 | |
| 20 function testSuccess() { | |
| 21 if (!error) | |
| 22 log("PASS: Timeout not overridden after preflight failure"); | |
| 23 } | |
| 24 | |
| 25 function performAssertions() { | |
| 26 if (!errorCalled) | |
| 27 log("FAIL: preflight failure not reported"); | |
| 28 else | |
| 29 testSuccess(); | |
| 30 if (window.testRunner) | |
| 31 testRunner.notifyDone(); | |
| 32 } | |
| 33 | |
| 34 xhr.onerror = function() { | |
| 35 xhr.timeout = 1; | |
| 36 errorCalled = true; | |
| 37 }; | |
| 38 | |
| 39 xhr.ontimeout = function() { | |
| 40 error = true; | |
| 41 log("FAIL: Timeout overridden after error"); | |
|
tyoshino (SeeGerritForStatus)
2014/07/08 11:36:00
what we want to check is setting timeout doesn't s
| |
| 42 } | |
| 43 | |
| 44 xhr.open("GET", "http://localhost:8000/xmlhttprequest/resources/access-contr ol-basic-denied.cgi"); | |
| 45 xhr.timeout = 100; | |
| 46 // This is going to fail because the cgi script is not prepared for an OPTIO NS request. | |
| 47 xhr.send(); | |
| 48 | |
| 49 setTimeout(performAssertions, 200); | |
| 50 })(); | |
| 51 </script> | |
| 52 </body> | |
| 53 </html> | |
| OLD | NEW |