OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script> | 3 <script> |
4 if (window.testRunner) | |
5 testRunner.dumpResourceRequestCallbacks(); | |
6 </script> | 4 </script> |
7 <script src="resources/srcset-helper.js"></script> | 5 <script src="resources/srcset-helper.js"></script> |
8 <script src="../../resources/js-test.js"></script> | 6 <script src="../../resources/js-test.js"></script> |
9 <script> | 7 <script> |
10 function updateSrc() { | 8 function updateSrc() { |
11 var img = document.getElementById("foo"); | 9 var img = document.getElementById("foo"); |
12 // srcset must be set first, otherwise 'src' is loaded as well | 10 // The below should not trigger the load of the blue image according to
the spec, but currently it does |
| 11 // See http://crbug.com/341172 |
| 12 img.src = "resources/blue-100-px-square.png" |
13 img.srcset = "resources/blue-100-px-square.png 1x, resources/green-400-p
x-square.png 2x"; | 13 img.srcset = "resources/blue-100-px-square.png 1x, resources/green-400-p
x-square.png 2x"; |
14 img.src = "resources/blue-100-px-square.png" | |
15 } | 14 } |
16 | 15 |
17 addEventListener("DOMContentLoaded", function() { | 16 addEventListener("DOMContentLoaded", function() { |
| 17 if (window.testRunner && sessionStorage.pageReloaded) |
| 18 testRunner.dumpResourceRequestCallbacks(); |
18 updateSrc(); | 19 updateSrc(); |
19 }, false); | 20 }, false); |
20 addEventListener("load", function() { | 21 addEventListener("load", function() { |
21 shouldBeTrue('document.getElementById("foo").clientWidth==200'); | 22 shouldBeTrue('document.getElementById("foo").clientWidth==200'); |
22 }, false); | 23 }, false); |
23 </script> | 24 </script> |
24 </head> | 25 </head> |
25 | 26 |
26 <body id="body"> | 27 <body id="body"> |
27 <div>This test passes if this img tag below is a green square when the scale
factor is 2. | 28 <div>This test passes if this img tag below is a green square when the scale
factor is 2. |
28 It ensures that attributes can be changed dynamically from javascript, and
that only the correct resource is loaded.</div> | 29 It ensures that attributes can be changed dynamically from javascript, and
that only the correct resource is loaded.</div> |
29 <img id="foo"> | 30 <img id="foo"> |
30 </body> | 31 </body> |
31 </html> | 32 </html> |
OLD | NEW |