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

Side by Side Diff: cc/layers/render_surface_unittest.cc

Issue 2253233003: cc : Add OnOpacityAnimated to effect tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 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 unified diff | Download patch
OLDNEW
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_impl_task_runner_provider.h" 10 #include "cc/test/fake_impl_task_runner_provider.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 TestTaskGraphRunner task_graph_runner; 43 TestTaskGraphRunner task_graph_runner;
44 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 44 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
45 &task_graph_runner); 45 &task_graph_runner);
46 std::unique_ptr<LayerImpl> owning_layer = 46 std::unique_ptr<LayerImpl> owning_layer =
47 LayerImpl::Create(host_impl.active_tree(), 1); 47 LayerImpl::Create(host_impl.active_tree(), 1);
48 owning_layer->SetHasRenderSurface(true); 48 owning_layer->SetHasRenderSurface(true);
49 ASSERT_TRUE(owning_layer->render_surface()); 49 ASSERT_TRUE(owning_layer->render_surface());
50 RenderSurfaceImpl* render_surface = owning_layer->render_surface(); 50 RenderSurfaceImpl* render_surface = owning_layer->render_surface();
51 gfx::Rect test_rect(3, 4, 5, 6); 51 gfx::Rect test_rect(3, 4, 5, 6);
52 host_impl.active_tree()->ResetAllChangeTracking(); 52 host_impl.active_tree()->ResetAllChangeTracking();
53 host_impl.active_tree()->SetRootLayerForTesting(std::move(owning_layer));
54 host_impl.active_tree()->BuildPropertyTreesForTesting();
53 55
54 // Currently, the content_rect, clip_rect, and 56 // Currently, the content_rect, clip_rect, and
55 // owning_layer->layerPropertyChanged() are the only sources of change. 57 // owning_layer->layerPropertyChanged() are the only sources of change.
56 EXECUTE_AND_VERIFY_SURFACE_CHANGED(render_surface->SetClipRect(test_rect)); 58 EXECUTE_AND_VERIFY_SURFACE_CHANGED(render_surface->SetClipRect(test_rect));
57 EXECUTE_AND_VERIFY_SURFACE_CHANGED( 59 EXECUTE_AND_VERIFY_SURFACE_CHANGED(
58 render_surface->SetContentRectForTesting(test_rect)); 60 render_surface->SetContentRectForTesting(test_rect));
59 61
60 owning_layer->OnOpacityAnimated(0.5f); 62 host_impl.active_tree()->property_trees()->effect_tree.OnOpacityAnimated(
63 0.5f,
64 host_impl.active_tree()->root_layer_for_testing()->effect_tree_index(),
ajuma 2016/08/18 18:49:26 Should this be owning_layer->effect_tree_index()?
jaydasika 2016/08/18 19:57:52 owning layer is the root layer here. See line 53.
ajuma 2016/08/18 20:45:36 Ah, I missed that!
65 host_impl.active_tree());
61 EXPECT_TRUE(render_surface->SurfacePropertyChanged()); 66 EXPECT_TRUE(render_surface->SurfacePropertyChanged());
62 host_impl.active_tree()->ResetAllChangeTracking(); 67 host_impl.active_tree()->ResetAllChangeTracking();
63 68
64 // Setting the surface properties to the same values again should not be 69 // Setting the surface properties to the same values again should not be
65 // considered "change". 70 // considered "change".
66 EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE( 71 EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(
67 render_surface->SetClipRect(test_rect)); 72 render_surface->SetClipRect(test_rect));
68 EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE( 73 EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(
69 render_surface->SetContentRectForTesting(test_rect)); 74 render_surface->SetContentRectForTesting(test_rect));
70 75
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 ASSERT_EQ(1u, pass_sink.RenderPasses().size()); 194 ASSERT_EQ(1u, pass_sink.RenderPasses().size());
190 RenderPass* pass = pass_sink.RenderPasses()[0].get(); 195 RenderPass* pass = pass_sink.RenderPasses()[0].get();
191 196
192 EXPECT_EQ(RenderPassId(2, 0), pass->id); 197 EXPECT_EQ(RenderPassId(2, 0), pass->id);
193 EXPECT_EQ(content_rect, pass->output_rect); 198 EXPECT_EQ(content_rect, pass->output_rect);
194 EXPECT_EQ(origin, pass->transform_to_root_target); 199 EXPECT_EQ(origin, pass->transform_to_root_target);
195 } 200 }
196 201
197 } // namespace 202 } // namespace
198 } // namespace cc 203 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698