| 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/append_quads_data.h" | 5 #include "cc/layers/append_quads_data.h" |
| 6 #include "cc/layers/layer_impl.h" | 6 #include "cc/layers/layer_impl.h" |
| 7 #include "cc/layers/render_pass_sink.h" | 7 #include "cc/layers/render_pass_sink.h" |
| 8 #include "cc/layers/render_surface_impl.h" | 8 #include "cc/layers/render_surface_impl.h" |
| 9 #include "cc/quads/shared_quad_state.h" | 9 #include "cc/quads/shared_quad_state.h" |
| 10 #include "cc/test/fake_compositor_frame_sink.h" | 10 #include "cc/test/fake_compositor_frame_sink.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 code_to_test; \ | 32 code_to_test; \ |
| 33 EXPECT_FALSE(render_surface->SurfacePropertyChanged()) | 33 EXPECT_FALSE(render_surface->SurfacePropertyChanged()) |
| 34 | 34 |
| 35 TEST(RenderSurfaceTest, VerifySurfaceChangesAreTrackedProperly) { | 35 TEST(RenderSurfaceTest, VerifySurfaceChangesAreTrackedProperly) { |
| 36 // | 36 // |
| 37 // This test checks that SurfacePropertyChanged() has the correct behavior. | 37 // This test checks that SurfacePropertyChanged() has the correct behavior. |
| 38 // | 38 // |
| 39 | 39 |
| 40 FakeImplTaskRunnerProvider task_runner_provider; | 40 FakeImplTaskRunnerProvider task_runner_provider; |
| 41 TestTaskGraphRunner task_graph_runner; | 41 TestTaskGraphRunner task_graph_runner; |
| 42 std::unique_ptr<CompositorFrameSink> compositor_frame_sink = |
| 43 FakeCompositorFrameSink::Create3d(); |
| 42 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); | 44 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); |
| 43 std::unique_ptr<LayerImpl> owning_layer = | 45 std::unique_ptr<LayerImpl> owning_layer = |
| 44 LayerImpl::Create(host_impl.active_tree(), 1); | 46 LayerImpl::Create(host_impl.active_tree(), 1); |
| 45 owning_layer->SetHasRenderSurface(true); | 47 owning_layer->test_properties()->force_render_surface = true; |
| 46 ASSERT_TRUE(owning_layer->render_surface()); | |
| 47 RenderSurfaceImpl* render_surface = owning_layer->render_surface(); | |
| 48 gfx::Rect test_rect(3, 4, 5, 6); | 48 gfx::Rect test_rect(3, 4, 5, 6); |
| 49 host_impl.active_tree()->ResetAllChangeTracking(); | 49 host_impl.active_tree()->ResetAllChangeTracking(); |
| 50 host_impl.active_tree()->SetRootLayerForTesting(std::move(owning_layer)); | 50 host_impl.active_tree()->SetRootLayerForTesting(std::move(owning_layer)); |
| 51 host_impl.active_tree()->BuildPropertyTreesForTesting(); | 51 host_impl.SetVisible(true); |
| 52 host_impl.InitializeRenderer(compositor_frame_sink.get()); |
| 53 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); |
| 54 host_impl.active_tree()->UpdateDrawProperties(false /* update_lcd_text */); |
| 55 |
| 56 RenderSurfaceImpl* render_surface = |
| 57 host_impl.active_tree()->root_layer_for_testing()->render_surface(); |
| 58 ASSERT_TRUE(render_surface); |
| 52 | 59 |
| 53 // Currently, the content_rect, clip_rect, and | 60 // Currently, the content_rect, clip_rect, and |
| 54 // owning_layer->layerPropertyChanged() are the only sources of change. | 61 // owning_layer->layerPropertyChanged() are the only sources of change. |
| 55 EXECUTE_AND_VERIFY_SURFACE_CHANGED(render_surface->SetClipRect(test_rect)); | 62 EXECUTE_AND_VERIFY_SURFACE_CHANGED(render_surface->SetClipRect(test_rect)); |
| 56 EXECUTE_AND_VERIFY_SURFACE_CHANGED( | 63 EXECUTE_AND_VERIFY_SURFACE_CHANGED( |
| 57 render_surface->SetContentRectForTesting(test_rect)); | 64 render_surface->SetContentRectForTesting(test_rect)); |
| 58 | 65 |
| 59 host_impl.active_tree()->property_trees()->effect_tree.OnOpacityAnimated( | 66 host_impl.active_tree()->property_trees()->effect_tree.OnOpacityAnimated( |
| 60 0.5f, | 67 0.5f, |
| 61 host_impl.active_tree()->root_layer_for_testing()->effect_tree_index(), | 68 host_impl.active_tree()->root_layer_for_testing()->effect_tree_index(), |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 ASSERT_EQ(1u, pass_sink.RenderPasses().size()); | 191 ASSERT_EQ(1u, pass_sink.RenderPasses().size()); |
| 185 RenderPass* pass = pass_sink.RenderPasses()[0].get(); | 192 RenderPass* pass = pass_sink.RenderPasses()[0].get(); |
| 186 | 193 |
| 187 EXPECT_EQ(RenderPassId(2, 0), pass->id); | 194 EXPECT_EQ(RenderPassId(2, 0), pass->id); |
| 188 EXPECT_EQ(content_rect, pass->output_rect); | 195 EXPECT_EQ(content_rect, pass->output_rect); |
| 189 EXPECT_EQ(origin, pass->transform_to_root_target); | 196 EXPECT_EQ(origin, pass->transform_to_root_target); |
| 190 } | 197 } |
| 191 | 198 |
| 192 } // namespace | 199 } // namespace |
| 193 } // namespace cc | 200 } // namespace cc |
| OLD | NEW |