OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <head> |
| 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 </head> |
| 6 <body> |
| 7 <script> |
| 8 if (window.testRunner) |
| 9 testRunner.dumpAsText(); |
| 10 shouldBeTrue("internals.isPreloaded('resources/preload-test.jpg?0');"); |
| 11 shouldBeTrue("internals.isPreloaded('resources/image2.png');"); |
| 12 for (var i = 1; i <= 3; ++i) { |
| 13 shouldBeFalse("internals.isPreloaded('resources/preload-test.jpg?" + i +
"');"); |
| 14 shouldBeFalse("internals.isPreloaded('resources/base-image1.png?" + i +
"');"); |
| 15 shouldBeFalse("internals.isPreloaded('resources/base-image2.png?" + i +
"');"); |
| 16 shouldBeTrue("internals.isPreloaded('resources/base-image3.png?" + i + "
');"); |
| 17 } |
| 18 for (var i = 4; i <= 7; ++i) { |
| 19 shouldBeTrue("internals.isPreloaded('resources/preload-test.jpg?" + i +
"');"); |
| 20 shouldBeFalse("internals.isPreloaded('resources/base-image1.png?" + i +
"');"); |
| 21 shouldBeFalse("internals.isPreloaded('resources/base-image2.png?" + i +
"');"); |
| 22 shouldBeFalse("internals.isPreloaded('resources/base-image3.png?" + i +
"');"); |
| 23 } |
| 24 </script> |
| 25 <!-- Control group --> |
| 26 <img src="resources/preload-test.jpg?0"> |
| 27 <picture> |
| 28 <source srcset="resources/image2.png"> |
| 29 <img></picture> |
| 30 <!-- Invalid nesting tests --> |
| 31 <!-- In the following tests, nesting shouldn't mess up the selection algorithm -
-> |
| 32 <picture> |
| 33 <picture> |
| 34 <source sizes="400px" srcset="resources/base-image1.png?1 200w, resource
s/base-image3.png?1 400w, resources/base-image2.png?1 800w"> |
| 35 <div> |
| 36 </picture> |
| 37 </div> |
| 38 <img src="resources/preload-test.jpg?1"> |
| 39 </picture> |
| 40 </picture> |
| 41 <picture> |
| 42 <div> |
| 43 </picture> |
| 44 </picture> |
| 45 </picture> |
| 46 </div> |
| 47 <source sizes="400px" srcset="resources/base-image1.png?2 200w, resources/ba
se-image3.png?2 400w, resources/base-image2.png?2 800w"> |
| 48 <img src="resources/preload-test.jpg?2"> |
| 49 </picture> |
| 50 <!-- Here we preload the correct resource, since document.write is not modifying
the DOM --> |
| 51 <picture> |
| 52 <script>document.write("bla");</script> |
| 53 <source sizes="400px" srcset="resources/base-image1.png?3 200w, resources/ba
se-image3.png?3 400w, resources/base-image2.png?3 800w"> |
| 54 <img src="resources/preload-test.jpg?3"> |
| 55 </picture> |
| 56 <!-- In the following tests, nesting messes up the selection algorithm --> |
| 57 <picture> |
| 58 <div> |
| 59 <picture> |
| 60 <div> |
| 61 <source sizes="400px" srcset="resources/base-image1.png?4 200w,
resources/base-image3.png?4 400w, resources/base-image2.png?4 800w"> |
| 62 </div> |
| 63 <img src="resources/preload-test.jpg?4"> |
| 64 </picture> |
| 65 </div> |
| 66 </picture> |
| 67 <picture> |
| 68 <div> |
| 69 <picture> |
| 70 <div> |
| 71 <source sizes="400px" srcset="resources/base-image1.png?5 200w,
resources/base-image3.png?5 400w, resources/base-image2.png?5 800w"> |
| 72 <img src="resources/preload-test.jpg?5"> |
| 73 </div> |
| 74 </picture> |
| 75 </div> |
| 76 </picture> |
| 77 <!-- We don't keep a checkpoint of the picture stack, so document.write inside p
icture |
| 78 *that modifies the DOM* will result in a false prediction --> |
| 79 <!-- In the following tests, we preload the wrong resource, because document.wri
te is modifying the DOM --> |
| 80 <script>document.write('<picture>');</script> |
| 81 <source sizes="400px" srcset="resources/base-image1.png?6 200w, resources/ba
se-image3.png?6 400w, resources/base-image2.png?6 800w"> |
| 82 <img src="resources/preload-test.jpg?6"> |
| 83 </picture> |
| 84 <picture> |
| 85 <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> |
| 86 <img src="resources/preload-test.jpg?7"> |
| 87 </picture> |
| 88 </body> |
| 89 </html> |
OLD | NEW |