OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/trees/layer_tree_impl.h" | 5 #include "cc/trees/layer_tree_impl.h" |
6 | 6 |
7 #include "cc/layers/heads_up_display_layer_impl.h" | 7 #include "cc/layers/heads_up_display_layer_impl.h" |
8 #include "cc/layers/layer.h" | 8 #include "cc/layers/layer.h" |
9 #include "cc/test/fake_impl_proxy.h" | 9 #include "cc/test/fake_impl_proxy.h" |
10 #include "cc/test/fake_layer_tree_host_impl.h" | 10 #include "cc/test/fake_layer_tree_host_impl.h" |
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
911 host_impl().SetViewportSize(root->bounds()); | 911 host_impl().SetViewportSize(root->bounds()); |
912 host_impl().active_tree()->SetRootLayer(root.Pass()); | 912 host_impl().active_tree()->SetRootLayer(root.Pass()); |
913 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 913 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
914 | 914 |
915 // Sanity check the scenario we just created. | 915 // Sanity check the scenario we just created. |
916 ASSERT_TRUE(child1); | 916 ASSERT_TRUE(child1); |
917 ASSERT_TRUE(child2); | 917 ASSERT_TRUE(child2); |
918 ASSERT_TRUE(grand_child1); | 918 ASSERT_TRUE(grand_child1); |
919 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 919 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
920 | 920 |
921 RenderSurfaceImpl* root_render_surface = | |
922 host_impl().active_tree()->root_layer()->render_surface(); | |
923 ASSERT_EQ(4u, root_render_surface->layer_list().size()); | |
924 ASSERT_EQ(3, root_render_surface->layer_list().at(0)->id()); | |
925 ASSERT_EQ(1, root_render_surface->layer_list().at(1)->id()); | |
926 ASSERT_EQ(2, root_render_surface->layer_list().at(2)->id()); | |
927 ASSERT_EQ(4, root_render_surface->layer_list().at(3)->id()); | |
928 | |
929 // Nothing overlaps the root_layer at (1, 1), so hit testing there should find | 921 // Nothing overlaps the root_layer at (1, 1), so hit testing there should find |
930 // the root layer. | 922 // the root layer. |
931 gfx::Point test_point = gfx::Point(1, 1); | 923 gfx::Point test_point = gfx::Point(1, 1); |
932 LayerImpl* result_layer = | 924 LayerImpl* result_layer = |
933 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); | 925 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); |
934 ASSERT_TRUE(result_layer); | 926 ASSERT_TRUE(result_layer); |
935 EXPECT_EQ(1, result_layer->id()); | 927 EXPECT_EQ(1, result_layer->id()); |
936 | 928 |
937 // At (15, 15), child1 and root are the only layers. child1 is expected to be | 929 // At (15, 15), child1 and root are the only layers. child1 is expected to be |
938 // on top. | 930 // on top. |
(...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2088 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); | 2080 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); |
2089 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); | 2081 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); |
2090 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2)); | 2082 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2)); |
2091 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3)); | 2083 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3)); |
2092 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4)); | 2084 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4)); |
2093 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers()); | 2085 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers()); |
2094 } | 2086 } |
2095 | 2087 |
2096 } // namespace | 2088 } // namespace |
2097 } // namespace cc | 2089 } // namespace cc |
OLD | NEW |