blob: 4f819bae49e7bcee8ac56b976eb9f31f0af47d32 [file] [log] [blame]
<!DOCTYPE html>
<script src="../../hidpi/resources/srcset-helper.js"></script>
<script src="../../../resources/js-test.js"></script>
<script src="resources/currentSrcHelper.js"></script>
<script>
if (window.testRunner)
testRunner.dumpAsText();
if (internals)
internals.evictAllResources();
function updateSrc() {
var img = document.getElementById("foo");
// sizes must be set first, then srcset must be set, the 'src'
// This will be fixed when image loading is done is "stable-state"
img.sizes = "400px";
img.srcset = "../../hidpi/resources/image-set-1x.png 200w, ../../hidpi/resources/image-set-2x.png 400w, resources/image-set-4x.png 800w";
img.src = "resources/blue-100-px-square.png"
}
addEventListener("DOMContentLoaded", function() {
updateSrc();
}, false);
addEventListener("load", function() {
shouldBe('currentSrcFileName("foo")', '"image-set-4x.png"');
if (internals) {
shouldBeTrue('internals.isLoadingFromMemoryCache("resources/image-set-4x.png")');
shouldBeFalse('internals.isLoadingFromMemoryCache("../../hidpi/resources/image-set-2x.png")');
shouldBeFalse('internals.isLoadingFromMemoryCache("../../hidpi/resources/image-set-1x.png")');
shouldBeFalse('internals.isLoadingFromMemoryCache("resources/blue-100-px-square.png")');
}
}, false);
</script>
<img id="foo">