Chromium Code Reviews| 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 |
|
cbiesinger
2014/05/23 01:35:53
I added this test because the current code has thi
|
| + simple.src = 'resources/blue_rect.jpg?2'; |
| + shouldBe('currentSrcFileName("simple")', '"image-set-1x.png?2"'); |
| + |
| + finishJSTest(); |
| + break; |
| + }; |
| + ++iteration; |
| + }, false); |
| +</script> |
| + |