Index: cc/trees/layer_tree_host_unittest.cc |
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc |
index 950fd79466ef2d4e6bc509cae0dfa3e9aabe823e..e36523d16ef56f9eebe17de9e95b4e63b0fb8987 100644 |
--- a/cc/trees/layer_tree_host_unittest.cc |
+++ b/cc/trees/layer_tree_host_unittest.cc |
@@ -5112,6 +5112,81 @@ class LayerTreeHostTestNoQuadsForEmptyLayer : public LayerTreeHostTest { |
SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoQuadsForEmptyLayer); |
+class LayerTreeHostTestNoQuadsForZeroOpacityLayer : public LayerTreeHostTest { |
+ protected: |
+ virtual void SetupTree() OVERRIDE { |
+ LayerTreeHostTest::SetupTree(); |
+ parent_layer_ = FakeContentLayer::Create(&client_); |
+ parent_layer_->SetBounds(gfx::Size(40, 40)); |
+ parent_layer_->SetOpacity(0.f); |
+ parent_layer_->SetIsDrawable(true); |
+ |
+ layer_tree_host()->SetRootLayer(SolidColorLayer::Create()); |
+ layer_tree_host()->root_layer()->AddChild(parent_layer_); |
+ |
+ wheel_handler_ = FakeContentLayer::Create(NULL); |
+ wheel_handler_->SetBounds(gfx::Size(10, 10)); |
+ wheel_handler_->SetHaveWheelEventHandlers(true); |
+ wheel_handler_->SetIsDrawable(true); |
+ parent_layer_->AddChild(wheel_handler_); |
+ |
+ sibling_ = FakeContentLayer::Create(NULL); |
+ sibling_->SetBounds(gfx::Size(30, 30)); |
+ sibling_->SetPosition(gfx::Point(10, 0)); |
+ sibling_->SetIsDrawable(true); |
+ parent_layer_->AddChild(sibling_); |
+ |
+ LayerTreeHostTest::SetupTree(); |
+ } |
+ |
+ virtual void BeginTest() OVERRIDE { |
+ PostSetNeedsCommitToMainThread(); |
+ } |
+ |
+ virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
+ LayerImpl* root = impl->RootLayer(); |
+ ASSERT_EQ(1u, root->children().size()); |
+ |
+ FakeContentLayerImpl* parent = |
+ static_cast<FakeContentLayerImpl*>(root->children()[0]); |
+ EXPECT_TRUE(parent->DrawsContent()); |
+ EXPECT_FALSE(parent->opacity()); |
+ EXPECT_FALSE(parent->draw_opacity()); |
+ EXPECT_EQ(0u, parent->append_quads_count()); |
+ ASSERT_EQ(2u, parent->children().size()); |
+ |
+ FakeContentLayerImpl* child = |
+ static_cast<FakeContentLayerImpl*>(parent->children()[0]); |
+ EXPECT_TRUE(child->opacity()); |
+ EXPECT_FALSE(child->draw_opacity()); |
+ EXPECT_EQ(0u, child->append_quads_count()); |
+ |
+ child = static_cast<FakeContentLayerImpl*>(parent->children()[1]); |
+ EXPECT_TRUE(child->opacity()); |
+ EXPECT_FALSE(child->draw_opacity()); |
+ EXPECT_EQ(0u, child->append_quads_count()); |
+ } |
+ |
+ virtual void DidCommit() OVERRIDE { |
+ // The layer is transparent, so it should not be updated. |
+ EXPECT_EQ(0u, parent_layer_->update_count()); |
+ ASSERT_EQ(2u, parent_layer_->children().size()); |
+ |
+ EXPECT_EQ(0u, wheel_handler_->update_count()); |
+ EXPECT_EQ(0u, sibling_->update_count()); |
+ |
+ EndTest(); |
+ } |
+ virtual void AfterTest() OVERRIDE {} |
+ |
+ private: |
+ FakeContentLayerClient client_; |
+ scoped_refptr<FakeContentLayer> parent_layer_; |
+ scoped_refptr<FakeContentLayer> wheel_handler_; |
+ scoped_refptr<FakeContentLayer> sibling_; |
+}; |
+ |
+SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoQuadsForZeroOpacityLayer); |
} // namespace |