blob: 1f2709df46855074c2a9654a9003008ddd7c849d [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<script src="../../resources/js-test-pre.js"></script>
<script>
description("Tests that SVG animations are properly paused in iframes that are inserted into hidden pages.");
jsTestIsAsync = true;
document.addEventListener("visibilitychange", function() {
if (document.hidden) {
frame = document.createElement("iframe");
frame.onload = function() {
setTimeout(function() {
shouldBeTrue("frame.contentWindow.internals.areSVGAnimationsPaused");
shouldBeTrue("frame.contentDocument.getElementsByTagName('svg')[0].animationsPaused()");
grandChildFrame = frame.contentDocument.getElementById('grandChildFrame');
shouldBeTrue("grandChildFrame.contentWindow.internals.areSVGAnimationsPaused");
shouldBeTrue("grandChildFrame.contentDocument.getElementsByTagName('svg')[0].animationsPaused()");
debug("Setting page visibility to visible");
if (window.testRunner)
testRunner.setPageVisibility("visible");
}, 0);
}
frame.src = "resources/frame-with-svg-animation.html";
debug("Inserting frame in document");
document.body.appendChild(frame);
} else {
shouldBeFalse("frame.contentWindow.internals.areSVGAnimationsPaused");
shouldBeFalse("frame.contentDocument.getElementsByTagName('svg')[0].animationsPaused()");
grandChildFrame = frame.contentDocument.getElementById('grandChildFrame');
shouldBeFalse("grandChildFrame.contentWindow.internals.areSVGAnimationsPaused");
shouldBeFalse("grandChildFrame.contentDocument.getElementsByTagName('svg')[0].animationsPaused()");
finishJSTest();
}
});
window.onload = function() {
debug("Setting page visibility to hidden");
if (window.testRunner)
testRunner.setPageVisibility("hidden");
}
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>