Web Inspector: Canvas: lazily create the agent
[WebKit-https.git] / LayoutTests / imported / w3c / web-platform-tests / html / semantics / embedded-content / the-img-element / sizes / parse-a-sizes-attribute.html
1 <!doctype html>
2 <title>img parse a sizes attribute</title>
3 <meta name="timeout" content="long">
4 <script src="/resources/testharness.js"></script>
5 <script src="/resources/testharnessreport.js"></script>
6 <div id=log></div>
7 <iframe data-desc="standards mode" style="width:1000px; height:1000px" src="sizes-iframed.sub.html?doctype=doctype%20html&style="></iframe>
8 <iframe data-desc="quirks mode" style="width:1000px; height:1000px" src="sizes-iframed.sub.html?doctype=----&style="></iframe>
9 <iframe data-desc="display:none" style="width:1000px; height:1000px" src="sizes-iframed.sub.html?doctype=doctype%20html&style=display:none"></iframe>
10 <iframe data-desc="width:1000px" style="width:1000px; height:1000px" src="sizes-iframed.sub.html?doctype=doctype%20html&style=width:1000px%3B%20height:16px"></iframe>
11 <script>
12 setup({explicit_done:true});
13
14 function check(p, iframe) {
15   var current = p.firstElementChild;
16   var ref_sizes = current.getAttribute('sizes');
17   var expect = p.firstElementChild.currentSrc;
18   if (expect) {
19     expect = expect.split('?')[0];
20   }
21   while (current = current.nextElementSibling) {
22     test(function() {
23       if (expect === '' || expect === null || expect === undefined) {
24         assert_unreached('ref currentSrc was ' + format_value(expect));
25       }
26       var got = current.currentSrc;
27       assert_greater_than(got.indexOf('?'), -1, 'expected a "?" in currentSrc');
28       got = got.split('?')[0];
29       assert_equals(got, expect);
30     }, current.outerHTML + ' ref sizes=' + format_value(ref_sizes) + ' (' + iframe.getAttribute('data-desc') + ')');
31   }
32 }
33
34 onload = function() {
35   [].forEach.call(document.querySelectorAll('iframe'), function(iframe) {
36     [].forEach.call(iframe.contentDocument.querySelectorAll('p'), function(p) {
37       check(p, iframe);
38     });
39   });
40   done();
41 }
42 </script>