Index: LayoutTests/http/tests/xmlhttprequest/ontimeout-event.html |
diff --git a/LayoutTests/http/tests/xmlhttprequest/ontimeout-event.html b/LayoutTests/http/tests/xmlhttprequest/ontimeout-event.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..23d1e0474ac3999b5604fc2af961b31f098d1761 |
--- /dev/null |
+++ b/LayoutTests/http/tests/xmlhttprequest/ontimeout-event.html |
@@ -0,0 +1,46 @@ |
+<!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="log"></div> |
+<script type="text/javascript"> |
+ |
+function verifyProgressEvent(context, e) |
+{ |
+ assert_true(e.loaded >= 0, "Non-zero 'loaded' value for '" + context + "' event."); |
+ assert_true(!e.lengthComputable || e.total > 0, "Non-zero 'total' value for '" + context + "' event."); |
+} |
+ |
+function logProgressEvent(e) { |
+ results += " " + e.type; |
+} |
+ |
+function unexpectedProgressEvent(e) { |
+ assert_unreached("Unexpected request error"); |
+} |
+ |
+function timeoutHandler(e) |
+{ |
+ assert_true(e instanceof ProgressEvent); |
+ verifyProgressEvent("ontimeout", e); |
+ testOnTimeoutEvent.done(); |
+} |
+ |
+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(timeoutHandler); |
+ xhr.onabort = testOnTimeoutEvent.step_func(unexpectedProgressEvent); |
+ xhr.onerror = testOnTimeoutEvent.step_func(unexpectedProgressEvent); |
+ xhr.onload = testOnTimeoutEvent.step_func(unexpectedProgressEvent); |
+ xhr.timeout = 30; |
+ xhr.open("GET", "/resources/load-and-stall.php?name=../resources/test.mp4&stallAt=100&stallFor=10000&mimeType=video/mp4", true); |
+ xhr.send(); |
+}); |
+</script> |
+</body> |
+</html> |