Index: cc/layer_unittest.cc |
diff --git a/cc/layer_unittest.cc b/cc/layer_unittest.cc |
index 6784858c7fd0f35434d3ff3e13455d88382c31a7..7e19db9a98c2e366654f45731417bc955ac1fe9a 100644 |
--- a/cc/layer_unittest.cc |
+++ b/cc/layer_unittest.cc |
@@ -649,6 +649,13 @@ public: |
return host.Pass(); |
} |
+ static scoped_ptr<FakeLayerImplTreeHost> create(LayerTreeSettings settings) |
+ { |
+ scoped_ptr<FakeLayerImplTreeHost> host(new FakeLayerImplTreeHost(settings)); |
+ host->initialize(scoped_ptr<Thread>(NULL)); |
+ return host.Pass(); |
+ } |
+ |
private: |
FakeLayerImplTreeHost(const LayerTreeSettings& settings) |
: LayerTreeHost(&m_client, settings) |
@@ -844,31 +851,30 @@ static bool addTestAnimation(Layer* layer) |
return layer->addAnimation(animation.Pass()); |
} |
-TEST(LayerLayerTreeHostTest, shouldNotAddAnimationWithoutLayerTreeHost) |
+TEST(LayerLayerTreeHostTest, shouldNotAddAnimationWithoutAnimationRegistrar) |
{ |
- // Currently, WebCore assumes that animations will be started immediately / very soon |
- // if a composited layer's addAnimation() returns true. However, without a layerTreeHost, |
- // layers cannot actually animate yet. So, to prevent violating this WebCore assumption, |
- // the animation should not be accepted if the layer doesn't already have a layerTreeHost. |
- |
scoped_refptr<Layer> layer = Layer::create(); |
- // Case 1: without a layerTreeHost, the animation should not be accepted. |
-#if defined(OS_ANDROID) |
- // All animations are enabled on Android to avoid performance regressions. |
- // Other platforms will be enabled with http://crbug.com/129683 |
- EXPECT_TRUE(addTestAnimation(layer.get())); |
-#else |
+ // Case 1: without a LayerTreeHost and without an AnimationRegistrar, the |
+ // animation should not be accepted. |
EXPECT_FALSE(addTestAnimation(layer.get())); |
-#endif |
- scoped_ptr<FakeLayerImplTreeHost> layerTreeHost(FakeLayerImplTreeHost::create()); |
+ scoped_ptr<AnimationRegistrar> registrar = AnimationRegistrar::create(); |
+ layer->layerAnimationController()->setAnimationRegistrar(registrar.get()); |
+ |
+ // Case 2: with an AnimationRegistrar, the animation should be accepted. |
+ EXPECT_TRUE(addTestAnimation(layer.get())); |
+ |
+ LayerTreeSettings settings; |
+ settings.acceleratedAnimationEnabled = false; |
+ scoped_ptr<FakeLayerImplTreeHost> layerTreeHost(FakeLayerImplTreeHost::create(settings)); |
layerTreeHost->setRootLayer(layer.get()); |
layer->setLayerTreeHost(layerTreeHost.get()); |
assertLayerTreeHostMatchesForSubtree(layer.get(), layerTreeHost.get()); |
- // Case 2: with a layerTreeHost, the animation should be accepted. |
- EXPECT_TRUE(addTestAnimation(layer.get())); |
+ // Case 3: with a LayerTreeHost where accelerated animation is disabled, the |
+ // animation should be rejected. |
+ EXPECT_FALSE(addTestAnimation(layer.get())); |
} |
} // namespace |