3 <script src=
"/js-test-resources/js-test.js"></script>
4 <script src=
"http://127.0.0.1:8000/resources/slow-script.pl?delay=100"></script>
5 <script src=
"resources/picture-preload-helper.js"></script>
10 testRunner
.dumpAsText();
11 shouldBeTrue("internals.isPreloaded('resources/preload-test.jpg?0');");
12 shouldBeTrue("internals.isPreloaded('resources/image2.png');");
21 <!-- Control group -->
22 <img src=
"resources/preload-test.jpg?0">
24 <source srcset=
"resources/image2.png">
26 <!-- Invalid nesting tests -->
27 <!-- In the following tests, nesting messes up the selection algorithm -->
30 <source sizes=
"400px" srcset=
"resources/base-image1.png?1 200w, resources/base-image3.png?1 400w, resources/base-image2.png?1 800w">
34 <img src=
"resources/preload-test.jpg?1">
43 <source sizes=
"400px" srcset=
"resources/base-image1.png?2 200w, resources/base-image3.png?2 400w, resources/base-image2.png?2 800w">
44 <img src=
"resources/preload-test.jpg?2">
46 <!-- Here we preload the correct resource, since document.write is not modifying the DOM -->
48 <script>document
.write("bla");</script>
49 <source sizes=
"400px" srcset=
"resources/base-image1.png?3 200w, resources/base-image3.png?3 400w, resources/base-image2.png?3 800w">
50 <img src=
"resources/preload-test.jpg?3">
52 <!-- In the following tests, nesting messes up the selection algorithm, but we don't get it -->
57 <source sizes=
"400px" srcset=
"resources/base-image1.png?4 200w, resources/base-image3.png?4 400w, resources/base-image2.png?4 800w">
59 <img src=
"resources/preload-test.jpg?4">
67 <source sizes=
"400px" srcset=
"resources/base-image1.png?5 200w, resources/base-image3.png?5 400w, resources/base-image2.png?5 800w">
68 <img src=
"resources/preload-test.jpg?5">
73 <!-- We don't keep a checkpoint of the picture stack, so document.write inside picture
74 *that modifies the DOM* will result in a false prediction -->
75 <!-- In the following tests, we preload the wrong resource, because document.write is modifying the DOM -->
76 <script>document
.write('<picture>');</script>
77 <source sizes=
"400px" srcset=
"resources/base-image1.png?6 200w, resources/base-image3.png?6 400w, resources/base-image2.png?6 800w">
78 <img src=
"resources/preload-test.jpg?6">
81 <script>document
.write('<source sizes="400px" srcset="resources/base-image1.png?7 200w, resources/base-image3.png?7 400w, resources/base-image2.png?7 800w">');</script>
82 <img src=
"resources/preload-test.jpg?7">