<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body onload="runTest()">
<script>
description("Test that animated images are properly stopped / resumed on window resizing.");
jsTestIsAsync = true;

var testWindow;

function isImagePaused()
{
  return internals.hasPausedImageAnimations(testWindow.document.getElementById("testImage"));
}

function enlargeWindow()
{
  debug("Resize window so that the image is now inside the viewport.");
  testWindow.resizeTo(500, 500);
  shouldBecomeEqual("isImagePaused()", "false", finishJSTest);
}

function windowLoaded()
{
  debug("The animated GIF should initially be outside the viewport.");
  shouldBecomeEqual("isImagePaused()", "true", enlargeWindow);
}

function runTest()
{
  testWindow = window.open("resources/animated-gif-window-resize.html", "testWindow", "width=200, height=200");
  testWindow.onload = windowLoaded;
}

</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
