44 lines
1.3 KiB
HTML
44 lines
1.3 KiB
HTML
<!-- webkit-test-runner [ UsesBackForwardCache=true ] -->
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<body>
|
|
<script src="../../resources/js-test.js"></script>
|
|
<script>
|
|
description('Tests that a page with a running AudioContext goes into the back/forward cache.');
|
|
window.jsTestIsAsync = true;
|
|
|
|
window.addEventListener("pageshow", function(event) {
|
|
debug("pageshow - " + (event.persisted ? "" : "not ") + "from cache");
|
|
|
|
if (event.persisted) {
|
|
testPassed("Page did enter and was restored from the back/forward cache");
|
|
finishJSTest();
|
|
}
|
|
}, false);
|
|
|
|
window.addEventListener("pagehide", function(event) {
|
|
debug("pagehide - " + (event.persisted ? "" : "not ") + "entering cache");
|
|
if (!event.persisted) {
|
|
testFailed("Page failed to enter the back/forward cache.");
|
|
finishJSTest();
|
|
}
|
|
}, false);
|
|
|
|
window.addEventListener('load', function() {
|
|
audioContext = new AudioContext();
|
|
|
|
oscillator = audioContext.createOscillator();
|
|
oscillator.frequency.value = 300;
|
|
oscillator.type = 0;
|
|
oscillator.connect(audioContext.destination);
|
|
oscillator.start(0);
|
|
|
|
setTimeout(function() {
|
|
// Force a back navigation back to this page.
|
|
window.location.href = "resources/page-cache-helper.html";
|
|
}, 0);
|
|
}, false);
|
|
</script>
|
|
</body>
|
|
</html>
|