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

Unified Diff: ui/compositor/layer_animation_element_unittest.cc

Issue 12310115: ui::ThreadedOpacityTransition::OnAbort should depend on tween_type() (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 10 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') | no next file » | 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 9964436929d7c6d4c1870807fbb0e1864961f621..1b220940a9e711240321742d2de0eb7dac79c3ac 100644
--- a/ui/compositor/layer_animation_element_unittest.cc
+++ b/ui/compositor/layer_animation_element_unittest.cc
@@ -283,6 +283,36 @@ TEST(LayerAnimationElementTest, PauseElement) {
copy.GetGrayscaleForAnimation());
}
+// Check that a threaded element updates the delegate as expected when aborted.
+TEST(LayerAnimationElementTest, AbortOpacityElement) {
+ TestLayerAnimationDelegate delegate;
+ float start = 0.0;
+ float target = 1.0;
+ base::TimeTicks start_time;
+ base::TimeTicks effective_start_time;
+ base::TimeDelta delta = base::TimeDelta::FromSeconds(1);
+ scoped_ptr<LayerAnimationElement> element(
+ LayerAnimationElement::CreateOpacityElement(target, delta));
+
+ // Choose a non-linear Tween type.
+ Tween::Type tween_type = Tween::EASE_IN;
+ element->set_tween_type(tween_type);
+
+ start_time += delta;
+ element->set_requested_start_time(start_time);
+ delegate.SetOpacityFromAnimation(start);
+ element->Start(&delegate, 1);
+ element->Progress(start_time, &delegate);
+ effective_start_time = start_time + delta;
+ element->set_effective_start_time(effective_start_time);
+ element->Progress(effective_start_time, &delegate);
+ element->Progress(effective_start_time + delta/2, &delegate);
+
+ element->Abort(&delegate);
+ EXPECT_FLOAT_EQ(Tween::CalculateValue(tween_type, 0.5),
+ delegate.GetOpacityForAnimation());
+}
+
} // namespace
} // namespace ui
« no previous file with comments | « ui/compositor/layer_animation_element.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698