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