Index: third_party/WebKit/LayoutTests/http/tests/fullscreen/full-screen-enabled.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/fullscreen/full-screen-enabled.html b/third_party/WebKit/LayoutTests/http/tests/fullscreen/full-screen-enabled.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7ace77e1b903e75142c3da18bf2bf9de7291c957 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/http/tests/fullscreen/full-screen-enabled.html |
@@ -0,0 +1,54 @@ |
+<!DOCTYPE html> |
+<html> |
+ <head> |
+ <meta charset="utf-8"> |
+ <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.
|
+ <script src="../resources/testharness.js"></script> |
+ <script src="../resources/testharnessreport.js"></script> |
+ </head> |
+ <body> |
+ <div>This tests the <code>fullscreenEnabled</code> property laid out in section 4 of the W3C |
+ <a href="http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html">Full Screen API</a></div> |
+ <iframe src="resources/report-full-screen-enabled.html" name="same-origin-default"></iframe> |
+ <iframe src="resources/report-full-screen-enabled.html" allowfullscreen name="same-origin-allow"></iframe> |
+ <iframe src="http://localhost:8000/fullscreen/resources/report-full-screen-enabled.html" name="cross-origin-default"></iframe> |
+ <iframe src="http://localhost:8000/fullscreen/resources/report-full-screen-enabled.html" allowfullscreen name="cross-origin-allow"></iframe> |
+ <script> |
+// Fullscreen is enabled in same-origin frames regardless of allowfullscreen, |
+// but must be explicitly enabled in cross-origin frames. |
+var expectations = { |
+ "same-origin-default": true, |
+ "same-origin-allow": true, |
+ "cross-origin-default": false, |
+ "cross-origin-allow": true |
+}; |
+ |
+async_test((t) => { |
+ // When a message is received from a child frame, ensure that the report |
+ // matches the expectations. |
+ window.addEventListener('message', (e) => { |
+ if (e.data.report && e.data.report.api == "fullscreen") { |
+ if (e.data.report.frame in expectations) { |
+ t.step(() => { |
+ assert_equals(e.data.report.enabled, |
+ expectations[e.data.report.frame], |
+ e.data.report.frame + " frame webkitFullscreenEnabled"); }); |
+ delete expectations[e.data.report.frame]; |
+ // When all child frames have reported, the test is complete. |
+ if (Object.keys(expectations).length == 0) |
+ t.done(); |
+ } |
+ } |
+ }); |
+ |
+ // Trigger the child frames to report as soon as their content is loaded. |
+ document.querySelectorAll('iframe').forEach((elem) => { |
+ elem.addEventListener('load', () => { |
+ elem.contentWindow.postMessage({"action": "report", "frame": elem.name}, |
+ "*"); |
+ }); |
+ }); |
+}); |
+ </script> |
+ </body> |
+</html> |