Index: LayoutTests/web-animations-api/w3c/resources/keyframes-test.js |
diff --git a/LayoutTests/web-animations-api/w3c/resources/keyframes-test.js b/LayoutTests/web-animations-api/w3c/resources/keyframes-test.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3915b35c659adfea2813432ced855133c377bad6 |
--- /dev/null |
+++ b/LayoutTests/web-animations-api/w3c/resources/keyframes-test.js |
@@ -0,0 +1,32 @@ |
+(function(){ |
+'use strict' |
+ |
+function createElement() { |
+ var element = document.createElement('div'); |
+ document.documentElement.appendChild(element); |
+ return element; |
+} |
+ |
+function heldTiming(iterationStart) { |
+ return { |
+ duration: 1000, |
+ playbackRate: 0, |
+ fill: 'forwards', |
+ iterationStart: iterationStart, |
+ }; |
+} |
+ |
+function assertAnimationStyles(keyframes, expectations) { |
+ for (var progress in expectations) { |
+ var element = createElement(); |
+ element.animate(keyframes, heldTiming(progress)); |
+ var computedStyle = getComputedStyle(element); |
+ for (var property in expectations[progress]) { |
+ assert_equals(computedStyle[property], expectations[progress][property], |
+ property + ' at ' + (progress * 100) + '%'); |
+ } |
+ } |
+} |
+ |
+window.assertAnimationStyles = assertAnimationStyles; |
+})(); |