Index: third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/document-fullscreen-enabled-cross-origin.sub.html |
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/document-fullscreen-enabled-cross-origin.sub.html b/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/document-fullscreen-enabled-cross-origin.sub.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2e9f9dcf3d353d24b267c9dc1d087ea84d4d8830 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/document-fullscreen-enabled-cross-origin.sub.html |
@@ -0,0 +1,46 @@ |
+<!DOCTYPE html> |
+<title>Document#fullscreenEnabled</title> |
+<script src="/resources/testharness.js"></script> |
+<script src="/resources/testharnessreport.js"></script> |
+<div id="log"></div> |
+<!-- iframe src="resources/report-full-screen-enabled.html" name="same-origin-default"></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.
|
+<iframe src="resources/report-full-screen-enabled.html" allowfullscreen name="same-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.
|
+<iframe src="http://{{domains[www1]}}:{{ports[http][0]}}/fullscreen/api/resources/report-full-screen-enabled.html" name="cross-origin-default"></iframe> |
+<iframe src="http://{{domains[www1]}}:{{ports[http][0]}}/fullscreen/api/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(() => { |
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 :)
|
+ 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> |