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