Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/images/onload-event-when-reloading-image-after-successful-image-load.html |
| diff --git a/third_party/WebKit/LayoutTests/fast/images/onload-event-when-reloading-image-after-successful-image-load.html b/third_party/WebKit/LayoutTests/fast/images/onload-event-when-reloading-image-after-successful-image-load.html |
| index ae2c6e8c0f3581cccb1bcb30bfb90c072ecd2445..e189ccdc30da71346e828e299a22ee470319f95a 100644 |
| --- a/third_party/WebKit/LayoutTests/fast/images/onload-event-when-reloading-image-after-successful-image-load.html |
| +++ b/third_party/WebKit/LayoutTests/fast/images/onload-event-when-reloading-image-after-successful-image-load.html |
| @@ -1,40 +1,21 @@ |
| <!DOCTYPE html> |
| -<script src="../../resources/js-test.js"></script> |
| +<title>crbug.com/469678: We should fire an image load event even if the image is the last one we loaded successfully.</title> |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| <script> |
| - if (window.testRunner) { |
| - testRunner.waitUntilDone(); |
| - testRunner.dumpAsText(); |
| - } |
| - img = new Image(); |
| - var onloadCounter = 0; |
| +async_test(function(t) { |
| + var img = new Image(); |
| var testImage = 'resources/green.jpg'; |
| var resetImage = 'resources/green.jpg'; |
| - img.onload = function(){ |
| - onloadCounter++; |
| - debug("Image onload event fired for " + img.src.substring(img.src.lastIndexOf('/') + 1)); |
| - if (onloadCounter == 2) { |
| - document.getElementById('result').textContent = "PASS"; |
| - if (window.testRunner) |
| - testRunner.notifyDone(); |
| - return; |
| - } |
| - if (onloadCounter == 1) { |
| - setTimeout(function() { |
| - img.src= resetImage; |
| - img.src = testImage; |
| - }, 0); |
| - return; |
| - } |
| - document.getElementById('result').textContent = "FAIL"; |
| - }; |
| - setTimeout(function() { |
| + // In this test we load an image then we immediately launch an other request |
|
fs
2016/08/18 10:44:26
Nit: s/an other/another/
sivag
2016/08/18 10:53:20
Done.
|
| + // for the same image - only one load event should be fired. Then we do the |
| + // same again: another load event should be fired. |
| + img.onload = t.step_func(function() { |
| img.src= resetImage; |
|
fs
2016/08/18 10:44:26
Nit: Space before =
sivag
2016/08/18 10:53:20
Done.
|
| img.src = testImage; |
| - }, 0); |
| + img.onload = t.step_func_done(); |
| + }); |
| + img.src= resetImage; |
|
fs
2016/08/18 10:44:26
Nit: Space before =
sivag
2016/08/18 10:53:20
Done.
|
| + img.src = testImage; |
| +}); |
| </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> |