OLD | NEW |
| 1 <!doctype html> |
1 <html> | 2 <html> |
2 <head> | 3 <head> |
3 <title> Test case for bug 18655 </title> | 4 <title> Test case for bug 18655 </title> |
4 </head> | 5 </head> |
5 <body> | 6 <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> | 7 <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> |
7 <p> This test verify that addEventListener("progress", XXX, XXX) works as expect
ed. </p> | 8 <p> This test verify that addEventListener("progress", XXX, XXX) works as expect
ed. </p> |
8 <p> You should see PASSED 2 times. </p> | 9 <p> You should see PASSED 2 times. </p> |
9 <script type="text/javascript"> | 10 <script type="text/javascript"> |
10 var count = 1; | 11 var count = 1; |
11 | 12 |
12 function log(msg) | 13 function log(msg) |
13 { | 14 { |
14 document.body.appendChild(document.createTextNode(msg)); | 15 document.body.appendChild(document.createTextNode(msg)); |
15 document.body.appendChild(document.createElement("br")); | 16 document.body.appendChild(document.createElement("br")); |
16 } | 17 } |
17 | 18 |
18 function onProgress(e) { | 19 function onProgress(e) { |
| 20 if (this.seenProgress) |
| 21 return; |
| 22 |
| 23 this.seenProgress = true; |
19 log("PASSED (" + count + ")"); | 24 log("PASSED (" + count + ")"); |
20 if (++count > 2 && window.testRunner) | 25 if (++count > 2 && window.testRunner) |
21 testRunner.notifyDone(); | 26 testRunner.notifyDone(); |
22 } | 27 } |
23 | 28 |
24 if (window.testRunner) { | 29 if (window.testRunner) { |
25 testRunner.waitUntilDone(); | 30 testRunner.waitUntilDone(); |
26 testRunner.dumpAsText(); | 31 testRunner.dumpAsText(); |
27 } | 32 } |
28 | 33 |
29 // Test for capture phase | 34 // Test for capture phase |
30 var req3 = new XMLHttpRequest(); | 35 var req3 = new XMLHttpRequest(); |
31 req3.addEventListener("progress", onProgress, true); | 36 req3.addEventListener("progress", onProgress, true); |
| 37 req3.seenProgress = false; |
32 req3.open("GET", "resources/1251.html", true); | 38 req3.open("GET", "resources/1251.html", true); |
33 req3.send(null); | 39 req3.send(null); |
34 | 40 |
35 // Test for bubble phase | 41 // Test for bubble phase |
36 var req4 = new XMLHttpRequest(); | 42 var req4 = new XMLHttpRequest(); |
37 req4.addEventListener("progress", onProgress, false); | 43 req4.addEventListener("progress", onProgress, false); |
| 44 req4.seenProgress = false; |
38 req4.open("GET", "resources/1251.html", true); | 45 req4.open("GET", "resources/1251.html", true); |
39 req4.send(null); | 46 req4.send(null); |
40 | 47 |
41 </script> | 48 </script> |
42 </body> | 49 </body> |
43 </html> | 50 </html> |
OLD | NEW |