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

Unified Diff: cc/animation/layer_animation_controller_unittest.cc

Issue 719453007: Make Keyframe use TimeTicks/TimeDelta to represent time instead of double. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 | « cc/animation/layer_animation_controller.cc ('k') | cc/animation/scroll_offset_animation_curve.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/animation/layer_animation_controller_unittest.cc
diff --git a/cc/animation/layer_animation_controller_unittest.cc b/cc/animation/layer_animation_controller_unittest.cc
index 4fa3d848f3d20d35ef09a41ccfa3b5579a170b77..464a973704e6db4fac9e0d38578dfea94e02b3ea 100644
--- a/cc/animation/layer_animation_controller_unittest.cc
+++ b/cc/animation/layer_animation_controller_unittest.cc
@@ -510,9 +510,11 @@ TEST(LayerAnimationControllerTest, TrivialTransformOnImpl) {
// Create simple Transform animation.
TransformOperations operations;
- curve->AddKeyframe(TransformKeyframe::Create(0, operations, nullptr));
+ curve->AddKeyframe(
+ TransformKeyframe::Create(base::TimeDelta(), operations, nullptr));
operations.AppendTranslate(delta_x, delta_y, 0);
- curve->AddKeyframe(TransformKeyframe::Create(1, operations, nullptr));
+ curve->AddKeyframe(TransformKeyframe::Create(
+ base::TimeDelta::FromSecondsD(1.0), operations, nullptr));
scoped_ptr<Animation> animation(
Animation::Create(curve.Pass(), 1, 0, Animation::Transform));
@@ -559,10 +561,12 @@ TEST(LayerAnimationControllerTest, FilterTransition) {
FilterOperations start_filters;
start_filters.Append(FilterOperation::CreateBrightnessFilter(1.f));
- curve->AddKeyframe(FilterKeyframe::Create(0, start_filters, nullptr));
+ curve->AddKeyframe(
+ FilterKeyframe::Create(base::TimeDelta(), start_filters, nullptr));
FilterOperations end_filters;
end_filters.Append(FilterOperation::CreateBrightnessFilter(2.f));
- curve->AddKeyframe(FilterKeyframe::Create(1, end_filters, nullptr));
+ curve->AddKeyframe(FilterKeyframe::Create(base::TimeDelta::FromSecondsD(1.0),
+ end_filters, nullptr));
scoped_ptr<Animation> animation(
Animation::Create(curve.Pass(), 1, 0, Animation::Filter));
@@ -606,10 +610,12 @@ TEST(LayerAnimationControllerTest, FilterTransitionOnImplOnly) {
// Create simple Filter animation.
FilterOperations start_filters;
start_filters.Append(FilterOperation::CreateBrightnessFilter(1.f));
- curve->AddKeyframe(FilterKeyframe::Create(0, start_filters, nullptr));
+ curve->AddKeyframe(
+ FilterKeyframe::Create(base::TimeDelta(), start_filters, nullptr));
FilterOperations end_filters;
end_filters.Append(FilterOperation::CreateBrightnessFilter(2.f));
- curve->AddKeyframe(FilterKeyframe::Create(1, end_filters, nullptr));
+ curve->AddKeyframe(FilterKeyframe::Create(base::TimeDelta::FromSecondsD(1.0),
+ end_filters, nullptr));
scoped_ptr<Animation> animation(
Animation::Create(curve.Pass(), 1, 0, Animation::Filter));
@@ -1465,9 +1471,11 @@ TEST(LayerAnimationControllerTest, TransformAnimationBounds) {
KeyframedTransformAnimationCurve::Create());
TransformOperations operations1;
- curve1->AddKeyframe(TransformKeyframe::Create(0.0, operations1, nullptr));
+ curve1->AddKeyframe(
+ TransformKeyframe::Create(base::TimeDelta(), operations1, nullptr));
operations1.AppendTranslate(10.0, 15.0, 0.0);
- curve1->AddKeyframe(TransformKeyframe::Create(1.0, operations1, nullptr));
+ curve1->AddKeyframe(TransformKeyframe::Create(
+ base::TimeDelta::FromSecondsD(1.0), operations1, nullptr));
scoped_ptr<Animation> animation(
Animation::Create(curve1.Pass(), 1, 1, Animation::Transform));
@@ -1477,9 +1485,11 @@ TEST(LayerAnimationControllerTest, TransformAnimationBounds) {
KeyframedTransformAnimationCurve::Create());
TransformOperations operations2;
- curve2->AddKeyframe(TransformKeyframe::Create(0.0, operations2, nullptr));
+ curve2->AddKeyframe(
+ TransformKeyframe::Create(base::TimeDelta(), operations2, nullptr));
operations2.AppendScale(2.0, 3.0, 4.0);
- curve2->AddKeyframe(TransformKeyframe::Create(1.0, operations2, nullptr));
+ curve2->AddKeyframe(TransformKeyframe::Create(
+ base::TimeDelta::FromSecondsD(1.0), operations2, nullptr));
animation = Animation::Create(curve2.Pass(), 2, 2, Animation::Transform);
controller_impl->AddAnimation(animation.Pass());
@@ -1511,9 +1521,11 @@ TEST(LayerAnimationControllerTest, TransformAnimationBounds) {
TransformOperations operations3;
gfx::Transform transform3;
transform3.Scale3d(1.0, 2.0, 3.0);
- curve3->AddKeyframe(TransformKeyframe::Create(0.0, operations3, nullptr));
+ curve3->AddKeyframe(
+ TransformKeyframe::Create(base::TimeDelta(), operations3, nullptr));
operations3.AppendMatrix(transform3);
- curve3->AddKeyframe(TransformKeyframe::Create(1.0, operations3, nullptr));
+ curve3->AddKeyframe(TransformKeyframe::Create(
+ base::TimeDelta::FromSecondsD(1.0), operations3, nullptr));
animation = Animation::Create(curve3.Pass(), 3, 3, Animation::Transform);
controller_impl->AddAnimation(animation.Pass());
EXPECT_FALSE(controller_impl->TransformAnimationBoundsForBox(box, &bounds));
@@ -1781,9 +1793,11 @@ TEST(LayerAnimationControllerTest, HasAnimationThatAffectsScale) {
KeyframedTransformAnimationCurve::Create());
TransformOperations operations1;
- curve1->AddKeyframe(TransformKeyframe::Create(0.0, operations1, nullptr));
+ curve1->AddKeyframe(
+ TransformKeyframe::Create(base::TimeDelta(), operations1, nullptr));
operations1.AppendTranslate(10.0, 15.0, 0.0);
- curve1->AddKeyframe(TransformKeyframe::Create(1.0, operations1, nullptr));
+ curve1->AddKeyframe(TransformKeyframe::Create(
+ base::TimeDelta::FromSecondsD(1.0), operations1, nullptr));
scoped_ptr<Animation> animation(
Animation::Create(curve1.Pass(), 2, 2, Animation::Transform));
@@ -1796,9 +1810,11 @@ TEST(LayerAnimationControllerTest, HasAnimationThatAffectsScale) {
KeyframedTransformAnimationCurve::Create());
TransformOperations operations2;
- curve2->AddKeyframe(TransformKeyframe::Create(0.0, operations2, nullptr));
+ curve2->AddKeyframe(
+ TransformKeyframe::Create(base::TimeDelta(), operations2, nullptr));
operations2.AppendScale(2.0, 3.0, 4.0);
- curve2->AddKeyframe(TransformKeyframe::Create(1.0, operations2, nullptr));
+ curve2->AddKeyframe(TransformKeyframe::Create(
+ base::TimeDelta::FromSecondsD(1.0), operations2, nullptr));
animation = Animation::Create(curve2.Pass(), 3, 3, Animation::Transform);
controller_impl->AddAnimation(animation.Pass());
@@ -1831,9 +1847,11 @@ TEST(LayerAnimationControllerTest, HasOnlyTranslationTransforms) {
KeyframedTransformAnimationCurve::Create());
TransformOperations operations1;
- curve1->AddKeyframe(TransformKeyframe::Create(0.0, operations1, nullptr));
+ curve1->AddKeyframe(
+ TransformKeyframe::Create(base::TimeDelta(), operations1, nullptr));
operations1.AppendTranslate(10.0, 15.0, 0.0);
- curve1->AddKeyframe(TransformKeyframe::Create(1.0, operations1, nullptr));
+ curve1->AddKeyframe(TransformKeyframe::Create(
+ base::TimeDelta::FromSecondsD(1.0), operations1, nullptr));
scoped_ptr<Animation> animation(
Animation::Create(curve1.Pass(), 2, 2, Animation::Transform));
@@ -1846,9 +1864,11 @@ TEST(LayerAnimationControllerTest, HasOnlyTranslationTransforms) {
KeyframedTransformAnimationCurve::Create());
TransformOperations operations2;
- curve2->AddKeyframe(TransformKeyframe::Create(0.0, operations2, nullptr));
+ curve2->AddKeyframe(
+ TransformKeyframe::Create(base::TimeDelta(), operations2, nullptr));
operations2.AppendScale(2.0, 3.0, 4.0);
- curve2->AddKeyframe(TransformKeyframe::Create(1.0, operations2, nullptr));
+ curve2->AddKeyframe(TransformKeyframe::Create(
+ base::TimeDelta::FromSecondsD(1.0), operations2, nullptr));
animation = Animation::Create(curve2.Pass(), 3, 3, Animation::Transform);
controller_impl->AddAnimation(animation.Pass());
@@ -1876,9 +1896,11 @@ TEST(LayerAnimationControllerTest, MaximumTargetScale) {
KeyframedTransformAnimationCurve::Create());
TransformOperations operations1;
- curve1->AddKeyframe(TransformKeyframe::Create(0.0, operations1, nullptr));
+ curve1->AddKeyframe(
+ TransformKeyframe::Create(base::TimeDelta(), operations1, nullptr));
operations1.AppendScale(2.0, 3.0, 4.0);
- curve1->AddKeyframe(TransformKeyframe::Create(1.0, operations1, nullptr));
+ curve1->AddKeyframe(TransformKeyframe::Create(
+ base::TimeDelta::FromSecondsD(1.0), operations1, nullptr));
scoped_ptr<Animation> animation(
Animation::Create(curve1.Pass(), 1, 1, Animation::Transform));
@@ -1891,9 +1913,11 @@ TEST(LayerAnimationControllerTest, MaximumTargetScale) {
KeyframedTransformAnimationCurve::Create());
TransformOperations operations2;
- curve2->AddKeyframe(TransformKeyframe::Create(0.0, operations2, nullptr));
+ curve2->AddKeyframe(
+ TransformKeyframe::Create(base::TimeDelta(), operations2, nullptr));
operations2.AppendScale(6.0, 5.0, 4.0);
- curve2->AddKeyframe(TransformKeyframe::Create(1.0, operations2, nullptr));
+ curve2->AddKeyframe(TransformKeyframe::Create(
+ base::TimeDelta::FromSecondsD(1.0), operations2, nullptr));
animation = Animation::Create(curve2.Pass(), 2, 2, Animation::Transform);
controller_impl->AddAnimation(animation.Pass());
@@ -1905,9 +1929,11 @@ TEST(LayerAnimationControllerTest, MaximumTargetScale) {
KeyframedTransformAnimationCurve::Create());
TransformOperations operations3;
- curve3->AddKeyframe(TransformKeyframe::Create(0.0, operations3, nullptr));
+ curve3->AddKeyframe(
+ TransformKeyframe::Create(base::TimeDelta(), operations3, nullptr));
operations3.AppendPerspective(6.0);
- curve3->AddKeyframe(TransformKeyframe::Create(1.0, operations3, nullptr));
+ curve3->AddKeyframe(TransformKeyframe::Create(
+ base::TimeDelta::FromSecondsD(1.0), operations3, nullptr));
animation = Animation::Create(curve3.Pass(), 3, 3, Animation::Transform);
controller_impl->AddAnimation(animation.Pass());
@@ -1933,10 +1959,12 @@ TEST(LayerAnimationControllerTest, MaximumTargetScaleWithDirection) {
KeyframedTransformAnimationCurve::Create());
TransformOperations operations1;
operations1.AppendScale(1.0, 2.0, 3.0);
- curve1->AddKeyframe(TransformKeyframe::Create(0.0, operations1, nullptr));
+ curve1->AddKeyframe(
+ TransformKeyframe::Create(base::TimeDelta(), operations1, nullptr));
TransformOperations operations2;
operations2.AppendScale(4.0, 5.0, 6.0);
- curve1->AddKeyframe(TransformKeyframe::Create(1.0, operations2, nullptr));
+ curve1->AddKeyframe(TransformKeyframe::Create(
+ base::TimeDelta::FromSecondsD(1.0), operations2, nullptr));
scoped_ptr<Animation> animation_owned(
Animation::Create(curve1.Pass(), 1, 1, Animation::Transform));
« no previous file with comments | « cc/animation/layer_animation_controller.cc ('k') | cc/animation/scroll_offset_animation_curve.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698