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

Unified Diff: LayoutTests/fast/dom/HTMLImageElement/image-picture-react-to-media-changes.html

Issue 287163010: Notify <picture> elements when a media query (potentially) changes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: forgot to adjust test after moving Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
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..d7644884c774a3f07ae23d2c62f7fd12f0cf8404
--- /dev/null
+++ b/LayoutTests/fast/dom/HTMLImageElement/image-picture-react-to-media-changes.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<script src="../../../resources/js-test.js"></script>
+<script>
+var jsTestIsAsync = true;
+var img;
+
+onload = function() {
+ var iframe = document.getElementById('frame');
+ var iframeDoc = iframe.contentWindow.document;
+
+ iframeDoc.body.innerHTML = '<picture id="pic">' +
+ '<source media="(max-width: 90px)" srcset="resources/blue_rect.jpg"></source>' +
+ '<source media="(max-width: 120px)" srcset="resources/image-set-4x.png"></source>' +
+ '</picture>';
+
+ img = iframeDoc.createElement('img');
+
+ var first = true;
+ img.onload = function() {
+ if (first) {
+ first = false;
+ shouldNotBe('-1', 'img.currentSrc.indexOf("image-set-4x")');
+ iframe.style.width = '80px';
+ } else {
+ shouldNotBe('-1', 'img.currentSrc.indexOf("blue_rect")');
+ finishJSTest();
+ }
+ };
+ img.onerror = function() {
+ testFailed('Image should have loaded');
+ };
+ iframeDoc.getElementById('pic').appendChild(img);
+}
+</script>
+
+<iframe id="frame" style="width: 100px;"></iframe>

Powered by Google App Engine
This is Rietveld 408576698