Index: LayoutTests/http/tests/xmlhttprequest/ontimeout-event-override.html |
diff --git a/LayoutTests/http/tests/xmlhttprequest/ontimeout-event-override.html b/LayoutTests/http/tests/xmlhttprequest/ontimeout-event-override.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ef19b634990c2a78483c61e94e7f6037d0dec1af |
--- /dev/null |
+++ b/LayoutTests/http/tests/xmlhttprequest/ontimeout-event-override.html |
@@ -0,0 +1,42 @@ |
+<!doctype html> |
+<html> |
+<head> |
+<script src="../resources/testharness.js"></script> |
+<script src="../resources/testharnessreport.js"></script> |
+</head> |
+<body> |
+<p>Verify that a timeout ProgressEvent is dispatched and have the expected values.</p> |
+<div id="logEvent"></div> |
+<script type="text/javascript"> |
+var didTimeout = false; |
+ |
+function timeoutEvent(e) { |
+ didTimeout = true; |
+} |
+ |
+function unexpectedProgressEvent(e) { |
+ assert_unreached("'" + e.type + "' event should not be dispatched, expected 'timeout'"); |
+} |
+ |
+var testOnTimeoutEvent = async_test("Check that 'timeout' events are delivered and have expected values."); |
+testOnTimeoutEvent.step(function () { |
+ var xhr = new XMLHttpRequest(); |
+ xhr.ontimeout = testOnTimeoutEvent.step_func(timeoutEvent); |
+ xhr.onabort = testOnTimeoutEvent.step_func(unexpectedProgressEvent); |
+ xhr.onerror = testOnTimeoutEvent.step_func(unexpectedProgressEvent); |
+ xhr.onload = testOnTimeoutEvent.step_func(unexpectedProgressEvent); |
+ xhr.onloadend = testOnTimeoutEvent.step_func(function(e) { |
+ assert_true(didTimeout, "'timeout' event should be dispatched after 400ms"); |
+ testOnTimeoutEvent.done(); |
+ }); |
+ xhr.timeout = 100000; |
+ xhr.open("GET", "../resources/load-and-stall.php?name=test.mp4&stallAt=0&stallFor=1000&mimeType=video/mp4", true); |
+ xhr.send(); |
+ // Defer overriding timeout |
+ setTimeout(function() { |
+ xhr.timeout = 400; |
+ }, 200); |
+}); |
+</script> |
+</body> |
+</html> |