Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Unified Diff: LayoutTests/http/tests/xmlhttprequest/ontimeout-event-override.html

Issue 273993002: Allow XHR timeout attribute to be overridden after send(), per spec (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase again Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/http/tests/xmlhttprequest/ontimeout-event-override-after-failure.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | LayoutTests/http/tests/xmlhttprequest/ontimeout-event-override-after-failure.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698