OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <meta charset="utf-8"> |
| 5 <title>fullscreenEnabled test</title> |
| 6 <script src="../resources/testharness.js"></script> |
| 7 <script src="../resources/testharnessreport.js"></script> |
| 8 </head> |
| 9 <body> |
| 10 <p>HTMLVideoElement.webkitEnterFullScreen() in a cross-origin iframe requires th
e allowfullscreen attribute</p> |
| 11 <script src="resources/media-file.js"></script> |
| 12 <iframe name="cross-origin-default" src="http://localhost:8000/fullscreen/resour
ces/legacy.html" width="336" height="256"> |
| 13 </iframe> |
| 14 <iframe name="cross-origin-allowfullscreen" allowfullscreen src="http://localhos
t:8000/fullscreen/resources/legacy.html" width="336" height="256"> |
| 15 </iframe> |
| 16 <script> |
| 17 var expectations = { |
| 18 "cross-origin-default": [false, false], |
| 19 "cross-origin-allowfullscreen": [true, true], |
| 20 }; |
| 21 |
| 22 async_test((t) => { |
| 23 // When a message is received from a child frame, ensure that the report |
| 24 // matches the expectations. |
| 25 window.addEventListener('message', (e) => { |
| 26 if (e.data.report && e.data.report.api == "fullscreen") { |
| 27 if (e.data.report.frame in expectations) { |
| 28 t.step(() => { |
| 29 expectations[e.data.report.frame].forEach((elem, index) => { |
| 30 assert_equals(e.data.report.enabled[index], elem, |
| 31 e.data.report.frame + " frame webkitDisplayingFullscreen result "
+ index); |
| 32 }); |
| 33 }); |
| 34 delete expectations[e.data.report.frame]; |
| 35 // When all child frames have reported, the test is complete. |
| 36 if (Object.keys(expectations).length == 0) |
| 37 t.done(); |
| 38 } |
| 39 } |
| 40 }); |
| 41 |
| 42 // Trigger the child frames to report as soon as their content is loaded. |
| 43 var videoSrc = findMediaFile("video", "/media-resources/content/test"); |
| 44 document.querySelectorAll('iframe').forEach((elem) => { |
| 45 elem.addEventListener('load', () => { |
| 46 elem.contentWindow.postMessage({"action": "report", "frame": elem.name, |
| 47 "videoSrc": videoSrc}, "*"); |
| 48 }); |
| 49 }); |
| 50 }); |
| 51 </script> |
| 52 </body> |
| 53 </html> |
OLD | NEW |