OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <title> Test case for bug 18655 </title> | |
4 </head> | 3 </head> |
5 <body> | 4 <body> |
6 <p> Test case for Bug <a href="https://bugs.webkit.org/show_bug.cgi?id=18655">18
655</a>: [XHR] OnProgress needs more test case </p> | 5 <p> This test verifies that file with content type does trigger onProgress event
when response type "blob" is specified. </p> |
7 <p> This test verify that file with content type does trigger onProgress event.
</p> | |
8 <p> You should see PASSED twice. </p> | 6 <p> You should see PASSED twice. </p> |
9 <body> | 7 <body> |
10 <p id="shouldBeCalled"> FAILED </p> | 8 <p id="shouldBeCalled"> FAILED </p> |
11 <p id="shouldNotBeCalled"> PASSED </p> | 9 <p id="shouldNotBeCalled"> PASSED </p> |
12 <script type="text/javascript"> | 10 <script type="text/javascript"> |
13 if (window.testRunner) { | 11 if (window.testRunner) { |
14 testRunner.dumpAsText(); | 12 testRunner.dumpAsText(); |
15 testRunner.waitUntilDone(); | 13 testRunner.waitUntilDone(); |
16 } | 14 } |
17 | 15 |
18 var count = 0; | 16 var count = 0; |
19 function checkDone() { | 17 function checkDone() { |
20 if (++count == 2 && window.testRunner) | 18 if (++count == 2 && window.testRunner) |
21 testRunner.notifyDone(); | 19 testRunner.notifyDone(); |
22 } | 20 } |
23 | 21 |
24 function onProgressPassed(e) { | 22 function onProgressPassed(e) { |
25 document.getElementById("shouldBeCalled").innerHTML = "PASSED"; | 23 document.getElementById("shouldBeCalled").innerHTML = "PASSED"; |
26 } | 24 } |
27 | 25 |
28 function onProgressFailed(e) { | 26 function onProgressFailed(e) { |
29 document.getElementById("shouldNotBeCalled").innerHTML = "FAILED"; | 27 document.getElementById("shouldNotBeCalled").innerHTML = "FAILED"; |
30 } | 28 } |
31 | 29 |
32 var req = new XMLHttpRequest(); | 30 var req = new XMLHttpRequest(); |
| 31 req.responseType = "blob"; |
33 req.onprogress = onProgressPassed; | 32 req.onprogress = onProgressPassed; |
34 req.onload = checkDone; | 33 req.onload = checkDone; |
35 // Test that onProgress is called on a normal file | 34 // Test that onProgress is called on a normal file |
36 req.open("GET", "resources/1251.html", true); | 35 req.open("GET", "resources/1251.html", true); |
37 req.send(null); | 36 req.send(null); |
38 | 37 |
39 // If content length is not given, it should not be called | 38 // If content length is not given, it should not be called |
40 var req2 = new XMLHttpRequest(); | 39 var req2 = new XMLHttpRequest(); |
| 40 req2.responseType = "blob"; |
41 req2.onprogress = onProgressFailed; | 41 req2.onprogress = onProgressFailed; |
42 req2.onload = checkDone; | 42 req2.onload = checkDone; |
43 req2.open("GET", "resources/noContentLength.asis", true); | 43 req2.open("GET", "resources/noContentLength.asis", true); |
44 req2.send(null); | 44 req2.send(null); |
45 | 45 |
46 </script> | 46 </script> |
47 </body> | 47 </body> |
48 </html> | 48 </html> |
OLD | NEW |