OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <html> | |
3 <head> | |
4 <meta charset="utf-8"> | |
5 <title>fullscreenEnabled test</title> | |
foolip
2017/08/15 09:44:23
These duplicated tests aren't necessary IMHO, the
iclelland
2017/08/16 13:31:56
Removed. The unprefixed tests remain in /external/
foolip
2017/08/16 21:43:14
I didn't look super hard, but I suspect getting ri
iclelland
2017/08/17 20:01:56
Done.
| |
6 <script src="../resources/testharness.js"></script> | |
7 <script src="../resources/testharnessreport.js"></script> | |
8 </head> | |
9 <body> | |
10 <div>This tests the <code>fullscreenEnabled</code> property laid out in sect ion 4 of the W3C | |
11 <a href="http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html">Full Screen API</a></div> | |
12 <iframe src="resources/report-full-screen-enabled.html" name="same-origin- default"></iframe> | |
13 <iframe src="resources/report-full-screen-enabled.html" allowfullscreen na me="same-origin-allow"></iframe> | |
14 <iframe src="http://localhost:8000/fullscreen/resources/report-full-screen -enabled.html" name="cross-origin-default"></iframe> | |
15 <iframe src="http://localhost:8000/fullscreen/resources/report-full-screen -enabled.html" allowfullscreen name="cross-origin-allow"></iframe> | |
16 <script> | |
17 // Fullscreen is enabled in same-origin frames regardless of allowfullscreen, | |
18 // but must be explicitly enabled in cross-origin frames. | |
19 var expectations = { | |
20 "same-origin-default": true, | |
21 "same-origin-allow": true, | |
22 "cross-origin-default": false, | |
23 "cross-origin-allow": true | |
24 }; | |
25 | |
26 async_test((t) => { | |
27 // When a message is received from a child frame, ensure that the report | |
28 // matches the expectations. | |
29 window.addEventListener('message', (e) => { | |
30 if (e.data.report && e.data.report.api == "fullscreen") { | |
31 if (e.data.report.frame in expectations) { | |
32 t.step(() => { | |
33 assert_equals(e.data.report.enabled, | |
34 expectations[e.data.report.frame], | |
35 e.data.report.frame + " frame webkitFullscreenEnabled"); }); | |
36 delete expectations[e.data.report.frame]; | |
37 // When all child frames have reported, the test is complete. | |
38 if (Object.keys(expectations).length == 0) | |
39 t.done(); | |
40 } | |
41 } | |
42 }); | |
43 | |
44 // Trigger the child frames to report as soon as their content is loaded. | |
45 document.querySelectorAll('iframe').forEach((elem) => { | |
46 elem.addEventListener('load', () => { | |
47 elem.contentWindow.postMessage({"action": "report", "frame": elem.name}, | |
48 "*"); | |
49 }); | |
50 }); | |
51 }); | |
52 </script> | |
53 </body> | |
54 </html> | |
OLD | NEW |