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

Side by Side 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: Add CORS preflight-failure test case Created 6 years, 5 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!doctype html>
2 <html>
3 <head>
4 <script src="../resources/testharness.js"></script>
5 <script src="../resources/testharnessreport.js"></script>
6 </head>
7 <body>
8 <p>Verify that a timeout ProgressEvent is dispatched and have the expected value s.</p>
9 <div id="logEvent"></div>
10 <script type="text/javascript">
11 var didTimeout = false;
12
13 function timeoutEvent(e) {
14 didTimeout = true;
15 }
16
17 function unexpectedProgressEvent(e) {
18 assert_unreached("'" + e.type + "' event should not be dispatched, expected 'timeout'");
19 }
20
21 var testOnTimeoutEvent = async_test("Check that 'timeout' events are delivered a nd have expected values.");
22 testOnTimeoutEvent.step(function () {
23 var xhr = new XMLHttpRequest();
24 xhr.ontimeout = testOnTimeoutEvent.step_func(timeoutEvent);
25 xhr.onabort = testOnTimeoutEvent.step_func(unexpectedProgressEvent);
26 xhr.onerror = testOnTimeoutEvent.step_func(unexpectedProgressEvent);
27 xhr.onload = testOnTimeoutEvent.step_func(unexpectedProgressEvent);
28 xhr.onloadend = testOnTimeoutEvent.step_func(function(e) {
29 assert_true(didTimeout, "'timeout' event should be dispatched after 400m s");
30 testOnTimeoutEvent.done();
31 });
32 xhr.timeout = 100000;
33 xhr.open("GET", "../resources/load-and-stall.php?name=test.mp4&stallAt=0&sta llFor=1000&mimeType=video/mp4", true);
34 xhr.send();
35 // Defer overriding timeout
36 setTimeout(function() {
37 xhr.timeout = 400;
38 }, 200);
39 });
40 </script>
41 </body>
42 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698