Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Unified Diff: LayoutTests/web-animations-api/w3c/resources/keyframes-test.js

Issue 252113002: Web Animations API: Add simple keyframe tests (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Renames Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
+})();

Powered by Google App Engine
This is Rietveld 408576698