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

Unified Diff: ui/compositor/layer_animation_element_unittest.cc

Issue 12226080: Thread ui transform animations (Closed) Base URL: http://git.chromium.org/chromium/src.git@DefineThreadedLayerAnimationElements
Patch Set: Speed up animations in WebContentsViewAuraTest.QuickOverscrollDirectionChange Created 7 years, 9 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
« no previous file with comments | « ui/compositor/layer_animation_element.cc ('k') | ui/compositor/layer_animation_sequence.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/layer_animation_element_unittest.cc
diff --git a/ui/compositor/layer_animation_element_unittest.cc b/ui/compositor/layer_animation_element_unittest.cc
index 1b220940a9e711240321742d2de0eb7dac79c3ac..529ce0c7a6c4cf14057b36e0bdaa45a1dfd28d0c 100644
--- a/ui/compositor/layer_animation_element_unittest.cc
+++ b/ui/compositor/layer_animation_element_unittest.cc
@@ -27,28 +27,35 @@ TEST(LayerAnimationElementTest, TransformElement) {
start_transform.Rotate(-30.0);
target_transform.Rotate(30.0);
base::TimeTicks start_time;
+ base::TimeTicks effective_start_time;
base::TimeDelta delta = base::TimeDelta::FromSeconds(1);
scoped_ptr<LayerAnimationElement> element(
LayerAnimationElement::CreateTransformElement(target_transform, delta));
+ element->set_animation_group_id(1);
for (int i = 0; i < 2; ++i) {
- start_time += delta;
+ start_time = effective_start_time + delta;
element->set_requested_start_time(start_time);
delegate.SetTransformFromAnimation(start_transform);
element->Start(&delegate, 1);
element->Progress(start_time, &delegate);
CheckApproximatelyEqual(start_transform,
delegate.GetTransformForAnimation());
- element->Progress(start_time + delta/2, &delegate);
- CheckApproximatelyEqual(middle_transform,
- delegate.GetTransformForAnimation());
+ effective_start_time = start_time + delta;
+ element->set_effective_start_time(effective_start_time);
+ element->Progress(effective_start_time, &delegate);
+ EXPECT_FLOAT_EQ(0.0, element->last_progressed_fraction());
+ element->Progress(effective_start_time + delta/2, &delegate);
+ EXPECT_FLOAT_EQ(0.5, element->last_progressed_fraction());
base::TimeDelta element_duration;
- EXPECT_TRUE(element->IsFinished(start_time + delta, &element_duration));
- EXPECT_EQ(delta, element_duration);
+ EXPECT_TRUE(element->IsFinished(effective_start_time + delta,
+ &element_duration));
+ EXPECT_EQ(2 * delta, element_duration);
- element->Progress(start_time + delta, &delegate);
+ element->Progress(effective_start_time + delta, &delegate);
+ EXPECT_FLOAT_EQ(1.0, element->last_progressed_fraction());
CheckApproximatelyEqual(target_transform,
delegate.GetTransformForAnimation());
}
« no previous file with comments | « ui/compositor/layer_animation_element.cc ('k') | ui/compositor/layer_animation_sequence.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698