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