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

Side by Side Diff: cc/trees/damage_tracker_unittest.cc

Issue 2452483002: Move GpuMemoryBufferManager and SharedBitmapManager to CompositorFrameSink (Closed)
Patch Set: rebase Created 4 years, 1 month 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/tiles/tile_manager_unittest.cc ('k') | cc/trees/layer_tree_host_common_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/trees/damage_tracker.h" 5 #include "cc/trees/damage_tracker.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "cc/base/math_util.h" 9 #include "cc/base/math_util.h"
10 #include "cc/layers/layer_impl.h" 10 #include "cc/layers/layer_impl.h"
11 #include "cc/output/filter_operation.h" 11 #include "cc/output/filter_operation.h"
12 #include "cc/output/filter_operations.h" 12 #include "cc/output/filter_operations.h"
13 #include "cc/test/fake_impl_task_runner_provider.h" 13 #include "cc/test/fake_impl_task_runner_provider.h"
14 #include "cc/test/fake_layer_tree_host_impl.h" 14 #include "cc/test/fake_layer_tree_host_impl.h"
15 #include "cc/test/geometry_test_utils.h" 15 #include "cc/test/geometry_test_utils.h"
16 #include "cc/test/test_shared_bitmap_manager.h"
17 #include "cc/test/test_task_graph_runner.h" 16 #include "cc/test/test_task_graph_runner.h"
18 #include "cc/trees/layer_tree_host_common.h" 17 #include "cc/trees/layer_tree_host_common.h"
19 #include "cc/trees/layer_tree_impl.h" 18 #include "cc/trees/layer_tree_impl.h"
20 #include "cc/trees/single_thread_proxy.h" 19 #include "cc/trees/single_thread_proxy.h"
21 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
22 #include "third_party/skia/include/effects/SkBlurImageFilter.h" 21 #include "third_party/skia/include/effects/SkBlurImageFilter.h"
23 #include "ui/gfx/geometry/quad_f.h" 22 #include "ui/gfx/geometry/quad_f.h"
24 #include "ui/gfx/geometry/rect_conversions.h" 23 #include "ui/gfx/geometry/rect_conversions.h"
25 24
26 namespace cc { 25 namespace cc {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 target_surface->content_rect(), target_surface->MaskLayer(), 78 target_surface->content_rect(), target_surface->MaskLayer(),
80 target_surface->Filters()); 79 target_surface->Filters());
81 } 80 }
82 81
83 root->layer_tree_impl()->ResetAllChangeTracking(); 82 root->layer_tree_impl()->ResetAllChangeTracking();
84 } 83 }
85 84
86 class DamageTrackerTest : public testing::Test { 85 class DamageTrackerTest : public testing::Test {
87 public: 86 public:
88 DamageTrackerTest() 87 DamageTrackerTest()
89 : host_impl_(&task_runner_provider_, 88 : host_impl_(&task_runner_provider_, &task_graph_runner_) {}
90 &shared_bitmap_manager_,
91 &task_graph_runner_) {}
92 89
93 LayerImpl* CreateTestTreeWithOneSurface() { 90 LayerImpl* CreateTestTreeWithOneSurface() {
94 host_impl_.active_tree()->DetachLayers(); 91 host_impl_.active_tree()->DetachLayers();
95 std::unique_ptr<LayerImpl> root = 92 std::unique_ptr<LayerImpl> root =
96 LayerImpl::Create(host_impl_.active_tree(), 1); 93 LayerImpl::Create(host_impl_.active_tree(), 1);
97 std::unique_ptr<LayerImpl> child = 94 std::unique_ptr<LayerImpl> child =
98 LayerImpl::Create(host_impl_.active_tree(), 2); 95 LayerImpl::Create(host_impl_.active_tree(), 2);
99 96
100 root->SetPosition(gfx::PointF()); 97 root->SetPosition(gfx::PointF());
101 root->SetBounds(gfx::Size(500, 500)); 98 root->SetBounds(gfx::Size(500, 500));
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 // Setup includes going past the first frame which always damages 176 // Setup includes going past the first frame which always damages
180 // everything, so that we can actually perform specific tests. 177 // everything, so that we can actually perform specific tests.
181 root->layer_tree_impl()->property_trees()->needs_rebuild = true; 178 root->layer_tree_impl()->property_trees()->needs_rebuild = true;
182 EmulateDrawingOneFrame(root); 179 EmulateDrawingOneFrame(root);
183 180
184 return root; 181 return root;
185 } 182 }
186 183
187 protected: 184 protected:
188 FakeImplTaskRunnerProvider task_runner_provider_; 185 FakeImplTaskRunnerProvider task_runner_provider_;
189 TestSharedBitmapManager shared_bitmap_manager_;
190 TestTaskGraphRunner task_graph_runner_; 186 TestTaskGraphRunner task_graph_runner_;
191 FakeLayerTreeHostImpl host_impl_; 187 FakeLayerTreeHostImpl host_impl_;
192 }; 188 };
193 189
194 TEST_F(DamageTrackerTest, SanityCheckTestTreeWithOneSurface) { 190 TEST_F(DamageTrackerTest, SanityCheckTestTreeWithOneSurface) {
195 // Sanity check that the simple test tree will actually produce the expected 191 // Sanity check that the simple test tree will actually produce the expected
196 // render surfaces and layer lists. 192 // render surfaces and layer lists.
197 193
198 LayerImpl* root = CreateAndSetUpTestTreeWithOneSurface(); 194 LayerImpl* root = CreateAndSetUpTestTreeWithOneSurface();
199 195
(...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1433 gfx::Rect root_damage_rect = 1429 gfx::Rect root_damage_rect =
1434 root->render_surface()->damage_tracker()->current_damage_rect(); 1430 root->render_surface()->damage_tracker()->current_damage_rect();
1435 gfx::Rect damage_we_care_about = gfx::Rect(i, i); 1431 gfx::Rect damage_we_care_about = gfx::Rect(i, i);
1436 EXPECT_LE(damage_we_care_about.right(), root_damage_rect.right()); 1432 EXPECT_LE(damage_we_care_about.right(), root_damage_rect.right());
1437 EXPECT_LE(damage_we_care_about.bottom(), root_damage_rect.bottom()); 1433 EXPECT_LE(damage_we_care_about.bottom(), root_damage_rect.bottom());
1438 } 1434 }
1439 } 1435 }
1440 1436
1441 } // namespace 1437 } // namespace
1442 } // namespace cc 1438 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/tile_manager_unittest.cc ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698