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

Unified Diff: LayoutTests/fast/dom/HTMLImageElement/image-picture-source-dynamic-changes.html

Issue 290203002: <picture>: Update the <img> element when a <source> changes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: review comments addressed Created 6 years, 7 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
« no previous file with comments | « no previous file | LayoutTests/fast/dom/HTMLImageElement/image-picture-source-dynamic-changes-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/dom/HTMLImageElement/image-picture-source-dynamic-changes.html
diff --git a/LayoutTests/fast/dom/HTMLImageElement/image-picture-source-dynamic-changes.html b/LayoutTests/fast/dom/HTMLImageElement/image-picture-source-dynamic-changes.html
new file mode 100644
index 0000000000000000000000000000000000000000..5ca9569d55057f2da49d4ba347132b36b3c3a399
--- /dev/null
+++ b/LayoutTests/fast/dom/HTMLImageElement/image-picture-source-dynamic-changes.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<script src="../../../resources/js-test.js"></script>
+<script src="resources/currentSrcHelper.js"></script>
+
+<picture>
+ <source id="src" srcset="../../hidpi/resources/image-set-1x.png?1 1x">
+ <img id="simple" src="resources/blue_rect.jpg?1">
+</picture>
+
+<script>
+ jsTestIsAsync = true;
+
+ var iteration = 0;
+
+ var simple = document.getElementById('simple');
+ var src = document.getElementById('src');
+
+ simple.addEventListener('load', function() {
+ switch (iteration) {
+ case 0:
+ shouldBe('document.getElementById("simple").clientWidth', '400');
+ shouldBe('currentSrcFileName("simple")', '"image-set-1x.png?1"');
+
+ src.srcset = 'resources/image-set-4x.png 1x';
+ break;
+ case 1:
+ shouldBe('document.getElementById("simple").clientWidth', '1600');
+ shouldBe('currentSrcFileName("simple")', '"image-set-4x.png"');
+
+ src.parentNode.removeChild(src);
+ break;
+ case 2:
+ shouldBe('document.getElementById("simple").clientWidth', '75');
+ shouldBe('currentSrcFileName("simple")', '"blue_rect.jpg?1"');
+
+ src.srcset = '../../hidpi/resources/image-set-1x.png?2 1x';
+ simple.parentNode.insertBefore(src, simple);
+ break;
+ case 3:
+ shouldBe('document.getElementById("simple").clientWidth', '400');
+ shouldBe('currentSrcFileName("simple")', '"image-set-1x.png?2"');
+
+
+ // When there is a <source>, changing the <src> should have no effect
+ simple.src = 'resources/blue_rect.jpg?2';
+ shouldBe('currentSrcFileName("simple")', '"image-set-1x.png?2"');
+
+ finishJSTest();
+ break;
+ };
+ ++iteration;
+ }, false);
+</script>
+
« no previous file with comments | « no previous file | LayoutTests/fast/dom/HTMLImageElement/image-picture-source-dynamic-changes-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698