| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../../hidpi/resources/srcset-helper.js"></script> | 2 <script src="../../hidpi/resources/srcset-helper.js"></script> |
| 3 <script src="../../../resources/js-test.js"></script> | 3 <script src="../../../resources/js-test.js"></script> |
| 4 <script src="resources/currentSrcHelper.js"></script> | 4 <script src="resources/currentSrcHelper.js"></script> |
| 5 <script> | 5 <script> |
| 6 if (window.testRunner) | 6 if (window.testRunner) |
| 7 testRunner.dumpAsText(); | 7 testRunner.dumpAsText(); |
| 8 |
| 9 if (internals) |
| 10 internals.evictAllResources(); |
| 8 | 11 |
| 9 function updateSrc() { | 12 function updateSrc() { |
| 10 var img = document.getElementById("foo"); | 13 var img = document.getElementById("foo"); |
| 11 // sizes must be set first, then srcset must be set, the 'src' | 14 // sizes must be set first, then srcset must be set, the 'src' |
| 12 // This will be fixed when image loading is done is "stable-state" | 15 // This will be fixed when image loading is done is "stable-state" |
| 13 img.sizes = "400px"; | 16 img.sizes = "400px"; |
| 14 img.srcset = "../../hidpi/resources/image-set-1x.png 200w, ../../hidpi/r
esources/image-set-2x.png 400w, resources/image-set-4x.png 800w"; | 17 img.srcset = "../../hidpi/resources/image-set-1x.png 200w, ../../hidpi/r
esources/image-set-2x.png 400w, resources/image-set-4x.png 800w"; |
| 15 img.src = "resources/blue-100-px-square.png" | 18 img.src = "resources/blue-100-px-square.png" |
| 16 } | 19 } |
| 17 | 20 |
| 18 addEventListener("DOMContentLoaded", function() { | 21 addEventListener("DOMContentLoaded", function() { |
| 19 if (window.testRunner && sessionStorage.pageReloaded) | |
| 20 testRunner.dumpResourceRequestCallbacks(); | |
| 21 updateSrc(); | 22 updateSrc(); |
| 22 }, false); | 23 }, false); |
| 23 addEventListener("load", function() { | 24 addEventListener("load", function() { |
| 24 shouldBe('currentSrcFileName("foo")', '"image-set-4x.png"'); | 25 shouldBe('currentSrcFileName("foo")', '"image-set-4x.png"'); |
| 26 if (internals) { |
| 27 shouldBeTrue('internals.isLoadingFromMemoryCache("resources/image-se
t-4x.png")'); |
| 28 shouldBeFalse('internals.isLoadingFromMemoryCache("../../hidpi/resou
rces/image-set-2x.png")'); |
| 29 shouldBeFalse('internals.isLoadingFromMemoryCache("../../hidpi/resou
rces/image-set-1x.png")'); |
| 30 shouldBeFalse('internals.isLoadingFromMemoryCache("resources/blue-10
0-px-square.png")'); |
| 31 } |
| 25 }, false); | 32 }, false); |
| 26 </script> | 33 </script> |
| 27 <img id="foo"> | 34 <img id="foo"> |
| OLD | NEW |