blob: 8a5997f7c79b7e669260001a939986665515c797 [file] [log] [blame]
<!DOCTYPE html>
<script src='../resources/testharness.js'></script>
<script src='../resources/testharnessreport.js'></script>
<script src='resources/shadow-dom.js'></script>
<script src='../fullscreen/trusted-event.js'></script>
<div id='host0'>
<template data-mode='open'>
<canvas></canvas>
</template>
</div>
<script>
convertTemplatesToShadowRootsWithin(host0);
async_test((test) => {
document.onfullscreenerror = test.unreached_func('onfullscreenerror is not expected.');
// All fullscreenElement should default to null.
assert_equals(document.fullscreenElement, null);
assert_equals(document.webkitFullscreenElement, null);
assert_equals(document.webkitCurrentFullScreenElement, null);
assert_equals(host0.shadowRoot.fullscreenElement, null);
var canvas = host0.shadowRoot.querySelector('canvas');
trusted_request(canvas);
document.onfullscreenchange = test.step_func(() => {
// Not interested in handling before or after exitFullscreen.
if (document.fullscreenElement === null)
return;
assert_equals(document.fullscreenElement, host0);
assert_equals(document.webkitFullscreenElement, host0);
assert_equals(document.webkitCurrentFullScreenElement, host0);
assert_equals(host0.shadowRoot.fullscreenElement, canvas);
// TODO(kochi): The 'retargeting' behavior is controlled by
// 'FullscreenUnprefixed' runtime flag dynamically. Until the
// flag is turned on, document.webkitFullscreenElement leaks the
// fullscreen element under shadow roots.
window.internals.runtimeFlags.fullscreenUnprefixedEnabled = false;
assert_false(window.internals.runtimeFlags.fullscreenUnprefixedEnabled);
assert_equals(document.webkitFullscreenElement, canvas);
assert_equals(document.webkitCurrentFullScreenElement, canvas);
document.exitFullscreen();
test.done();
});
}, 'Test for fullscreenElement adjustment for single shadow tree.');
</script>