OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <title>Document#fullscreenEnabled</title> | |
3 <script src="/resources/testharness.js"></script> | |
4 <script src="/resources/testharnessreport.js"></script> | |
5 <div id="log"></div> | |
6 <!-- iframe src="resources/report-full-screen-enabled.html" name="same-origin-de fault"></iframe --> | |
foolip
2017/08/15 09:44:22
Why is this test excluded? If it's because it woul
iclelland
2017/08/16 13:31:55
I commented it because I thought the idea was that
foolip
2017/08/16 21:43:14
Right, the tests should match what the spec curren
iclelland
2017/08/17 20:01:56
Done.
| |
7 <iframe src="resources/report-full-screen-enabled.html" allowfullscreen name="sa me-origin-allow"></iframe> | |
foolip
2017/08/15 09:44:22
s/full-screen/fullscreen/ in these file names, htt
iclelland
2017/08/16 13:31:55
Done.
| |
8 <iframe src="http://{{domains[www1]}}:{{ports[http][0]}}/fullscreen/api/resource s/report-full-screen-enabled.html" name="cross-origin-default"></iframe> | |
9 <iframe src="http://{{domains[www1]}}:{{ports[http][0]}}/fullscreen/api/resource s/report-full-screen-enabled.html" allowfullscreen name="cross-origin-allow"></i frame> | |
10 <script> | |
11 // Fullscreen is enabled in same-origin frames regardless of allowfullscreen, | |
12 // but must be explicitly enabled in cross-origin frames. | |
13 var expectations = { | |
14 // "same-origin-default": true, | |
15 "same-origin-allow": true, | |
16 "cross-origin-default": false, | |
17 "cross-origin-allow": true | |
18 }; | |
19 | |
20 async_test((t) => { | |
21 // When a message is received from a child frame, ensure that the report | |
22 // matches the expectations. | |
23 window.addEventListener('message', (e) => { | |
24 if (e.data.report && e.data.report.api == "fullscreen") { | |
25 if (e.data.report.frame in expectations) { | |
26 t.step(() => { | |
foolip
2017/08/15 09:44:22
Rather than just wrapping the asserts, can you t.s
iclelland
2017/08/16 13:31:55
Yes, yes it turns out I can. Thanks :)
| |
27 assert_equals(e.data.report.enabled, | |
28 expectations[e.data.report.frame], | |
29 e.data.report.frame + " frame webkitFullscreenEnabled"); }); | |
30 delete expectations[e.data.report.frame]; | |
31 // When all child frames have reported, the test is complete. | |
32 if (Object.keys(expectations).length == 0) | |
33 t.done(); | |
34 } | |
35 } | |
36 }); | |
37 | |
38 // Trigger the child frames to report as soon as their content is loaded. | |
39 document.querySelectorAll('iframe').forEach((elem) => { | |
40 elem.addEventListener('load', () => { | |
41 elem.contentWindow.postMessage({"action": "report", "frame": elem.name}, | |
42 "*"); | |
43 }); | |
44 }); | |
45 }); | |
46 </script> | |
OLD | NEW |