Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / fast / dom / HTMLImageElement / image-sizes-js-change.html
1 <!DOCTYPE html>
2 <script src="../../hidpi/resources/srcset-helper.js"></script>
3 <script src="../../../resources/js-test.js"></script>
4 <script src="resources/currentSrcHelper.js"></script>
5 <script>
6     if (window.testRunner)
7         testRunner.dumpAsText();
8     
9     if (internals)
10         internals.evictAllResources();
11
12     function updateSrc() {
13         var img = document.getElementById("foo");
14         // 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"
16         img.sizes = "400px";
17         img.srcset = "../../hidpi/resources/image-set-1x.png 200w, ../../hidpi/resources/image-set-2x.png 400w, resources/image-set-4x.png 800w";
18         img.src = "resources/blue-100-px-square.png"
19     }
20
21     addEventListener("DOMContentLoaded", function() {
22         updateSrc();
23     }, false);
24     addEventListener("load", function() {
25         shouldBe('currentSrcFileName("foo")', '"image-set-4x.png"');
26         if (internals) {
27             shouldBeTrue('internals.isLoadingFromMemoryCache("resources/image-set-4x.png")');
28             shouldBeFalse('internals.isLoadingFromMemoryCache("../../hidpi/resources/image-set-2x.png")');
29             shouldBeFalse('internals.isLoadingFromMemoryCache("../../hidpi/resources/image-set-1x.png")');
30             shouldBeFalse('internals.isLoadingFromMemoryCache("resources/blue-100-px-square.png")');
31         }
32     }, false);
33 </script>
34 <img id="foo">