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 |
index 3915b35c659adfea2813432ced855133c377bad6..e3fc3c78561ea6bced62ae042c886a9bd3cefb8a 100644 |
--- a/LayoutTests/web-animations-api/w3c/resources/keyframes-test.js |
+++ b/LayoutTests/web-animations-api/w3c/resources/keyframes-test.js |
@@ -7,26 +7,38 @@ function createElement() { |
return element; |
} |
-function heldTiming(iterationStart) { |
+function heldTiming(progress) { |
return { |
duration: 1000, |
- playbackRate: 0, |
fill: 'forwards', |
- iterationStart: iterationStart, |
+ delay: -progress * 1000, |
}; |
} |
-function assertAnimationStyles(keyframes, expectations) { |
+function assertAnimationStyles(keyframes, expectations, description) { |
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) + '%'); |
+ property + ' at ' + (progress * 100) + '%' + (description ? ' ' + description : '')); |
} |
} |
} |
+// Currently our animation timeline is not stable during page load script execution. |
+// By deferring the tests to requestAnimationFrame() we can get a stable timeline and |
+// avoid flaky test results. |
shans
2014/04/30 11:46:27
Considering that we want these to be w3c tests eve
alancutter (OOO until 2018)
2014/05/01 00:05:13
It's not clear how soon the unstable animation tim
|
+function testInRAF(testFunction, description, properties) { |
+ async_test(function(testHandle) { |
+ requestAnimationFrame(function() { |
+ testHandle.step(testFunction); |
+ testHandle.done(); |
+ }) |
+ }, description, properties); |
+} |
+ |
window.assertAnimationStyles = assertAnimationStyles; |
+window.testInRAF = testInRAF; |
})(); |