4 <script src=
"../resources/testharness.js"></script>
5 <script src=
"../resources/testharnessreport.js"></script>
8 <p>Verify that a timeout ProgressEvent is dispatched and have the expected values.
</p>
9 <div id=
"logEvent"></div>
10 <script type=
"text/javascript">
11 var didTimeout
= false;
13 function timeoutEvent(e
) {
17 function unexpectedProgressEvent(e
) {
18 assert_unreached("'" + e
.type
+ "' event should not be dispatched, expected 'timeout'");
21 var testOnTimeoutEvent
= async_test("Check that 'timeout' events are delivered and 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 400ms");
30 testOnTimeoutEvent
.done();
33 xhr
.open("GET", "../resources/load-and-stall.php?name=test.mp4&stallAt=0&stallFor=1000&mimeType=video/mp4", true);
35 // Defer overriding timeout
36 setTimeout(function() {