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

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

Issue 253963002: Web Animations API: Add layout tests for element.animate() keyframes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: More keyframe tests 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
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;
})();

Powered by Google App Engine
This is Rietveld 408576698