blob: 6aea627d661de6ff3b639ee0ef77830dc5065f36 [file] [log] [blame]
Philip Jägenstedtc053f402014-01-22 17:02:181<!DOCTYPE html>
2<html>
3<head>
4 <script src="/resources/testharness.js"></script>
James Grahama3d9d8e2014-06-09 13:06:485 <script src="/resources/testharnessreport.js"></script>
Philip Jägenstedtc053f402014-01-22 17:02:186 <title>XMLHttpRequest: The send() method: timeout is not 0 </title>
Ms2ger91fef142014-11-01 09:24:377 <link rel="help" href="https://xhr.spec.whatwg.org/#the-timeout-attribute" data-tested-assertations="following::ol[1]/li[2]" />
8 <link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following::dt[5] following::a[contains(@href,'#timeout-error')]/.." />
9 <link rel="help" href="https://xhr.spec.whatwg.org/#timeout-error" data-tested-assertations=".." />
10 <link rel="help" href="https://xhr.spec.whatwg.org/#request-error" data-tested-assertations="following::ol[1]/li[4] following::ol[1]/li[6] following::ol[1]/li[7]/ol/li[3] following::ol[1]/li[7]/ol/li[4] following::ol[1]/li[9] following::ol[1]/li[10]" />
Philip Jägenstedtc053f402014-01-22 17:02:1811</head>
12
13<body>
14 <div id="log"></div>
15
16 <script type="text/javascript">
17 var test = async_test();
18
19 test.step(function()
20 {
21 var xhr = new XMLHttpRequest();
Hallvord R. M. Steen04766af2015-03-15 16:53:0722 var expect = [4, "", "upload.timeout", "upload.loadend", "timeout", "loadend"];
Philip Jägenstedtc053f402014-01-22 17:02:1823 var actual = [];
24
Hallvord R. M. Steen9ca5bae2015-03-20 14:24:2425 xhr.onreadystatechange = test.step_func(function()
Philip Jägenstedtc053f402014-01-22 17:02:1826 {
Hallvord R. M. Steen7603c6c2015-03-14 09:41:1927 if (xhr.readyState == 4)
Philip Jägenstedtc053f402014-01-22 17:02:1828 {
Hallvord R. M. Steen7603c6c2015-03-14 09:41:1929 actual.push(xhr.readyState, xhr.response);
30 }
Hallvord R. M. Steen9ca5bae2015-03-20 14:24:2431 });
Philip Jägenstedtc053f402014-01-22 17:02:1832
Hallvord R. M. Steen9ca5bae2015-03-20 14:24:2433 xhr.onloadend = test.step_func_done(function(e)
Hallvord R. M. Steen7603c6c2015-03-14 09:41:1934 {
35 assert_equals(e.loaded, 0);
36 assert_equals(e.total, 0);
Hallvord R. M. Steen04766af2015-03-15 16:53:0737 actual.push(e.type);
38 assert_array_equals(actual, expect);
Hallvord R. M. Steen7603c6c2015-03-14 09:41:1939 });
James Grahama3d9d8e2014-06-09 13:06:4840
Hallvord R. M. Steen9ca5bae2015-03-20 14:24:2441 xhr.ontimeout = test.step_func(function(e)
Hallvord R. M. Steen7603c6c2015-03-14 09:41:1942 {
43 assert_equals(e.loaded, 0);
44 assert_equals(e.total, 0);
45 actual.push(e.type);
46 });
47
48
Hallvord R. M. Steen9ca5bae2015-03-20 14:24:2449 xhr.upload.onloadend = test.step_func(function(e)
Hallvord R. M. Steen7603c6c2015-03-14 09:41:1950 {
51 assert_equals(e.loaded, 0);
52 assert_equals(e.total, 0);
53 actual.push("upload." + e.type);
54 });
55
Hallvord R. M. Steen9ca5bae2015-03-20 14:24:2456 xhr.upload.ontimeout = test.step_func(function(e)
Hallvord R. M. Steen7603c6c2015-03-14 09:41:1957 {
58 assert_equals(e.loaded, 0);
59 assert_equals(e.total, 0);
60 actual.push("upload." + e.type);
61 });
62
Philip Jägenstedtc053f402014-01-22 17:02:1863
Philip Jägenstedtc053f402014-01-22 17:02:1864 var content = "";
65 for (var i = 0; i < 121026; i++)
66 {
67 content += "[" + i + "]";
68 }
James Grahama3d9d8e2014-06-09 13:06:4869
Philip Jägenstedtc053f402014-01-22 17:02:1870 xhr.open("POST", "./resources/trickle.py", true);
71 xhr.timeout = 1;
72 xhr.send(content);
73 });
74 </script>
75</body>
76</html>