Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <title>Element ready check with enabled flag not set</title> | |
| 3 <script src="/resources/testharness.js"></script> | |
| 4 <script src="/resources/testharnessreport.js"></script> | |
| 5 <script src="../trusted-click.js"></script> | |
| 6 <div id="log"></div> | |
| 7 <iframe src="http://{{domains[www1]}}:{{ports[http][0]}}/fullscreen/api/resource s/attempt-full-screen.html" name="cross-origin-default"></iframe> | |
| 8 <script> | |
| 9 // Fullscreen is enabled in same-origin frames regardless of allowfullscreen, | |
| 10 // but must be explicitly enabled in cross-origin frames. | |
| 11 // Expectation have the format: | |
| 12 // "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.
| |
| 13 var expectations = { | |
| 14 "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
| |
| 15 }; | |
| 16 | |
| 17 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
| |
| 18 assert_equals(expected.length, actual.length, prefix + " result length mismatc h"); | |
| 19 for (var i = 0; i < expected.length; ++i) { | |
| 20 assert_equals(expected[i], actual[i], prefix + " result index " + i); | |
| 21 } | |
| 22 }; | |
| 23 | |
| 24 async_test((t) => { | |
| 25 document.onfullscreenchange = t.unreached_func("document fullscreenchange even t"); | |
| 26 document.onfullscreenerror = t.unreached_func("document fullscreenerror event" ); | |
| 27 | |
| 28 // When a message is received from a child frame, ensure that the report | |
| 29 // matches the expectations. | |
| 30 window.addEventListener('message', (e) => { | |
| 31 if (e.data.report && e.data.report.api == "fullscreen") { | |
| 32 if (e.data.report.frame in expectations) { | |
| 33 t.step(() => { | |
| 34 assert_array_equals(e.data.report.result, | |
| 35 expectations[e.data.report.frame], e.data.report.frame); | |
| 36 }); | |
| 37 delete expectations[e.data.report.frame]; | |
| 38 // When all child frames have reported, the test is complete. | |
| 39 if (Object.keys(expectations).length == 0) | |
| 40 t.done(); | |
| 41 } | |
| 42 } | |
| 43 }); | |
| 44 | |
| 45 // Trigger the child frames to report as soon as their content is loaded. | |
| 46 document.querySelectorAll('iframe').forEach((elem) => { | |
| 47 elem.addEventListener('load', () => { | |
| 48 trusted_click(t, () => { | |
| 49 elem.contentWindow.postMessage({"action": "report", "frame": elem.name}, "*"); | |
| 50 }, document.body); | |
| 51 }); | |
| 52 }); | |
| 53 }); | |
| 54 </script> | |
| OLD | NEW |