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

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: add setting to only calculate and verify in cc_unittest Created 4 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
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 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); 114 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d();
113 scoped_ptr<FakeLayerTreeHostImpl> host_impl; 115 scoped_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 scoped_ptr<LayerImpl> root = 121 scoped_ptr<LayerImpl> root =
120 LayerImpl::Create(host_impl->active_tree(), 12345); 122 LayerImpl::Create(host_impl->active_tree(), 12345);
121 123
(...skipping 2255 matching lines...) Expand 10 before | Expand all | Expand 10 after
2377 TEST_F(LayerTreeImplTest, DeviceScaleFactorNeedsDrawPropertiesUpdate) { 2379 TEST_F(LayerTreeImplTest, DeviceScaleFactorNeedsDrawPropertiesUpdate) {
2378 host_impl().active_tree()->SetDeviceScaleFactor(1.f); 2380 host_impl().active_tree()->SetDeviceScaleFactor(1.f);
2379 host_impl().active_tree()->UpdateDrawProperties(false); 2381 host_impl().active_tree()->UpdateDrawProperties(false);
2380 EXPECT_FALSE(host_impl().active_tree()->needs_update_draw_properties()); 2382 EXPECT_FALSE(host_impl().active_tree()->needs_update_draw_properties());
2381 host_impl().active_tree()->SetDeviceScaleFactor(2.f); 2383 host_impl().active_tree()->SetDeviceScaleFactor(2.f);
2382 EXPECT_TRUE(host_impl().active_tree()->needs_update_draw_properties()); 2384 EXPECT_TRUE(host_impl().active_tree()->needs_update_draw_properties());
2383 } 2385 }
2384 2386
2385 } // namespace 2387 } // namespace
2386 } // namespace cc 2388 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698