Index: cc/trees/layer_tree_impl_unittest.cc |
diff --git a/cc/trees/layer_tree_impl_unittest.cc b/cc/trees/layer_tree_impl_unittest.cc |
index b6cf7f23148086434762b7d1c74c644493137d9c..3b35cfcccaf79c0fb0a846160c347c9bd8d53432 100644 |
--- a/cc/trees/layer_tree_impl_unittest.cc |
+++ b/cc/trees/layer_tree_impl_unittest.cc |
@@ -380,6 +380,41 @@ TEST_F(LayerTreeImplTest, HitTestingForSingleRotatedLayer) { |
ASSERT_FALSE(result_layer); |
} |
+TEST_F(LayerTreeImplTest, HitTestingSiblings) { |
+ // This tests hit testing when the test point hits only one of the siblings. |
+ gfx::Transform identity_matrix; |
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); |
+ SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
+ gfx::PointF(), gfx::Size(100, 100), true, false, |
+ true); |
+ scoped_ptr<LayerImpl> child1 = |
+ LayerImpl::Create(host_impl().active_tree(), 2); |
+ SetLayerPropertiesForTesting(child1.get(), identity_matrix, gfx::Point3F(), |
+ gfx::PointF(), gfx::Size(25, 25), true, false, |
+ false); |
+ child1->SetMasksToBounds(true); |
+ child1->SetDrawsContent(true); |
+ scoped_ptr<LayerImpl> child2 = |
+ LayerImpl::Create(host_impl().active_tree(), 3); |
+ SetLayerPropertiesForTesting(child2.get(), identity_matrix, gfx::Point3F(), |
+ gfx::PointF(), gfx::Size(75, 75), true, false, |
+ false); |
+ child2->SetMasksToBounds(true); |
+ child2->SetDrawsContent(true); |
+ root->AddChild(std::move(child1)); |
+ root->AddChild(std::move(child2)); |
+ |
+ host_impl().SetViewportSize(root->bounds()); |
+ host_impl().active_tree()->SetRootLayer(std::move(root)); |
+ host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
+ |
+ gfx::PointF test_point(50.f, 50.f); |
+ LayerImpl* result_layer = |
+ host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); |
+ ASSERT_TRUE(result_layer); |
+ EXPECT_EQ(3, result_layer->id()); |
+} |
+ |
TEST_F(LayerTreeImplTest, HitTestingForSinglePerspectiveLayer) { |
scoped_ptr<LayerImpl> root = |
LayerImpl::Create(host_impl().active_tree(), 12345); |