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

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

Issue 1800923002: cc: Directly use property trees to calculate clip rect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix perftests compile by not verify clip tree calc there Created 4 years, 7 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/layer_tree_impl.cc ('k') | cc/trees/layer_tree_settings.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/layer_tree_impl.h" 5 #include "cc/trees/layer_tree_impl.h"
6 6
7 #include "cc/layers/heads_up_display_layer_impl.h" 7 #include "cc/layers/heads_up_display_layer_impl.h"
8 #include "cc/layers/layer.h" 8 #include "cc/layers/layer.h"
9 #include "cc/layers/solid_color_scrollbar_layer_impl.h" 9 #include "cc/layers/solid_color_scrollbar_layer_impl.h"
10 #include "cc/test/fake_impl_task_runner_provider.h" 10 #include "cc/test/fake_impl_task_runner_provider.h"
11 #include "cc/test/fake_layer_tree_host_impl.h" 11 #include "cc/test/fake_layer_tree_host_impl.h"
12 #include "cc/test/fake_output_surface.h" 12 #include "cc/test/fake_output_surface.h"
13 #include "cc/test/geometry_test_utils.h" 13 #include "cc/test/geometry_test_utils.h"
14 #include "cc/test/layer_tree_host_common_test.h" 14 #include "cc/test/layer_tree_host_common_test.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/test/test_task_graph_runner.h"
17 #include "cc/trees/draw_property_utils.h" 17 #include "cc/trees/draw_property_utils.h"
18 #include "cc/trees/layer_tree_host_impl.h" 18 #include "cc/trees/layer_tree_host_impl.h"
19 #include "ui/gfx/geometry/size_conversions.h" 19 #include "ui/gfx/geometry/size_conversions.h"
20 20
21 namespace cc { 21 namespace cc {
22 namespace { 22 namespace {
23 23
24 class LayerTreeImplTest : public LayerTreeHostCommonTest { 24 class LayerTreeImplTest : public LayerTreeHostCommonTest {
25 public: 25 public:
26 LayerTreeImplTest() : output_surface_(FakeOutputSurface::Create3d()) { 26 LayerTreeImplTest() : output_surface_(FakeOutputSurface::Create3d()) {
27 LayerTreeSettings settings; 27 LayerTreeSettings settings;
28 settings.layer_transforms_should_scale_layer_contents = true; 28 settings.layer_transforms_should_scale_layer_contents = true;
29 settings.verify_clip_tree_calculations = true;
29 host_impl_.reset(new FakeLayerTreeHostImpl(settings, &task_runner_provider_, 30 host_impl_.reset(new FakeLayerTreeHostImpl(settings, &task_runner_provider_,
30 &shared_bitmap_manager_, 31 &shared_bitmap_manager_,
31 &task_graph_runner_)); 32 &task_graph_runner_));
32 host_impl_->SetVisible(true); 33 host_impl_->SetVisible(true);
33 EXPECT_TRUE(host_impl_->InitializeRenderer(output_surface_.get())); 34 EXPECT_TRUE(host_impl_->InitializeRenderer(output_surface_.get()));
34 } 35 }
35 36
36 FakeLayerTreeHostImpl& host_impl() { return *host_impl_; } 37 FakeLayerTreeHostImpl& host_impl() { return *host_impl_; }
37 38
38 LayerImpl* root_layer() { return host_impl_->active_tree()->root_layer(); } 39 LayerImpl* root_layer() { return host_impl_->active_tree()->root_layer(); }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 ASSERT_TRUE(result_layer); 103 ASSERT_TRUE(result_layer);
103 EXPECT_EQ(12345, result_layer->id()); 104 EXPECT_EQ(12345, result_layer->id());
104 } 105 }
105 106
106 TEST_F(LayerTreeImplTest, UpdateViewportAndHitTest) { 107 TEST_F(LayerTreeImplTest, UpdateViewportAndHitTest) {
107 // Ensures that the viewport rect is correctly updated by the clip tree. 108 // Ensures that the viewport rect is correctly updated by the clip tree.
108 TestSharedBitmapManager shared_bitmap_manager; 109 TestSharedBitmapManager shared_bitmap_manager;
109 TestTaskGraphRunner task_graph_runner; 110 TestTaskGraphRunner task_graph_runner;
110 FakeImplTaskRunnerProvider task_runner_provider; 111 FakeImplTaskRunnerProvider task_runner_provider;
111 LayerTreeSettings settings; 112 LayerTreeSettings settings;
113 settings.verify_clip_tree_calculations = true;
112 std::unique_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); 114 std::unique_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d();
113 std::unique_ptr<FakeLayerTreeHostImpl> host_impl; 115 std::unique_ptr<FakeLayerTreeHostImpl> host_impl;
114 host_impl.reset(new FakeLayerTreeHostImpl(settings, &task_runner_provider, 116 host_impl.reset(new FakeLayerTreeHostImpl(settings, &task_runner_provider,
115 &shared_bitmap_manager, 117 &shared_bitmap_manager,
116 &task_graph_runner)); 118 &task_graph_runner));
117 host_impl->SetVisible(true); 119 host_impl->SetVisible(true);
118 EXPECT_TRUE(host_impl->InitializeRenderer(output_surface.get())); 120 EXPECT_TRUE(host_impl->InitializeRenderer(output_surface.get()));
119 std::unique_ptr<LayerImpl> root = 121 std::unique_ptr<LayerImpl> root =
120 LayerImpl::Create(host_impl->active_tree(), 12345); 122 LayerImpl::Create(host_impl->active_tree(), 12345);
121 123
(...skipping 2419 matching lines...) Expand 10 before | Expand all | Expand 10 after
2541 gfx::PointF test_point = gfx::PointF(1.f, 1.f); 2543 gfx::PointF test_point = gfx::PointF(1.f, 1.f);
2542 LayerImpl* result_layer = 2544 LayerImpl* result_layer =
2543 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); 2545 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
2544 2546
2545 CHECK(result_layer); 2547 CHECK(result_layer);
2546 EXPECT_EQ(2, result_layer->id()); 2548 EXPECT_EQ(2, result_layer->id());
2547 } 2549 }
2548 2550
2549 } // namespace 2551 } // namespace
2550 } // namespace cc 2552 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_impl.cc ('k') | cc/trees/layer_tree_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698