Chromium Code Reviews| Index: LayoutTests/http/tests/xmlhttprequest/ontimeout-event-override-after-preflight-failure.html |
| diff --git a/LayoutTests/http/tests/xmlhttprequest/ontimeout-event-override-after-preflight-failure.html b/LayoutTests/http/tests/xmlhttprequest/ontimeout-event-override-after-preflight-failure.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..30aae735af4f9f744753aac66e804d82a63b810a |
| --- /dev/null |
| +++ b/LayoutTests/http/tests/xmlhttprequest/ontimeout-event-override-after-preflight-failure.html |
| @@ -0,0 +1,53 @@ |
| +<html> |
| +<body> |
| +<pre id='console'></pre> |
| +<script type="text/javascript"> |
| +function log(message) |
| +{ |
| + document.getElementById('console').appendChild(document.createTextNode(message + "\n")); |
| +} |
| + |
| +if (window.testRunner) { |
| + testRunner.dumpAsText(); |
| + testRunner.waitUntilDone(); |
| +} |
| + |
| +(function() { |
| + var xhr = new XMLHttpRequest; |
| + var error = false; |
| + var errorCalled = false; |
| + |
| + function testSuccess() { |
| + if (!error) |
| + log("PASS: Timeout not overridden after preflight failure"); |
| + } |
| + |
| + function performAssertions() { |
| + if (!errorCalled) |
| + log("FAIL: preflight failure not reported"); |
| + else |
| + testSuccess(); |
| + if (window.testRunner) |
| + testRunner.notifyDone(); |
| + } |
| + |
| + xhr.onerror = function() { |
| + xhr.timeout = 1; |
| + errorCalled = true; |
| + }; |
| + |
| + xhr.ontimeout = function() { |
| + error = true; |
| + 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
|
| + } |
| + |
| + xhr.open("GET", "http://localhost:8000/xmlhttprequest/resources/access-control-basic-denied.cgi"); |
| + xhr.timeout = 100; |
| + // This is going to fail because the cgi script is not prepared for an OPTIONS request. |
| + xhr.send(); |
| + |
| + setTimeout(performAssertions, 200); |
| +})(); |
| +</script> |
| +</body> |
| +</html> |