Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/element-ready-check-enabled-flag-not-set-cross-origin-manual.sub.html |
| diff --git a/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/element-ready-check-enabled-flag-not-set-cross-origin-manual.sub.html b/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/element-ready-check-enabled-flag-not-set-cross-origin-manual.sub.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7eb7cc654589d447dd1d7686cfb890474e488ca8 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/element-ready-check-enabled-flag-not-set-cross-origin-manual.sub.html |
| @@ -0,0 +1,54 @@ |
| +<!DOCTYPE html> |
| +<title>Element ready check with enabled flag not set</title> |
| +<script src="/resources/testharness.js"></script> |
| +<script src="/resources/testharnessreport.js"></script> |
| +<script src="../trusted-click.js"></script> |
| +<div id="log"></div> |
| +<iframe src="http://{{domains[www1]}}:{{ports[http][0]}}/fullscreen/api/resources/attempt-full-screen.html" name="cross-origin-default"></iframe> |
| +<script> |
| +// Fullscreen is enabled in same-origin frames regardless of allowfullscreen, |
| +// but must be explicitly enabled in cross-origin frames. |
| +// Expectation have the format: |
| +// "Frame name": [fullscreen-enabled-flag, did-enter-fullscreen] |
|
foolip
2017/08/15 09:44:22
The fullscreenEnabled check in the original test w
iclelland
2017/08/16 13:31:55
Removed. Now just checks did-enter-fullscreen.
|
| +var expectations = { |
| + "cross-origin-default": [false, false], |
|
foolip
2017/08/15 09:44:22
Can you either put the two tests in one file, or s
iclelland
2017/08/16 13:31:55
I'm not 100% certain what you mean by this, but I'
foolip
2017/08/16 21:43:14
Words are hard, sorry. I was wondering if a single
|
| +}; |
| + |
| +assert_array_equals = (expected, actual, prefix) => { |
|
foolip
2017/08/15 09:44:22
The assert_array_equals in testharness.js does abo
iclelland
2017/08/16 13:31:55
None. Not sure why I couldn't see it there. Unneed
|
| + assert_equals(expected.length, actual.length, prefix + " result length mismatch"); |
| + for (var i = 0; i < expected.length; ++i) { |
| + assert_equals(expected[i], actual[i], prefix + " result index " + i); |
| + } |
| +}; |
| + |
| +async_test((t) => { |
| + document.onfullscreenchange = t.unreached_func("document fullscreenchange event"); |
| + document.onfullscreenerror = t.unreached_func("document fullscreenerror event"); |
| + |
| + // 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_array_equals(e.data.report.result, |
| + expectations[e.data.report.frame], e.data.report.frame); |
| + }); |
| + 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', () => { |
| + trusted_click(t, () => { |
| + elem.contentWindow.postMessage({"action": "report", "frame": elem.name}, "*"); |
| + }, document.body); |
| + }); |
| + }); |
| +}); |
| +</script> |