<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body style="background-image: url('resources/animated.gif'); background-repeat: repeat; height: 100%; width: 100%;" onload="runTest()">
<script>
// The test passes if the background image is animated.
jsTestIsAsync = true;

function checkBackgroundAnimated() {
  isBackgroundAnimated = !internals.hasPausedImageAnimations(document.body);
  bodyHeight = window.getComputedStyle(document.body)["height"];
  description("Make sure the background image of the body element is animated if the body has 0 height and the background is delegated to the root");
  shouldBeEqualToString("bodyHeight", "0px");
  shouldBeTrue("isBackgroundAnimated");
  finishJSTest();
}

function imageLoaded() {
  setTimeout(checkBackgroundAnimated, 200);
}

function runTest() {
  if (!window.internals)
    return;

  var img = new Image();
  // Make sure the image is loaded before we check if it is animated.
  img.onload = imageLoaded;
  img.src = "resources/animated.gif";
}
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
