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