Web Inspector: Add some fast returns in cases where we only call through to a Network...
[WebKit-https.git] / LayoutTests / http / tests / loading / preload-picture-type.html
1 <html>
2 <head>
3     <script>
4       testRunner.waitUntilDone();
5       testRunner.setBackingScaleFactor(1);
6       if (!sessionStorage.pageReloaded) {
7           sessionStorage.pageReloaded = true
8           // have to force a restart because of a bug in dynamic changes with srcset
9           // we have to force the restart even if DPR=1 for consistency
10           document.location.reload(true);
11       }
12     </script>
13     <script src="/js-test-resources/js-test.js"></script>
14     <script src="http://127.0.0.1:8000/resources/slow-script.pl?delay=100"></script>
15 </head>
16 <body>
17 <script>
18     if (window.testRunner)
19         testRunner.dumpAsText();
20
21     shouldBe("window.devicePixelRatio", "1");
22     shouldBeTrue("internals.isPreloaded('resources/base-image1.png?0');");
23     shouldBeFalse("internals.isPreloaded('resources/preload-test.jpg?0');");
24     shouldBeTrue("internals.isPreloaded('resources/base-image1.png?1');");
25     shouldBeFalse("internals.isPreloaded('resources/preload-test.jpg?1');");
26     shouldBeTrue("internals.isPreloaded('resources/base-image1.png?2');");
27     shouldBeFalse("internals.isPreloaded('resources/preload-test.jpg?2');");
28     shouldBeFalse("internals.isPreloaded('resources/base-image1.png?3');");
29     shouldBeTrue("internals.isPreloaded('resources/preload-test.jpg?3');");
30
31     shouldBeFalse("internals.isPreloaded('resources/base-image1.png?4');");
32     shouldBeFalse("internals.isPreloaded('resources/base-image2.png?4');");
33     shouldBeTrue("internals.isPreloaded('resources/base-image3.png?4');");
34     shouldBeFalse("internals.isPreloaded('resources/preload-test.jpg?4');");
35
36     shouldBeFalse("internals.isPreloaded('resources/base-image1.png?5');");
37     shouldBeFalse("internals.isPreloaded('resources/base-image2.png?5');");
38     shouldBeFalse("internals.isPreloaded('resources/base-image3.png?5');");
39     shouldBeTrue("internals.isPreloaded('resources/preload-test.jpg?5');");
40
41     shouldBeTrue("internals.isPreloaded('resources/base-image1.png?6');");
42     shouldBeFalse("internals.isPreloaded('resources/preload-test.jpg?6');");
43     shouldBeFalse("internals.isPreloaded('resources/base-image1.png?7');");
44     shouldBeTrue("internals.isPreloaded('resources/preload-test.jpg?7');");
45
46     shouldBeTrue("internals.isPreloaded('resources/base-image1.png?8');");
47     shouldBeFalse("internals.isPreloaded('resources/preload-test.jpg?8');");
48
49     shouldBeFalse("internals.isPreloaded('resources/base-image1.png?9');");
50     shouldBeTrue("internals.isPreloaded('resources/preload-test.jpg?9');");
51
52     shouldBeTrue("internals.isPreloaded('resources/base-image1.png?10');");
53     shouldBeFalse("internals.isPreloaded('resources/base-image2.png?10');");
54     shouldBeFalse("internals.isPreloaded('resources/preload-test.jpg?10');");
55
56     shouldBeFalse("internals.isPreloaded('resources/base-image1.png?11');");
57     shouldBeTrue("internals.isPreloaded('resources/base-image2.png?11');");
58     shouldBeFalse("internals.isPreloaded('resources/preload-test.jpg?11');");
59
60     shouldBeTrue("internals.isPreloaded('resources/base-image1.png?12');");
61     shouldBeFalse("internals.isPreloaded('resources/base-image2.png?12');");
62     shouldBeFalse("internals.isPreloaded('resources/preload-test.jpg?12');");
63
64     shouldBeFalse("internals.isPreloaded('resources/base-image1.png?13');");
65     shouldBeFalse("internals.isPreloaded('resources/base-image2.png?13');");
66     shouldBeTrue("internals.isPreloaded('resources/preload-test.jpg?13');");
67     testRunner.notifyDone();
68 </script>
69 <!-- Control group -->
70 <picture>
71     <source srcset="resources/base-image1.png?0">
72     <img src="resources/preload-test.jpg?0">
73 </picture>
74 <!-- All permutations of type, media, srcset and sizes -->
75
76 <picture>
77     <source type="image/png" srcset="resources/base-image1.png?1">
78     <img src="resources/preload-test.jpg?1">
79 </picture>
80 <picture>
81     <source srcset="resources/base-image1.png?2" type="image/png">
82     <img src="resources/preload-test.jpg?2">
83 </picture>
84 <picture>
85     <source type="image/bad" srcset="resources/base-image1.png?3">
86     <img src="resources/preload-test.jpg?3">
87 </picture>
88 <picture>
89     <source type="image/png" sizes="400px" srcset="resources/base-image1.png?4 200w, resources/base-image3.png?4 400w, resources/base-image2.png?4 800w">
90     <img src="resources/preload-test.jpg?4">
91 </picture>
92 <picture>
93     <source type="image/bad" sizes="400px" srcset="resources/base-image1.png?5 200w, resources/base-image3.png?5 400w, resources/base-image2.png?5 800w" >
94     <img src="resources/preload-test.jpg?5">
95 </picture>
96 <picture>
97     <source type="image/png" media="(min-width: 1px)" srcset="resources/base-image1.png?6">
98     <img src="resources/preload-test.jpg?6">
99 </picture>
100 <picture>
101     <source type="image/bad" media="(min-width: 1px)" srcset="resources/base-image1.png?7">
102     <img src="resources/preload-test.jpg?7">
103 </picture>
104
105 <!-- Duplicate attributes -->
106 <picture>
107     <source type="image/png" type="image/bad" srcset="resources/base-image1.png?8">
108     <img src="resources/preload-test.jpg?8">
109 </picture>
110 <picture>
111     <source type="image/bad" type="image/png" srcset="resources/base-image1.png?9">
112     <img src="resources/preload-test.jpg?9">
113 </picture>
114 <!-- Multiple sources -->
115 <picture>
116     <source type="image/png" media="(min-width: 1px)" srcset="resources/base-image1.png?10">
117     <source type="image/png" media="(min-width: 1px)" srcset="resources/base-image2.png?10">
118     <img src="resources/preload-test.jpg?10">
119 </picture>
120 <picture>
121     <source type="image/bad" media="(min-width: 1px)" srcset="resources/base-image1.png?11">
122     <source type="image/png" media="(min-width: 1px)" srcset="resources/base-image2.png?11">
123     <img src="resources/preload-test.jpg?11">
124 </picture>
125 <picture>
126     <source type="image/png" media="(min-width: 1px)" srcset="resources/base-image1.png?12">
127     <source type="image/bad" media="(min-width: 1px)" srcset="resources/base-image2.png?12">
128     <img src="resources/preload-test.jpg?12">
129 </picture>
130 <picture>
131     <source type="image/bad" media="(min-width: 1px)" srcset="resources/base-image1.png?13">
132     <source type="image/invalid" media="(min-width: 1px)" srcset="resources/base-image2.png?13">
133     <img src="resources/preload-test.jpg?13">
134 </picture>
135
136 </body>
137 </html>