Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / fast / dom / HTMLImageElement / image-sizes-js-change.html
1 <html>
2 <head>
3 <script src="../../hidpi/resources/srcset-helper.js"></script>
4 <script src="../../../resources/js-test.js"></script>
5 <script>
6     if (window.testRunner)
7         testRunner.dumpAsText();
8
9     function updateSrc() {
10         var img = document.getElementById("foo");
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"
13         img.sizes = "400px";
14         img.srcset = "../../hidpi/resources/image-set-1x.png 200w, ../../hidpi/resources/image-set-2x.png 400w, resources/image-set-4x.png 800w";
15         img.src = "resources/blue-100-px-square.png"
16     }
17
18     addEventListener("DOMContentLoaded", function() {
19         if (window.testRunner && sessionStorage.pageReloaded)
20             testRunner.dumpResourceRequestCallbacks();
21         updateSrc();
22     }, false);
23     addEventListener("load", function() {
24         shouldBe('document.getElementById("foo").currentSrc', '"resources/image-set-4x.png"');
25     }, false);
26 </script>
27 </head>
28
29 <body id="body">
30     <img id="foo">
31 </body>
32 </html>