Chromium Code Reviews| Index: LayoutTests/fast/images/onload-event-when-reloading-image-after-successful-image-load.html |
| diff --git a/LayoutTests/fast/images/onload-event-when-reloading-image-after-successful-image-load.html b/LayoutTests/fast/images/onload-event-when-reloading-image-after-successful-image-load.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a5e7e02ff58657e3008f2dc63e50e64b0679af9c |
| --- /dev/null |
| +++ b/LayoutTests/fast/images/onload-event-when-reloading-image-after-successful-image-load.html |
| @@ -0,0 +1,33 @@ |
| +<!DOCTYPE html> |
| +<script> |
| + if (window.testRunner) { |
| + testRunner.waitUntilDone(); |
| + testRunner.dumpAsText(); |
| + } |
| + img = new Image(); |
| + var onloadCounter = 0; |
| + var testImage = 'resources/green.jpg'; |
| + var resetImage = 'resources/green.jpg'; |
| + img.onload = function(){ |
| + onloadCounter++; |
| + document.getElementById('console').innerHTML += "Image onload event fired for " + img.src.substring(img.src.lastIndexOf('/') + 1) + "<br>"; |
| + if (onloadCounter == 2) { |
| + document.getElementById('result').textContent = "PASS"; |
| + if (window.testRunner) |
| + testRunner.notifyDone(); |
| + return; |
| + } |
| + if (onloadCounter == 1) { |
| + setTimeout("img.src='" + resetImage + "';img.src = '" + testImage + "';", 0); |
|
esprehn
2015/03/31 21:53:21
use functions instead.
setTimeout(function() {
|
| + return; |
| + } |
| + document.getElementById('result').textContent = "FAIL"; |
| + }; |
| + setTimeout("img.src='" + resetImage + "';img.src = '" + testImage + "';", 0); |
| +</script> |
| +<div id="console"> |
| +crbug.com/469678: We should fire an image load event even if the image is the last one we loaded successfully.<br> |
| +In this test we load an image then we immediately launch an other request for the same image - only one load event should be fired.<br> |
| +Then we do the same again: another load event should be fired.<br> |
| +</div> |
| +<div id="result">FAIL</div> |