2 <script src=
"../../../resources/js-test.js"></script>
3 <script src=
"resources/currentSrcHelper.js"></script>
6 testRunner
.dumpAsText();
8 addEventListener("load", function() {
9 shouldBe('document.getElementById("canary").clientWidth', '75');
10 shouldBe('currentSrcFileName("canary")', '"blue_rect.jpg?0"');
11 shouldBe('document.getElementById("div_end_picture").clientWidth', '800');
12 shouldBe('currentSrcFileName("div_end_picture")', '"image-set-2x.png?2"');
13 shouldBe('document.getElementById("div_multiple_end").clientWidth', '800');
14 shouldBe('currentSrcFileName("div_multiple_end")', '"image-set-2x.png?2"');
15 shouldBe('document.getElementById("source_in_div").clientWidth', '75');
16 shouldBe('currentSrcFileName("source_in_div")', '"blue_rect.jpg"');
17 shouldBe('document.getElementById("not_in_picture").clientWidth', '75');
18 shouldBe('currentSrcFileName("not_in_picture")', '"blue_rect.jpg"');
21 <!-- A canary image to see that the test is actually working -->
22 <img id=
"canary" src=
"resources/blue_rect.jpg?0">
23 <!-- Invalid nesting tests -->
24 <!-- In the following tests, nesting shouldn't mess up the selection algorithm -->
27 <source sizes=
"800px" srcset=
"../../hidpi/resources/image-set-1x.png?2 400w, ../../hidpi/resources/image-set-2x.png?2 800w,
28 resources/image-set-4x.png?2 1600w">
32 <img id=
"div_end_picture" src=
"resources/blue_rect.jpg">
41 <source sizes=
"800px" srcset=
"../../hidpi/resources/image-set-1x.png?2 400w, ../../hidpi/resources/image-set-2x.png?2 800w,
42 resources/image-set-4x.png?2 1600w">
43 <img id=
"div_multiple_end" src=
"resources/blue_rect.jpg">
45 <!-- In the following tests, nesting messes up the selection algorithm -->
50 <source sizes=
"400px" srcset=
"resources/base-image1.png?4 200w, resources/base-image3.png?4 400w, resources/base-image2.png?4 800w">
52 <img id=
"source_in_div" src=
"resources/blue_rect.jpg">
60 <source sizes=
"400px" srcset=
"resources/base-image1.png?5 200w, resources/base-image3.png?5 400w, resources/base-image2.png?5 800w">
61 <img id=
"not_in_picture" src=
"resources/blue_rect.jpg">