OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/layers/layer_impl.h" | 5 #include "cc/layers/layer_impl.h" |
6 | 6 |
7 #include "cc/animation/mutable_properties.h" | 7 #include "cc/animation/mutable_properties.h" |
8 #include "cc/layers/painted_scrollbar_layer_impl.h" | 8 #include "cc/layers/painted_scrollbar_layer_impl.h" |
9 #include "cc/layers/solid_color_scrollbar_layer_impl.h" | 9 #include "cc/layers/solid_color_scrollbar_layer_impl.h" |
10 #include "cc/output/filter_operation.h" | 10 #include "cc/output/filter_operation.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 TEST(LayerImplTest, VerifyLayerChangesAreTrackedProperly) { | 105 TEST(LayerImplTest, VerifyLayerChangesAreTrackedProperly) { |
106 // | 106 // |
107 // This test checks that layerPropertyChanged() has the correct behavior. | 107 // This test checks that layerPropertyChanged() has the correct behavior. |
108 // | 108 // |
109 | 109 |
110 // The constructor on this will fake that we are on the correct thread. | 110 // The constructor on this will fake that we are on the correct thread. |
111 // Create a simple LayerImpl tree: | 111 // Create a simple LayerImpl tree: |
112 FakeImplTaskRunnerProvider task_runner_provider; | 112 FakeImplTaskRunnerProvider task_runner_provider; |
113 TestSharedBitmapManager shared_bitmap_manager; | 113 TestSharedBitmapManager shared_bitmap_manager; |
114 TestTaskGraphRunner task_graph_runner; | 114 TestTaskGraphRunner task_graph_runner; |
115 std::unique_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); | 115 std::unique_ptr<OutputSurface> output_surface = |
| 116 FakeOutputSurface::CreateDelegating3d(); |
116 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, | 117 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
117 &task_graph_runner); | 118 &task_graph_runner); |
118 host_impl.SetVisible(true); | 119 host_impl.SetVisible(true); |
119 EXPECT_TRUE(host_impl.InitializeRenderer(output_surface.get())); | 120 EXPECT_TRUE(host_impl.InitializeRenderer(output_surface.get())); |
120 std::unique_ptr<LayerImpl> root_clip_ptr = | 121 std::unique_ptr<LayerImpl> root_clip_ptr = |
121 LayerImpl::Create(host_impl.active_tree(), 1); | 122 LayerImpl::Create(host_impl.active_tree(), 1); |
122 LayerImpl* root_clip = root_clip_ptr.get(); | 123 LayerImpl* root_clip = root_clip_ptr.get(); |
123 std::unique_ptr<LayerImpl> root_ptr = | 124 std::unique_ptr<LayerImpl> root_ptr = |
124 LayerImpl::Create(host_impl.active_tree(), 2); | 125 LayerImpl::Create(host_impl.active_tree(), 2); |
125 LayerImpl* root = root_ptr.get(); | 126 LayerImpl* root = root_ptr.get(); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( | 218 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( |
218 root->SetBlendMode(arbitrary_blend_mode)); | 219 root->SetBlendMode(arbitrary_blend_mode)); |
219 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetDrawsContent(true)); | 220 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetDrawsContent(true)); |
220 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetBounds(bounds_size)); | 221 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetBounds(bounds_size)); |
221 } | 222 } |
222 | 223 |
223 TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) { | 224 TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) { |
224 FakeImplTaskRunnerProvider task_runner_provider; | 225 FakeImplTaskRunnerProvider task_runner_provider; |
225 TestSharedBitmapManager shared_bitmap_manager; | 226 TestSharedBitmapManager shared_bitmap_manager; |
226 TestTaskGraphRunner task_graph_runner; | 227 TestTaskGraphRunner task_graph_runner; |
227 std::unique_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); | 228 std::unique_ptr<OutputSurface> output_surface = |
| 229 FakeOutputSurface::CreateDelegating3d(); |
228 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, | 230 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
229 &task_graph_runner); | 231 &task_graph_runner); |
230 host_impl.SetVisible(true); | 232 host_impl.SetVisible(true); |
231 EXPECT_TRUE(host_impl.InitializeRenderer(output_surface.get())); | 233 EXPECT_TRUE(host_impl.InitializeRenderer(output_surface.get())); |
232 host_impl.active_tree()->SetRootLayerForTesting( | 234 host_impl.active_tree()->SetRootLayerForTesting( |
233 LayerImpl::Create(host_impl.active_tree(), 1)); | 235 LayerImpl::Create(host_impl.active_tree(), 1)); |
234 LayerImpl* root = host_impl.active_tree()->root_layer_for_testing(); | 236 LayerImpl* root = host_impl.active_tree()->root_layer_for_testing(); |
235 root->SetHasRenderSurface(true); | 237 root->SetHasRenderSurface(true); |
236 std::unique_ptr<LayerImpl> layer_ptr = | 238 std::unique_ptr<LayerImpl> layer_ptr = |
237 LayerImpl::Create(host_impl.active_tree(), 2); | 239 LayerImpl::Create(host_impl.active_tree(), 2); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size)); | 340 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size)); |
339 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetElementId(ElementId(2, 0))); | 341 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetElementId(ElementId(2, 0))); |
340 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 342 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
341 layer->SetMutableProperties(MutableProperty::kTransform)); | 343 layer->SetMutableProperties(MutableProperty::kTransform)); |
342 } | 344 } |
343 | 345 |
344 TEST(LayerImplTest, SafeOpaqueBackgroundColor) { | 346 TEST(LayerImplTest, SafeOpaqueBackgroundColor) { |
345 FakeImplTaskRunnerProvider task_runner_provider; | 347 FakeImplTaskRunnerProvider task_runner_provider; |
346 TestSharedBitmapManager shared_bitmap_manager; | 348 TestSharedBitmapManager shared_bitmap_manager; |
347 TestTaskGraphRunner task_graph_runner; | 349 TestTaskGraphRunner task_graph_runner; |
348 std::unique_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); | 350 std::unique_ptr<OutputSurface> output_surface = |
| 351 FakeOutputSurface::CreateDelegating3d(); |
349 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, | 352 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
350 &task_graph_runner); | 353 &task_graph_runner); |
351 host_impl.SetVisible(true); | 354 host_impl.SetVisible(true); |
352 EXPECT_TRUE(host_impl.InitializeRenderer(output_surface.get())); | 355 EXPECT_TRUE(host_impl.InitializeRenderer(output_surface.get())); |
353 host_impl.active_tree()->SetRootLayerForTesting( | 356 host_impl.active_tree()->SetRootLayerForTesting( |
354 LayerImpl::Create(host_impl.active_tree(), 1)); | 357 LayerImpl::Create(host_impl.active_tree(), 1)); |
355 LayerImpl* layer = host_impl.active_tree()->root_layer_for_testing(); | 358 LayerImpl* layer = host_impl.active_tree()->root_layer_for_testing(); |
356 | 359 |
357 for (int contents_opaque = 0; contents_opaque < 2; ++contents_opaque) { | 360 for (int contents_opaque = 0; contents_opaque < 2; ++contents_opaque) { |
358 for (int layer_opaque = 0; layer_opaque < 2; ++layer_opaque) { | 361 for (int layer_opaque = 0; layer_opaque < 2; ++layer_opaque) { |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 | 564 |
562 pending_layer->PushPropertiesTo(layer()); | 565 pending_layer->PushPropertiesTo(layer()); |
563 | 566 |
564 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); | 567 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); |
565 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), | 568 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), |
566 pending_layer->CurrentScrollOffset()); | 569 pending_layer->CurrentScrollOffset()); |
567 } | 570 } |
568 | 571 |
569 } // namespace | 572 } // namespace |
570 } // namespace cc | 573 } // namespace cc |
OLD | NEW |