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

Unified Diff: ui/compositor/layer_unittest.cc

Issue 12609006: ui::Layer::SwitchToLayer should finish animations on its old cc::Layer (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 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.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_unittest.cc
diff --git a/ui/compositor/layer_unittest.cc b/ui/compositor/layer_unittest.cc
index 378af34d7dd6fe512eafd0867c2c7b463dc8771e..e6ad58af64b0cc551b5482b185b8e3fbb43c271d 100644
--- a/ui/compositor/layer_unittest.cc
+++ b/ui/compositor/layer_unittest.cc
@@ -326,6 +326,7 @@ class TestCompositorObserver : public CompositorObserver {
#define MAYBE_ScaleReparent DISABLED_ScaleReparent
#define MAYBE_NoScaleCanvas DISABLED_NoScaleCanvas
#define MAYBE_AddRemoveThreadedAnimations DISABLED_AddRemoveThreadedAnimations
+#define MAYBE_SwitchCCLayerAnimations DISABLED_SwitchCCLayerAnimations
#else
#define MAYBE_Delegate Delegate
#define MAYBE_Draw Draw
@@ -341,6 +342,7 @@ class TestCompositorObserver : public CompositorObserver {
#define MAYBE_ScaleReparent ScaleReparent
#define MAYBE_NoScaleCanvas NoScaleCanvas
#define MAYBE_AddRemoveThreadedAnimations AddRemoveThreadedAnimations
+#define MAYBE_SwitchCCLayerAnimations SwitchCCLayerAnimations
#endif
TEST_F(LayerWithRealCompositorTest, MAYBE_Draw) {
@@ -1358,4 +1360,26 @@ TEST_F(LayerWithRealCompositorTest, MAYBE_AddRemoveThreadedAnimations) {
EXPECT_FALSE(l2->HasPendingThreadedAnimations());
}
+// Tests that in-progress threaded animations complete when a Layer's
+// cc::Layer changes.
+TEST_F(LayerWithRealCompositorTest, MAYBE_SwitchCCLayerAnimations) {
+ scoped_ptr<Layer> root(CreateLayer(LAYER_TEXTURED));
+ scoped_ptr<Layer> l1(CreateLayer(LAYER_TEXTURED));
+ GetCompositor()->SetRootLayer(root.get());
+ root->Add(l1.get());
+
+ l1->SetAnimator(LayerAnimator::CreateImplicitAnimator());
+
+ EXPECT_FLOAT_EQ(l1->opacity(), 1.0f);
+
+ // Trigger a threaded animation.
+ l1->SetOpacity(0.5f);
+
+ // Change l1's cc::Layer.
+ l1->SwitchCCLayerForTest();
+
+ // Ensure that the opacity animation completed.
+ EXPECT_FLOAT_EQ(l1->opacity(), 0.5f);
+}
+
} // namespace ui
« no previous file with comments | « ui/compositor/layer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698