Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / HTMLImageElement / image-srcset-react-to-media-changes-px-based-sizes.html
blob4a6ff4006b3af85c4dff26e165eac044159b3470
1 <!DOCTYPE html>
2 <script src="../../../resources/js-test.js"></script>
3 <script>
4 var jsTestIsAsync = true;
5 var img;
7 onload = function() {
8 var iframe = document.getElementById('frame');
9 var iframeDoc = iframe.contentWindow.document;
11 iframeDoc.body.innerHTML = '<img sizes="(max-width: 90px) 90px, 120px" id="srcset" srcset="resources/blue_rect.jpg 90w, resources/image-set-4x.png 120w">';
13 img = iframeDoc.getElementById('srcset');
15 var first = true;
16 img.onload = function() {
17 if (first) {
18 first = false;
19 shouldNotBe('img.currentSrc.indexOf("blue_rect")', '-1');
20 iframe.style.width = '100px';
21 } else {
22 shouldNotBe('img.currentSrc.indexOf("image-set-4x")', '-1');
23 finishJSTest();
26 img.onerror = function() {
27 testFailed('Image should have loaded');
30 </script>
32 <iframe id="frame" style="width: 80px;"></iframe>