OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script> | |
4 if (window.testRunner) | |
5 testRunner.dumpResourceRequestCallbacks(); | |
6 </script> | |
7 <script src="resources/srcset-helper.js"></script> | 3 <script src="resources/srcset-helper.js"></script> |
8 <script src="../js/resources/js-test-pre.js"></script> | 4 <script src="../js/resources/js-test-pre.js"></script> |
9 <script> | 5 <script> |
| 6 if (window.testRunner) { |
| 7 testRunner.dumpAsText(); |
| 8 } |
| 9 |
10 function updateSrc() { | 10 function updateSrc() { |
11 var img = document.getElementById("foo"); | 11 var img = document.getElementById("foo"); |
12 // srcset must be set first, otherwise 'src' is loaded as well | 12 // srcset must be set first, otherwise 'src' is loaded as well |
13 img.srcset = "resources/green-200-px-square.png 2x"; | 13 img.srcset = "resources/green-200-px-square.png 2x"; |
14 img.src = "resources/blue-100-px-square.png" | 14 img.src = "resources/blue-100-px-square.png" |
15 } | 15 } |
16 | 16 |
17 addEventListener("DOMContentLoaded", function() { | 17 addEventListener("DOMContentLoaded", function() { |
18 updateSrc(); | 18 updateSrc(); |
19 }, false); | 19 }, false); |
20 addEventListener("load", function() { | 20 addEventListener("load", function() { |
| 21 if (internals) |
| 22 shouldBeFalse('internals.isPreloaded("resources/blue-100-px-square.p
ng")'); |
21 shouldBeTrue('document.getElementById("foo").clientWidth==200'); | 23 shouldBeTrue('document.getElementById("foo").clientWidth==200'); |
22 }, false); | 24 }, false); |
23 </script> | 25 </script> |
24 </head> | 26 </head> |
25 | 27 |
26 <body id="body"> | 28 <body id="body"> |
27 <div>This test passes if this img tag below is a green square when the scale
factor is 2. | 29 <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> | 30 It ensures that attributes can be changed dynamically from javascript, and
that only the correct resource is loaded.</div> |
29 <img id="foo"> | 31 <img id="foo"> |
30 </body> | 32 </body> |
31 </html> | 33 </html> |
OLD | NEW |