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

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

Issue 2112973003: cc: Add verify transform tree calculations to LayerTreeSettings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: "TODO" Created 4 years, 5 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 settings.verify_clip_tree_calculations = true;
30 settings.verify_transform_tree_calculations = true;
30 host_impl_.reset(new FakeLayerTreeHostImpl(settings, &task_runner_provider_, 31 host_impl_.reset(new FakeLayerTreeHostImpl(settings, &task_runner_provider_,
31 &shared_bitmap_manager_, 32 &shared_bitmap_manager_,
32 &task_graph_runner_)); 33 &task_graph_runner_));
33 host_impl_->SetVisible(true); 34 host_impl_->SetVisible(true);
34 EXPECT_TRUE(host_impl_->InitializeRenderer(output_surface_.get())); 35 EXPECT_TRUE(host_impl_->InitializeRenderer(output_surface_.get()));
35 } 36 }
36 37
37 FakeLayerTreeHostImpl& host_impl() { return *host_impl_; } 38 FakeLayerTreeHostImpl& host_impl() { return *host_impl_; }
38 39
39 LayerImpl* root_layer() { 40 LayerImpl* root_layer() {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 EXPECT_EQ(12345, result_layer->id()); 107 EXPECT_EQ(12345, result_layer->id());
107 } 108 }
108 109
109 TEST_F(LayerTreeImplTest, UpdateViewportAndHitTest) { 110 TEST_F(LayerTreeImplTest, UpdateViewportAndHitTest) {
110 // Ensures that the viewport rect is correctly updated by the clip tree. 111 // Ensures that the viewport rect is correctly updated by the clip tree.
111 TestSharedBitmapManager shared_bitmap_manager; 112 TestSharedBitmapManager shared_bitmap_manager;
112 TestTaskGraphRunner task_graph_runner; 113 TestTaskGraphRunner task_graph_runner;
113 FakeImplTaskRunnerProvider task_runner_provider; 114 FakeImplTaskRunnerProvider task_runner_provider;
114 LayerTreeSettings settings; 115 LayerTreeSettings settings;
115 settings.verify_clip_tree_calculations = true; 116 settings.verify_clip_tree_calculations = true;
117 settings.verify_transform_tree_calculations = true;
116 std::unique_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); 118 std::unique_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d();
117 std::unique_ptr<FakeLayerTreeHostImpl> host_impl; 119 std::unique_ptr<FakeLayerTreeHostImpl> host_impl;
118 host_impl.reset(new FakeLayerTreeHostImpl(settings, &task_runner_provider, 120 host_impl.reset(new FakeLayerTreeHostImpl(settings, &task_runner_provider,
119 &shared_bitmap_manager, 121 &shared_bitmap_manager,
120 &task_graph_runner)); 122 &task_graph_runner));
121 host_impl->SetVisible(true); 123 host_impl->SetVisible(true);
122 EXPECT_TRUE(host_impl->InitializeRenderer(output_surface.get())); 124 EXPECT_TRUE(host_impl->InitializeRenderer(output_surface.get()));
123 std::unique_ptr<LayerImpl> root = 125 std::unique_ptr<LayerImpl> root =
124 LayerImpl::Create(host_impl->active_tree(), 12345); 126 LayerImpl::Create(host_impl->active_tree(), 12345);
125 127
(...skipping 2438 matching lines...) Expand 10 before | Expand all | Expand 10 after
2564 gfx::PointF test_point = gfx::PointF(1.f, 1.f); 2566 gfx::PointF test_point = gfx::PointF(1.f, 1.f);
2565 LayerImpl* result_layer = 2567 LayerImpl* result_layer =
2566 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); 2568 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
2567 2569
2568 CHECK(result_layer); 2570 CHECK(result_layer);
2569 EXPECT_EQ(2, result_layer->id()); 2571 EXPECT_EQ(2, result_layer->id());
2570 } 2572 }
2571 2573
2572 } // namespace 2574 } // namespace
2573 } // namespace cc 2575 } // 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