1(function(){
2'use strict'
3
4function createElement() {
5  var element = document.createElement('div');
6  element.style.position = 'absolute';
7  document.documentElement.appendChild(element);
8  return element;
9}
10
11function heldTiming(progress) {
12  return {
13    duration: 1000,
14    fill: 'forwards',
15    delay: -progress * 1000,
16  };
17}
18
19function assertAnimationStyles(keyframes, expectations, description) {
20  for (var progress in expectations) {
21    var element = createElement();
22    element.animate(keyframes, heldTiming(progress));
23
24    var computedStyle = getComputedStyle(element);
25    for (var property in expectations[progress]) {
26      assert_equals(computedStyle[property], expectations[progress][property],
27          property + ' at ' + (progress * 100) + '%' + (description ? ' ' + description : ''));
28    }
29  }
30}
31
32window.assertAnimationStyles = assertAnimationStyles;
33})();
34