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

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

Issue 1177033008: cc: Turn impl_side_painting and use_one_copy on in LayerTreeSettings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: implon: fixwebkittests Created 5 years, 6 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
« no previous file with comments | « cc/layers/picture_layer_unittest.cc ('k') | cc/layers/scrollbar_layer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/base/scoped_ptr_vector.h" 5 #include "cc/base/scoped_ptr_vector.h"
6 #include "cc/layers/append_quads_data.h" 6 #include "cc/layers/append_quads_data.h"
7 #include "cc/layers/layer_impl.h" 7 #include "cc/layers/layer_impl.h"
8 #include "cc/layers/render_pass_sink.h" 8 #include "cc/layers/render_pass_sink.h"
9 #include "cc/layers/render_surface_impl.h" 9 #include "cc/layers/render_surface_impl.h"
10 #include "cc/quads/shared_quad_state.h" 10 #include "cc/quads/shared_quad_state.h"
11 #include "cc/test/fake_impl_proxy.h" 11 #include "cc/test/fake_impl_proxy.h"
12 #include "cc/test/fake_layer_tree_host_impl.h" 12 #include "cc/test/fake_layer_tree_host_impl.h"
13 #include "cc/test/geometry_test_utils.h" 13 #include "cc/test/geometry_test_utils.h"
14 #include "cc/test/mock_occlusion_tracker.h" 14 #include "cc/test/mock_occlusion_tracker.h"
15 #include "cc/test/test_shared_bitmap_manager.h" 15 #include "cc/test/test_shared_bitmap_manager.h"
16 #include "cc/test/test_task_graph_runner.h"
16 #include "cc/trees/single_thread_proxy.h" 17 #include "cc/trees/single_thread_proxy.h"
17 #include "testing/gmock/include/gmock/gmock.h" 18 #include "testing/gmock/include/gmock/gmock.h"
18 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
19 #include "ui/gfx/transform.h" 20 #include "ui/gfx/transform.h"
20 21
21 namespace cc { 22 namespace cc {
22 namespace { 23 namespace {
23 24
24 #define EXECUTE_AND_VERIFY_SURFACE_CHANGED(code_to_test) \ 25 #define EXECUTE_AND_VERIFY_SURFACE_CHANGED(code_to_test) \
25 render_surface->ResetPropertyChangedFlag(); \ 26 render_surface->ResetPropertyChangedFlag(); \
26 code_to_test; \ 27 code_to_test; \
27 EXPECT_TRUE(render_surface->SurfacePropertyChanged()) 28 EXPECT_TRUE(render_surface->SurfacePropertyChanged())
28 29
29 #define EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(code_to_test) \ 30 #define EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(code_to_test) \
30 render_surface->ResetPropertyChangedFlag(); \ 31 render_surface->ResetPropertyChangedFlag(); \
31 code_to_test; \ 32 code_to_test; \
32 EXPECT_FALSE(render_surface->SurfacePropertyChanged()) 33 EXPECT_FALSE(render_surface->SurfacePropertyChanged())
33 34
34 TEST(RenderSurfaceTest, VerifySurfaceChangesAreTrackedProperly) { 35 TEST(RenderSurfaceTest, VerifySurfaceChangesAreTrackedProperly) {
35 // 36 //
36 // This test checks that SurfacePropertyChanged() has the correct behavior. 37 // This test checks that SurfacePropertyChanged() has the correct behavior.
37 // 38 //
38 39
39 FakeImplProxy proxy; 40 FakeImplProxy proxy;
40 TestSharedBitmapManager shared_bitmap_manager; 41 TestSharedBitmapManager shared_bitmap_manager;
41 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); 42 TestTaskGraphRunner task_graph_runner;
43 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
44 &task_graph_runner);
42 scoped_ptr<LayerImpl> owning_layer = 45 scoped_ptr<LayerImpl> owning_layer =
43 LayerImpl::Create(host_impl.active_tree(), 1); 46 LayerImpl::Create(host_impl.active_tree(), 1);
44 owning_layer->SetHasRenderSurface(true); 47 owning_layer->SetHasRenderSurface(true);
45 ASSERT_TRUE(owning_layer->render_surface()); 48 ASSERT_TRUE(owning_layer->render_surface());
46 RenderSurfaceImpl* render_surface = owning_layer->render_surface(); 49 RenderSurfaceImpl* render_surface = owning_layer->render_surface();
47 gfx::Rect test_rect(3, 4, 5, 6); 50 gfx::Rect test_rect(3, 4, 5, 6);
48 owning_layer->ResetAllChangeTrackingForSubtree(); 51 owning_layer->ResetAllChangeTrackingForSubtree();
49 52
50 // Currently, the content_rect, clip_rect, and 53 // Currently, the content_rect, clip_rect, and
51 // owning_layer->layerPropertyChanged() are the only sources of change. 54 // owning_layer->layerPropertyChanged() are the only sources of change.
(...skipping 24 matching lines...) Expand all
76 EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE( 79 EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(
77 render_surface->SetDrawTransform(dummy_matrix)); 80 render_surface->SetDrawTransform(dummy_matrix));
78 EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE( 81 EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(
79 render_surface->SetReplicaDrawTransform(dummy_matrix)); 82 render_surface->SetReplicaDrawTransform(dummy_matrix));
80 EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(render_surface->ClearLayerLists()); 83 EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(render_surface->ClearLayerLists());
81 } 84 }
82 85
83 TEST(RenderSurfaceTest, SanityCheckSurfaceCreatesCorrectSharedQuadState) { 86 TEST(RenderSurfaceTest, SanityCheckSurfaceCreatesCorrectSharedQuadState) {
84 FakeImplProxy proxy; 87 FakeImplProxy proxy;
85 TestSharedBitmapManager shared_bitmap_manager; 88 TestSharedBitmapManager shared_bitmap_manager;
86 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); 89 TestTaskGraphRunner task_graph_runner;
90 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
91 &task_graph_runner);
87 scoped_ptr<LayerImpl> root_layer = 92 scoped_ptr<LayerImpl> root_layer =
88 LayerImpl::Create(host_impl.active_tree(), 1); 93 LayerImpl::Create(host_impl.active_tree(), 1);
89 94
90 scoped_ptr<LayerImpl> owning_layer = 95 scoped_ptr<LayerImpl> owning_layer =
91 LayerImpl::Create(host_impl.active_tree(), 2); 96 LayerImpl::Create(host_impl.active_tree(), 2);
92 owning_layer->SetHasRenderSurface(true); 97 owning_layer->SetHasRenderSurface(true);
93 ASSERT_TRUE(owning_layer->render_surface()); 98 ASSERT_TRUE(owning_layer->render_surface());
94 owning_layer->draw_properties().render_target = owning_layer.get(); 99 owning_layer->draw_properties().render_target = owning_layer.get();
95 100
96 SkXfermode::Mode blend_mode = SkXfermode::kSoftLight_Mode; 101 SkXfermode::Mode blend_mode = SkXfermode::kSoftLight_Mode;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 return render_passes_; 145 return render_passes_;
141 } 146 }
142 147
143 private: 148 private:
144 RenderPassList render_passes_; 149 RenderPassList render_passes_;
145 }; 150 };
146 151
147 TEST(RenderSurfaceTest, SanityCheckSurfaceCreatesCorrectRenderPass) { 152 TEST(RenderSurfaceTest, SanityCheckSurfaceCreatesCorrectRenderPass) {
148 FakeImplProxy proxy; 153 FakeImplProxy proxy;
149 TestSharedBitmapManager shared_bitmap_manager; 154 TestSharedBitmapManager shared_bitmap_manager;
150 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); 155 TestTaskGraphRunner task_graph_runner;
156 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
157 &task_graph_runner);
151 scoped_ptr<LayerImpl> root_layer = 158 scoped_ptr<LayerImpl> root_layer =
152 LayerImpl::Create(host_impl.active_tree(), 1); 159 LayerImpl::Create(host_impl.active_tree(), 1);
153 160
154 scoped_ptr<LayerImpl> owning_layer = 161 scoped_ptr<LayerImpl> owning_layer =
155 LayerImpl::Create(host_impl.active_tree(), 2); 162 LayerImpl::Create(host_impl.active_tree(), 2);
156 owning_layer->SetHasRenderSurface(true); 163 owning_layer->SetHasRenderSurface(true);
157 ASSERT_TRUE(owning_layer->render_surface()); 164 ASSERT_TRUE(owning_layer->render_surface());
158 owning_layer->draw_properties().render_target = owning_layer.get(); 165 owning_layer->draw_properties().render_target = owning_layer.get();
159 RenderSurfaceImpl* render_surface = owning_layer->render_surface(); 166 RenderSurfaceImpl* render_surface = owning_layer->render_surface();
160 167
(...skipping 13 matching lines...) Expand all
174 ASSERT_EQ(1u, pass_sink.RenderPasses().size()); 181 ASSERT_EQ(1u, pass_sink.RenderPasses().size());
175 RenderPass* pass = pass_sink.RenderPasses()[0]; 182 RenderPass* pass = pass_sink.RenderPasses()[0];
176 183
177 EXPECT_EQ(RenderPassId(2, 0), pass->id); 184 EXPECT_EQ(RenderPassId(2, 0), pass->id);
178 EXPECT_EQ(content_rect, pass->output_rect); 185 EXPECT_EQ(content_rect, pass->output_rect);
179 EXPECT_EQ(origin, pass->transform_to_root_target); 186 EXPECT_EQ(origin, pass->transform_to_root_target);
180 } 187 }
181 188
182 } // namespace 189 } // namespace
183 } // namespace cc 190 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_unittest.cc ('k') | cc/layers/scrollbar_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698