Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <script> | |
| 3 if (window.testRunner) { | |
| 4 testRunner.waitUntilDone(); | |
| 5 testRunner.dumpAsText(); | |
| 6 } | |
| 7 img = new Image(); | |
| 8 var onloadCounter = 0; | |
| 9 var testImage = 'resources/green.jpg'; | |
| 10 var resetImage = 'resources/green.jpg'; | |
| 11 img.onload = function(){ | |
| 12 onloadCounter++; | |
| 13 document.getElementById('console').innerHTML += "Image onload event fire d for " + img.src.substring(img.src.lastIndexOf('/') + 1) + "<br>"; | |
| 14 if (onloadCounter == 2) { | |
| 15 document.getElementById('result').textContent = "PASS"; | |
| 16 if (window.testRunner) | |
| 17 testRunner.notifyDone(); | |
| 18 return; | |
| 19 } | |
| 20 if (onloadCounter == 1) { | |
| 21 setTimeout("img.src='" + resetImage + "';img.src = '" + testImage + "';", 0); | |
|
esprehn
2015/03/31 21:53:21
use functions instead.
setTimeout(function() {
| |
| 22 return; | |
| 23 } | |
| 24 document.getElementById('result').textContent = "FAIL"; | |
| 25 }; | |
| 26 setTimeout("img.src='" + resetImage + "';img.src = '" + testImage + "';", 0) ; | |
| 27 </script> | |
| 28 <div id="console"> | |
| 29 crbug.com/469678: We should fire an image load event even if the image is the la st one we loaded successfully.<br> | |
| 30 In this test we load an image then we immediately launch an other request for th e same image - only one load event should be fired.<br> | |
| 31 Then we do the same again: another load event should be fired.<br> | |
| 32 </div> | |
| 33 <div id="result">FAIL</div> | |
| OLD | NEW |