Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/images/natural-dimensions-correct-after-image-reset.html |
| diff --git a/third_party/WebKit/LayoutTests/fast/images/natural-dimensions-correct-after-image-reset.html b/third_party/WebKit/LayoutTests/fast/images/natural-dimensions-correct-after-image-reset.html |
| index f9c22460c0a0e2961549f16b9b12ef4015d8f30d..876025eca3a478991c64c023907c10cb78a13cd8 100644 |
| --- a/third_party/WebKit/LayoutTests/fast/images/natural-dimensions-correct-after-image-reset.html |
| +++ b/third_party/WebKit/LayoutTests/fast/images/natural-dimensions-correct-after-image-reset.html |
| @@ -1,30 +1,15 @@ |
| <!DOCTYPE html> |
| -<script src="../../resources/js-test.js"></script> |
| +<title>crbug.com/468915: Resetting or removing the src attribute should reset the image immediately, rather than waiting for an asynchronous load to do it.</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 testImage = 'resources/green.jpg'; |
| - img.onload = function(){ |
| +async_test(function(t) { |
| + var img = new Image(); |
| + img.onload = t.step_func_done(function() { |
| + assert_greater_than(img.naturalWidth, 0, "Image width should be greater than zero"); |
|
fs
2016/08/16 10:42:42
Nit: Could probably even use the exact value from
sivag
2016/08/16 11:54:21
Done.
|
| img.removeAttribute('src'); |
| - if (img.naturalWidth > 0) { |
| - debug("Natural width is : " + img.naturalWidth + " and should be 0."); |
| - if (window.testRunner) |
| - testRunner.notifyDone(); |
| - return; |
| - } |
| - document.getElementById('result').textContent = "PASS"; |
| - if (window.testRunner) |
| - testRunner.notifyDone(); |
| - }; |
| - setTimeout(function() { |
| - img.src = testImage; |
| - }, 0); |
| + assert_equals(img.naturalWidth, 0); |
| + }); |
| + img.src = 'resources/green.jpg'; |
| +}); |
| </script> |
| -<div id="console"> |
| - crbug.com/468915: Resetting or removing the src attribute should reset the image immediately, rather than waiting for an asynchronous load to do it.<br> |
| -</div> |
| -<div id="result">FAIL</div> |
| - |