<!DOCTYPE html>
<html>
<body>
<script src="../../resources/js-test-pre.js"></script>
<script>
description("Tests that animated SVG images are properly paused when the page is no longer visible");
jsTestIsAsync = true;

function makePageVisible()
{
    debug("Setting page visibility to visible");
    if (window.testRunner)
        testRunner.setPageVisibility('visible');
    shouldBecomeEqual("internals.isImageAnimating(testImage)", "true", finishJSTest);
}

window.onload = function() {
    testImage = document.getElementById("testImage");
    shouldBeTrue("internals.isImageAnimating(testImage)");

    debug("Setting page visibility to hidden");
    if (window.testRunner)
        testRunner.setPageVisibility('hidden');

    shouldBecomeEqual("internals.isImageAnimating(testImage)", "false", makePageVisible);
}
</script>
<img id="testImage" src="resources/smilAnimation.svg">
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
