Chromium Code Reviews| Index: LayoutTests/fast/dom/HTMLImageElement/image-picture-react-to-media-changes.html |
| diff --git a/LayoutTests/fast/dom/HTMLImageElement/image-picture-react-to-media-changes.html b/LayoutTests/fast/dom/HTMLImageElement/image-picture-react-to-media-changes.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..08e145e191e8fab58a686086c3ffdb2adf4b0f17 |
| --- /dev/null |
| +++ b/LayoutTests/fast/dom/HTMLImageElement/image-picture-react-to-media-changes.html |
| @@ -0,0 +1,37 @@ |
| +<!DOCTYPE html> |
| +<script src="../../resources/js-test.js"></script> |
| +<script> |
| +var jsTestIsAsync = true; |
| +var img; |
| + |
| +function runTest() { |
|
esprehn
2014/07/02 21:15:41
onload = function() {
|
| + var iframe = document.getElementById("f"); |
| + var iframeDoc = iframe.contentWindow.document; |
| + |
| + iframeDoc.body.innerHTML = '<picture id="pic">' + |
| + '<source media="(max-width: 90px)" srcset="resources/blue-100-px-square.png"></source>' + |
| + '<source media="(max-width: 120px)" srcset="resources/green-400-px-square.png"></source>' + |
| + '</picture>'; |
| + |
| + img = iframeDoc.createElement('img'); |
| + |
| + var first = true; |
| + img.onload = function() { |
| + if (first) { |
| + first = false; |
| + shouldNotBe('-1', 'img.currentSrc.indexOf("green-400")'); |
| + iframe.style.width = '80px'; |
| + } else { |
| + shouldNotBe('-1', 'img.currentSrc.indexOf("blue-100")'); |
| + finishJSTest(); |
| + } |
| + }; |
| + img.onerror = function() { |
| + testFailed('Image should have loaded'); |
| + }; |
| + iframeDoc.getElementById('pic').appendChild(img); |
| +} |
| +</script> |
| + |
| +<body onload="runTest()"> |
|
esprehn
2014/07/02 21:15:41
Remove <body>.
|
| +<iframe id="f" style="width: 100px;"></iframe> |
|
esprehn
2014/07/02 21:15:42
id="frame"
|