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 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"; | 11 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 } | 12 } |
16 | 13 |
17 addEventListener("DOMContentLoaded", function() { | 14 addEventListener("DOMContentLoaded", function() { |
| 15 if (window.testRunner && sessionStorage.pageReloaded) |
| 16 testRunner.dumpResourceRequestCallbacks(); |
18 updateSrc(); | 17 updateSrc(); |
19 }, false); | 18 }, false); |
20 addEventListener("load", function() { | 19 addEventListener("load", function() { |
21 shouldBeTrue('document.getElementById("foo").clientWidth==200'); | 20 shouldBeTrue('document.getElementById("foo").clientWidth==200'); |
22 }, false); | 21 }, false); |
23 </script> | 22 </script> |
24 </head> | 23 </head> |
25 | 24 |
26 <body id="body"> | 25 <body id="body"> |
27 <div>This test passes if this img tag below is a green square when the scale
factor is 2. | 26 <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> | 27 It ensures that attributes can be changed dynamically from javascript, and
that only the correct resource is loaded.</div> |
29 <img id="foo"> | 28 <img id="foo"> |
30 </body> | 29 </body> |
31 </html> | 30 </html> |
OLD | NEW |