Chromium Code Reviews| Index: ui/compositor/layer_unittest.cc |
| diff --git a/ui/compositor/layer_unittest.cc b/ui/compositor/layer_unittest.cc |
| index fedd2991008f84fe840b6f3a75359ecb43180baf..4eafb9dcf0e1bcf42221623da6604f074c7491dd 100644 |
| --- a/ui/compositor/layer_unittest.cc |
| +++ b/ui/compositor/layer_unittest.cc |
| @@ -1344,6 +1344,33 @@ TEST_F(LayerWithDelegateTest, DelegatedLayer) { |
| gfx::Size(20, 20).ToString()); |
| } |
| +TEST_F(LayerWithDelegateTest, ExternalContent) { |
| + scoped_ptr<Layer> root(CreateNoTextureLayer(gfx::Rect(0, 0, 1000, 1000))); |
| + scoped_ptr<Layer> child(CreateLayer(LAYER_TEXTURED)); |
| + |
| + child->SetBounds(gfx::Rect(0, 0, 10, 10)); |
| + child->SetVisible(true); |
| + root->Add(child.get()); |
| + |
| + // The layer is already showing painted content, so the cc layer won't change. |
| + cc::Layer* before = child->cc_layer(); |
|
piman
2013/10/01 21:21:45
Make |before| a scoped_refptr<cc::Layer>. If the l
danakj
2013/10/01 22:37:19
Oh, right. Done.
|
| + child->SetShowPaintedContent(); |
| + EXPECT_TRUE(child->cc_layer()); |
| + EXPECT_EQ(before, child->cc_layer()); |
| + |
| + // Showing delegated content changes the underlying cc layer. |
| + before = child->cc_layer(); |
| + child->SetDelegatedFrame(MakeFrameData(gfx::Size(10, 10)), gfx::Size(10, 10)); |
| + EXPECT_TRUE(child->cc_layer()); |
| + EXPECT_NE(before, child->cc_layer()); |
| + |
| + // Changing to painted content should change the underlying cc layer. |
| + before = child->cc_layer(); |
| + child->SetShowPaintedContent(); |
| + EXPECT_TRUE(child->cc_layer()); |
| + EXPECT_NE(before, child->cc_layer()); |
| +} |
| + |
| // Tests Layer::AddThreadedAnimation and Layer::RemoveThreadedAnimation. |
| TEST_F(LayerWithRealCompositorTest, AddRemoveThreadedAnimations) { |
| scoped_ptr<Layer> root(CreateLayer(LAYER_TEXTURED)); |