blob: 83e162526bc1bebc55275e6b9cd07577b7b5517f [file] [edit]
<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true UsesBackForwardCache=true ModelElementEnabled=true ModelProcessEnabled=true allowTestOnlyIPC=true ] -->
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="../resources/js-test.js"></script>
<script src="../resources/basic-gestures.js"></script>
<script src="../resources/ui-helper.js"></script>
</head>
<script>
jsTestIsAsync = true;
testRunner.dumpAsText();
internals.disableModelLoadDelaysForTesting();
async function scroll() {
var startX = 50;
var startY = 250;
await touchAndDragFromPointToPoint(startX, startY, startX, startY - 100);
await liftUpAtPoint(startX, startY - 100);
}
window.addEventListener("pageshow", async (event) => {
if (!event.persisted)
return;
await UIHelper.clearEnsurePositionInformationIsUpToDateTracking();
await scroll();
var didCall = await UIHelper.didCallEnsurePositionInformationIsUpToDateSinceLastCheck();
if (didCall)
testPassed("ensurePositionInformationIsUpToDate was called after back/forward cache restore");
else
testFailed("ensurePositionInformationIsUpToDate was not called after back/forward cache restore; model element count was not restored");
finishJSTest();
});
addEventListener("load", async () => {
if (!window.testRunner)
return;
description("After restoring a page with a loaded model element from the back/forward cache, " +
"ensurePositionInformationIsUpToDate should still be called during scroll gestures.");
await document.getElementById("model").ready;
window.location.href = "resources/go-back-on-load.html";
});
</script>
<body>
<div id="scroller" style="height: 300px; overflow: scroll;">
<div style="height: 600px;"></div>
</div>
<model id="model">
<source src="resources/cube.usdz" />
</model>
<div id="console"></div>
</body>
</html>