blob: bc4e63ad85cf2abbbcd94ab64c1fd0c9e76d57bf [file] [log] [blame]
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../../../Source/WebCore/Modules/modern-media-controls/controls/scheduler.js" type="text/javascript"></script>
<script src="../resources/media-controls-utils.js" type="text/javascript"></script>
<script type="text/javascript">
description("This test checks that calling `scheduleLayout()` during a layout callback delays that callback until the next frame.");
window.jsTestIsAsync = true;
if (window.testRunner)
window.testRunner.dumpAsText();
let numberOfFrames = 0;
scheduler.frameWillFire = function()
{
debug(`Frame #${numberOfFrames} will fire`);
}
scheduler.frameDidFire = function()
{
debug(`Frame #${numberOfFrames} fired`);
numberOfFrames++;
if (numberOfFrames === 2)
finishMediaControlsTest();
};
function layout()
{
debug(`layout() was called`);
if (numberOfFrames !== 0)
return;
// This layout should not be performed right away but delayed until the
// next frame since scheduleLayout() is not reentrant.
debug(`scheduler.scheduleLayout(layout)`);
scheduler.scheduleLayout(layout);
}
debug(`scheduler.scheduleLayout(layout)`);
scheduler.scheduleLayout(layout);
</script>
<script src="../../../resources/js-test-post.js"></script>