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

Unified Diff: ui/compositor/layer_animator_unittest.cc

Issue 1778213003: UI Compositor: Fix threaded animation survival if layer removed and added. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 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_animator.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_animator_unittest.cc
diff --git a/ui/compositor/layer_animator_unittest.cc b/ui/compositor/layer_animator_unittest.cc
index f15bb4a40307b0cad8782b5f701b8d7f2c3020bc..9c1c5f14b51e8062ee4b855059b4b1c70fdb63c8 100644
--- a/ui/compositor/layer_animator_unittest.cc
+++ b/ui/compositor/layer_animator_unittest.cc
@@ -2532,15 +2532,50 @@ TEST(LayerAnimatorTest, LayerMovedBetweenCompositorsDuringAnimation) {
LayerAnimationElement::CreateOpacityElement(target_opacity, time_delta)));
EXPECT_TRUE(compositor_1->layer_animator_collection()->HasActiveAnimators());
EXPECT_FALSE(compositor_2->layer_animator_collection()->HasActiveAnimators());
+ EXPECT_TRUE(layer.cc_layer_for_testing()->HasActiveAnimation());
root_2.Add(&layer);
EXPECT_FALSE(compositor_1->layer_animator_collection()->HasActiveAnimators());
EXPECT_TRUE(compositor_2->layer_animator_collection()->HasActiveAnimators());
+ EXPECT_TRUE(layer.cc_layer_for_testing()->HasActiveAnimation());
+
host_2.reset();
host_1.reset();
TerminateContextFactoryForTests();
}
+TEST(LayerAnimatorTest, ThreadedAnimationSurvivesIfLayerRemovedAdded) {
+ bool enable_pixel_output = false;
+ ui::ContextFactory* context_factory =
+ InitializeContextFactoryForTests(enable_pixel_output);
+ const gfx::Rect bounds(10, 10, 100, 100);
+ scoped_ptr<TestCompositorHost> host(
+ TestCompositorHost::Create(bounds, context_factory));
+ host->Show();
+
+ Compositor* compositor = host->GetCompositor();
+
+ Layer root;
+ compositor->SetRootLayer(&root);
+
+ Layer layer;
+ root.Add(&layer);
+
+ LayerAnimator* animator = layer.GetAnimator();
+ double target_opacity = 1.0;
+ base::TimeDelta time_delta = base::TimeDelta::FromSeconds(1);
+ animator->ScheduleAnimation(new LayerAnimationSequence(
+ LayerAnimationElement::CreateOpacityElement(target_opacity, time_delta)));
+
+ EXPECT_TRUE(layer.cc_layer_for_testing()->HasActiveAnimation());
+ root.Remove(&layer);
+ root.Add(&layer);
+ EXPECT_TRUE(layer.cc_layer_for_testing()->HasActiveAnimation());
+
+ host.reset();
+ TerminateContextFactoryForTests();
+}
+
class LayerOwnerAnimationObserver : public LayerAnimationObserver {
public:
LayerOwnerAnimationObserver(LayerAnimator* animator)
« no previous file with comments | « ui/compositor/layer_animator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698