OLD | NEW |
1 <html> | 1 <!DOCTYPE html> |
2 <head> | |
3 <script> | 2 <script> |
4 if (window.testRunner) | 3 if (window.testRunner) |
5 testRunner.waitUntilDone(); | 4 testRunner.waitUntilDone(); |
6 window.manualNotifyDone = true; | 5 window.manualNotifyDone = true; |
7 </script> | 6 </script> |
8 <script src="resources/srcset-helper.js"></script> | 7 <script src="resources/srcset-helper.js"></script> |
9 <script src="../../resources/js-test.js"></script> | 8 <script src="../../resources/js-test.js"></script> |
10 <script> | 9 <script> |
11 addEventListener("load", function() { | 10 addEventListener("load", function() { |
12 var img = document.getElementById("foo"); | 11 var img = document.getElementById("foo"); |
13 img.srcset = "resources/green-400-px-square.png 2x"; | 12 img.srcset = "resources/green-400-px-square.png 2x"; |
14 img.addEventListener("load", function() { | 13 img.addEventListener("load", function() { |
15 shouldBeTrue('document.getElementById("foo").clientWidth==200'); | 14 shouldBeTrue('document.getElementById("foo").clientWidth==200'); |
16 shouldBeFalse('document.getElementById("foo").clientWidth==400'); | 15 shouldBeFalse('document.getElementById("foo").clientWidth==400'); |
17 if (window.testRunner) | 16 if (window.testRunner) |
18 testRunner.notifyDone(); | 17 testRunner.notifyDone(); |
19 }, false); | 18 }, false); |
20 }, false); | 19 }, false); |
21 </script> | 20 </script> |
22 </head> | 21 <div>This test passes if this img tag below is a green square when the scale fac
tor is 2. |
23 | 22 It ensures that attributes can be changed dynamically from javascript, and t
hat only the correct resource is loaded.</div> |
24 <body id="body"> | 23 <img id="foo" src="resources/blue-100-px-square.png"> |
25 <div>This test passes if this img tag below is a green square when the scale
factor is 2. | |
26 It ensures that attributes can be changed dynamically from javascript, and
that only the correct resource is loaded.</div> | |
27 <img id="foo" src="resources/blue-100-px-square.png"> | |
28 </body> | |
29 </html> | |
OLD | NEW |