2 <script src=
"/resources/testharness.js"></script>
3 <script src=
"/resources/testharnessreport.js"></script>
5 <img id=simple
src=
"http://127.0.0.1:8000/resources/dpr.php?name=square100.png&mimeType=image/png&dpr=4.0">
6 <!-- fractional DPR -->
7 <img id=fractional
src=
"http://127.0.0.1:8000/resources/dpr.php?name=square100.png&mimeType=image/png&dpr=2.5">
8 <!-- DPR smaller than 1 -->
9 <img id=smaller
src=
"http://127.0.0.1:8000/resources/dpr.php?name=square100.png&mimeType=image/png&dpr=0.5">
10 <!-- DPR in srcset -->
11 <img id=srcset
srcset=
"http://127.0.0.1:8000/resources/square100.png 4x">
12 <!-- invalid DPR in header -->
13 <img id=invalid
src=
"http://127.0.0.1:8000/resources/dpr.php?name=square100.png&mimeType=image/png&dpr=xx">
14 <!-- combine header with srcset -->
15 <img id=
"srcset_dpr_invalid" srcset=
"http://127.0.0.1:8000/resources/dpr.php?name=square100.png&mimeType=image/png&dpr=xx 4x">
16 <img id=
"srcset_dpr" srcset=
"http://127.0.0.1:8000/resources/dpr.php?name=square100.png&mimeType=image/png&dpr=4.0 2x">
17 <!-- explicit width also given -->
18 <img id=width
src=
"http://127.0.0.1:8000/resources/dpr.php?name=square100.png&mimeType=image/png&dpr=4.0"
19 width=
"100" height=
"100">
20 <!-- explicit width also given -->
21 <img id=zero
src=
"http://127.0.0.1:8000/resources/dpr.php?name=square100.png&mimeType=image/png&dpr=0">
23 var verify = function(id
, size
) {
24 assert_equals(document
.getElementById(id
).naturalWidth
, size
);
25 assert_equals(document
.getElementById(id
).naturalHeight
, size
);
28 addEventListener("load", function() {
31 verify("fractional", 40);
32 verify("smaller", 200);
34 verify("invalid", 100);
35 verify("srcset_dpr_invalid", 25);
36 verify("srcset_dpr", 25);
39 }, "Test srcset and sizes with a meta viewport");