Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Unified Diff: cc/layers/render_surface_unittest.cc

Issue 2571263002: cc: Remove map lookup from RenderSurfaceImpl::EffectTreeIndex (Closed)
Patch Set: Fix post-rebase unit test failure Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/render_surface_impl.cc ('k') | cc/trees/draw_property_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/render_surface_unittest.cc
diff --git a/cc/layers/render_surface_unittest.cc b/cc/layers/render_surface_unittest.cc
index 44fc5bb2198f812f3dd6143db8dee2446da31c2b..511108dc0f232aff6cec11076b156a61596c8ef9 100644
--- a/cc/layers/render_surface_unittest.cc
+++ b/cc/layers/render_surface_unittest.cc
@@ -39,16 +39,23 @@ TEST(RenderSurfaceTest, VerifySurfaceChangesAreTrackedProperly) {
FakeImplTaskRunnerProvider task_runner_provider;
TestTaskGraphRunner task_graph_runner;
+ std::unique_ptr<CompositorFrameSink> compositor_frame_sink =
+ FakeCompositorFrameSink::Create3d();
FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner);
std::unique_ptr<LayerImpl> owning_layer =
LayerImpl::Create(host_impl.active_tree(), 1);
- owning_layer->SetHasRenderSurface(true);
- ASSERT_TRUE(owning_layer->render_surface());
- RenderSurfaceImpl* render_surface = owning_layer->render_surface();
+ owning_layer->test_properties()->force_render_surface = true;
gfx::Rect test_rect(3, 4, 5, 6);
host_impl.active_tree()->ResetAllChangeTracking();
host_impl.active_tree()->SetRootLayerForTesting(std::move(owning_layer));
- host_impl.active_tree()->BuildPropertyTreesForTesting();
+ host_impl.SetVisible(true);
+ host_impl.InitializeRenderer(compositor_frame_sink.get());
+ host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting();
+ host_impl.active_tree()->UpdateDrawProperties(false /* update_lcd_text */);
+
+ RenderSurfaceImpl* render_surface =
+ host_impl.active_tree()->root_layer_for_testing()->render_surface();
+ ASSERT_TRUE(render_surface);
// Currently, the content_rect, clip_rect, and
// owning_layer->layerPropertyChanged() are the only sources of change.
@@ -158,19 +165,28 @@ class TestRenderPassSink : public RenderPassSink {
TEST(RenderSurfaceTest, SanityCheckSurfaceCreatesCorrectRenderPass) {
FakeImplTaskRunnerProvider task_runner_provider;
TestTaskGraphRunner task_graph_runner;
+ std::unique_ptr<CompositorFrameSink> compositor_frame_sink =
+ FakeCompositorFrameSink::Create3d();
FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner);
std::unique_ptr<LayerImpl> root_layer =
LayerImpl::Create(host_impl.active_tree(), 1);
+ int owning_layer_id = 2;
std::unique_ptr<LayerImpl> owning_layer =
- LayerImpl::Create(host_impl.active_tree(), 2);
- owning_layer->SetHasRenderSurface(true);
- ASSERT_TRUE(owning_layer->render_surface());
- RenderSurfaceImpl* render_surface = owning_layer->render_surface();
+ LayerImpl::Create(host_impl.active_tree(), owning_layer_id);
+ owning_layer->test_properties()->force_render_surface = true;
root_layer->test_properties()->AddChild(std::move(owning_layer));
host_impl.active_tree()->SetRootLayerForTesting(std::move(root_layer));
+ host_impl.SetVisible(true);
+ host_impl.InitializeRenderer(compositor_frame_sink.get());
host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting();
+ host_impl.active_tree()->UpdateDrawProperties(false /* update_lcd_text */);
+
+ ASSERT_TRUE(
+ host_impl.active_tree()->LayerById(owning_layer_id)->render_surface());
+ RenderSurfaceImpl* render_surface =
+ host_impl.active_tree()->LayerById(owning_layer_id)->render_surface();
gfx::Rect content_rect(0, 0, 50, 50);
gfx::Transform origin;
« no previous file with comments | « cc/layers/render_surface_impl.cc ('k') | cc/trees/draw_property_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698