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

Unified Diff: LayoutTests/fast/dom/HTMLImageElement/image-sizes-js-change.html

Issue 236713005: Use SizesAttributeParser to get the right srcset resource (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@sizes_parser8
Patch Set: Fixed nits Created 6 years, 8 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-sizes-js-change.html
diff --git a/LayoutTests/fast/dom/HTMLImageElement/image-sizes-js-change.html b/LayoutTests/fast/dom/HTMLImageElement/image-sizes-js-change.html
new file mode 100644
index 0000000000000000000000000000000000000000..5538d5befef930b5f1132391c1da53c84e1bf42d
--- /dev/null
+++ b/LayoutTests/fast/dom/HTMLImageElement/image-sizes-js-change.html
@@ -0,0 +1,32 @@
+<html>
+<head>
+<script src="../../hidpi/resources/srcset-helper.js"></script>
+<script src="../../../resources/js-test.js"></script>
+<script>
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ function updateSrc() {
+ var img = document.getElementById("foo");
+ // sizes must be set first, then srcset must be set, the 'src'
+ // This will be fixed when image loading is done is "stable-state"
+ img.sizes = "400px";
+ img.srcset = "../../hidpi/resources/image-set-1x.png 200w, ../../hidpi/resources/image-set-2x.png 400w, resources/image-set-4x.png 800w";
+ img.src = "resources/blue-100-px-square.png"
+ }
+
+ addEventListener("DOMContentLoaded", function() {
+ if (window.testRunner && sessionStorage.pageReloaded)
+ testRunner.dumpResourceRequestCallbacks();
+ updateSrc();
+ }, false);
+ addEventListener("load", function() {
+ shouldBe('document.getElementById("foo").currentSrc', '"resources/image-set-4x.png"');
+ }, false);
+</script>
+</head>
+
+<body id="body">
+ <img id="foo">
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698