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

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

Issue 1028333002: Chromium -> Mojo roll. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 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/trees/damage_tracker.cc ('k') | cc/trees/layer_tree_host.h » ('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 "cc/base/math_util.h" 7 #include "cc/base/math_util.h"
8 #include "cc/layers/layer_impl.h" 8 #include "cc/layers/layer_impl.h"
9 #include "cc/output/filter_operation.h" 9 #include "cc/output/filter_operation.h"
10 #include "cc/output/filter_operations.h" 10 #include "cc/output/filter_operations.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/test_shared_bitmap_manager.h" 14 #include "cc/test/test_shared_bitmap_manager.h"
15 #include "cc/test/test_task_graph_runner.h"
15 #include "cc/trees/layer_tree_host_common.h" 16 #include "cc/trees/layer_tree_host_common.h"
16 #include "cc/trees/single_thread_proxy.h" 17 #include "cc/trees/single_thread_proxy.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 #include "third_party/skia/include/effects/SkBlurImageFilter.h" 19 #include "third_party/skia/include/effects/SkBlurImageFilter.h"
19 #include "ui/gfx/geometry/quad_f.h" 20 #include "ui/gfx/geometry/quad_f.h"
20 #include "ui/gfx/geometry/rect_conversions.h" 21 #include "ui/gfx/geometry/rect_conversions.h"
21 22
22 namespace cc { 23 namespace cc {
23 namespace { 24 namespace {
24 25
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 target_surface->content_rect(), 68 target_surface->content_rect(),
68 render_surface_layer_list[i]->mask_layer(), 69 render_surface_layer_list[i]->mask_layer(),
69 render_surface_layer_list[i]->filters()); 70 render_surface_layer_list[i]->filters());
70 } 71 }
71 72
72 root->ResetAllChangeTrackingForSubtree(); 73 root->ResetAllChangeTrackingForSubtree();
73 } 74 }
74 75
75 class DamageTrackerTest : public testing::Test { 76 class DamageTrackerTest : public testing::Test {
76 public: 77 public:
77 DamageTrackerTest() : host_impl_(&proxy_, &shared_bitmap_manager_) {} 78 DamageTrackerTest()
79 : host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_) {}
78 80
79 scoped_ptr<LayerImpl> CreateTestTreeWithOneSurface() { 81 scoped_ptr<LayerImpl> CreateTestTreeWithOneSurface() {
80 scoped_ptr<LayerImpl> root = 82 scoped_ptr<LayerImpl> root =
81 LayerImpl::Create(host_impl_.active_tree(), 1); 83 LayerImpl::Create(host_impl_.active_tree(), 1);
82 scoped_ptr<LayerImpl> child = 84 scoped_ptr<LayerImpl> child =
83 LayerImpl::Create(host_impl_.active_tree(), 2); 85 LayerImpl::Create(host_impl_.active_tree(), 2);
84 86
85 root->SetPosition(gfx::PointF()); 87 root->SetPosition(gfx::PointF());
86 root->SetBounds(gfx::Size(500, 500)); 88 root->SetBounds(gfx::Size(500, 500));
87 root->SetContentBounds(gfx::Size(500, 500)); 89 root->SetContentBounds(gfx::Size(500, 500));
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 // Setup includes going past the first frame which always damages 171 // Setup includes going past the first frame which always damages
170 // everything, so that we can actually perform specific tests. 172 // everything, so that we can actually perform specific tests.
171 EmulateDrawingOneFrame(root.get()); 173 EmulateDrawingOneFrame(root.get());
172 174
173 return root.Pass(); 175 return root.Pass();
174 } 176 }
175 177
176 protected: 178 protected:
177 FakeImplProxy proxy_; 179 FakeImplProxy proxy_;
178 TestSharedBitmapManager shared_bitmap_manager_; 180 TestSharedBitmapManager shared_bitmap_manager_;
181 TestTaskGraphRunner task_graph_runner_;
179 FakeLayerTreeHostImpl host_impl_; 182 FakeLayerTreeHostImpl host_impl_;
180 }; 183 };
181 184
182 TEST_F(DamageTrackerTest, SanityCheckTestTreeWithOneSurface) { 185 TEST_F(DamageTrackerTest, SanityCheckTestTreeWithOneSurface) {
183 // Sanity check that the simple test tree will actually produce the expected 186 // Sanity check that the simple test tree will actually produce the expected
184 // render surfaces and layer lists. 187 // render surfaces and layer lists.
185 188
186 scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithOneSurface(); 189 scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithOneSurface();
187 190
188 EXPECT_EQ(2u, root->render_surface()->layer_list().size()); 191 EXPECT_EQ(2u, root->render_surface()->layer_list().size());
(...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1462 gfx::Rect root_damage_rect = 1465 gfx::Rect root_damage_rect =
1463 root->render_surface()->damage_tracker()->current_damage_rect(); 1466 root->render_surface()->damage_tracker()->current_damage_rect();
1464 gfx::Rect damage_we_care_about = gfx::Rect(i, i); 1467 gfx::Rect damage_we_care_about = gfx::Rect(i, i);
1465 EXPECT_LE(damage_we_care_about.right(), root_damage_rect.right()); 1468 EXPECT_LE(damage_we_care_about.right(), root_damage_rect.right());
1466 EXPECT_LE(damage_we_care_about.bottom(), root_damage_rect.bottom()); 1469 EXPECT_LE(damage_we_care_about.bottom(), root_damage_rect.bottom());
1467 } 1470 }
1468 } 1471 }
1469 1472
1470 } // namespace 1473 } // namespace
1471 } // namespace cc 1474 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/damage_tracker.cc ('k') | cc/trees/layer_tree_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698