Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Side by Side Diff: LayoutTests/fast/hidpi/image-srcset-change-resource-dpr.html

Issue 25105004: Use srcset's resource pixel density to determine intrinsic size (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cleantests
Patch Set: Fixed crash+rebased Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script>
4 if (window.testRunner)
5 testRunner.waitUntilDone();
6 window.manualNotifyDone = true;
7 </script>
3 <script src="resources/srcset-helper.js"></script> 8 <script src="resources/srcset-helper.js"></script>
4 <script src="../js/resources/js-test-pre.js"></script> 9 <script src="../js/resources/js-test-pre.js"></script>
5 <script> 10 <script>
6 if (window.testRunner) { 11 addEventListener("load", function() {
7 testRunner.dumpAsText();
8 }
9
10 function updateSrc() {
11 var img = document.getElementById("foo"); 12 var img = document.getElementById("foo");
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.addEventListener("load", function() {
15 } 15 shouldBeTrue('document.getElementById("foo").clientWidth==200');
16 16 shouldBeFalse('document.getElementById("foo").clientWidth==400');
17 addEventListener("DOMContentLoaded", function() { 17 if (window.testRunner)
18 updateSrc(); 18 testRunner.notifyDone();
19 }, false); 19 }, false);
20 addEventListener("load", function() {
21 if (internals)
22 shouldBeFalse('internals.isPreloaded("resources/blue-100-px-square.p ng")');
23 shouldBeTrue('document.getElementById("foo").clientWidth==200');
24 }, false); 20 }, false);
25 </script> 21 </script>
26 </head> 22 </head>
27 23
28 <body id="body"> 24 <body id="body">
29 <div>This test passes if this img tag below is a green square when the scale factor is 2. 25 <div>This test passes if this img tag below is a green square when the scale factor is 2.
30 It ensures that attributes can be changed dynamically from javascript, and that only the correct resource is loaded.</div> 26 It ensures that attributes can be changed dynamically from javascript, and that only the correct resource is loaded.</div>
31 <img id="foo"> 27 <img id="foo" src="resources/blue-100-px-square.png">
32 </body> 28 </body>
33 </html> 29 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698