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

Unified Diff: third_party/WebKit/LayoutTests/animations/responsive/resources/responsive-test.js

Issue 1444233002: Change responsive-test.js neutral keyframe format (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_responsiveHarnessWebAnimations
Patch Set: ebased Created 5 years, 1 month 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
« no previous file with comments | « third_party/WebKit/LayoutTests/animations/responsive/line-height-responsive.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/animations/responsive/resources/responsive-test.js
diff --git a/third_party/WebKit/LayoutTests/animations/responsive/resources/responsive-test.js b/third_party/WebKit/LayoutTests/animations/responsive/resources/responsive-test.js
index 9cd7881494811f3aeed06411aa51a434381ea946..e32eefd6ae4fec6bad2873447ba42be09521e687 100644
--- a/third_party/WebKit/LayoutTests/animations/responsive/resources/responsive-test.js
+++ b/third_party/WebKit/LayoutTests/animations/responsive/resources/responsive-test.js
@@ -9,8 +9,8 @@ assertResponsive
Call signature:
assertResponsive({
property: <CSS Property>,
- from: ?<CSS Value>,
- to: ?<CSS Value>,
+ ?from: <CSS Value>,
+ ?to: <CSS Value>,
configurations: [{
state: {
?underlying: <CSS Value>,
@@ -90,11 +90,25 @@ function setState(targets, property, state) {
}
}
-function createKeyframes(property, from, to) {
- return [
- {[property]: from},
- {[property]: to},
- ];
+function keyframeText(options, keyframeName) {
+ return (keyframeName in options) ? `[${options[keyframeName]}]` : 'neutral';
+}
+
+function createKeyframes(options) {
+ var keyframes = [];
+ if ('from' in options) {
+ keyframes.push({
+ offset: 0,
+ [options.property]: options.from,
+ });
+ }
+ if ('to' in options) {
+ keyframes.push({
+ offset: 1,
+ [options.property]: options.to,
+ });
+ }
+ return keyframes;
}
function startPausedAnimations(targets, keyframes, fractions) {
@@ -115,7 +129,9 @@ function runPendingResponsiveTests() {
var property = options.property;
var from = options.from;
var to = options.to;
- var keyframes = createKeyframes(property, from, to);
+ var keyframes = createKeyframes(options);
+ var fromText = keyframeText(options, 'from');
+ var toText = keyframeText(options, 'to');
var stateTransitions = createStateTransitions(options.configurations);
stateTransitions.forEach(function(stateTransition) {
@@ -137,7 +153,7 @@ function runPendingResponsiveTests() {
var actual = getComputedStyle(target)[property];
test(function() {
assert_equals(actual, expectation.is);
- }, `Animation on property <${property}> from [${from}] to [${to}] with ${JSON.stringify(before.state)} changed to ${JSON.stringify(after.state)} at (${expectation.at}) is [${expectation.is}]`);
+ }, `Animation on property <${property}> from ${fromText} to ${toText} with ${JSON.stringify(before.state)} changed to ${JSON.stringify(after.state)} at (${expectation.at}) is [${expectation.is}]`);
}
},
});
« no previous file with comments | « third_party/WebKit/LayoutTests/animations/responsive/line-height-responsive.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698