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

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

Issue 2080703005: cc: Remove LayerTreeImpl::root_layer usage outside tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/occlusion_tracker.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 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"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin, 128 SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
129 position, bounds, true, false, true); 129 position, bounds, true, false, true);
130 root->SetDrawsContent(true); 130 root->SetDrawsContent(true);
131 131
132 host_impl->SetViewportSize(root->bounds()); 132 host_impl->SetViewportSize(root->bounds());
133 host_impl->active_tree()->SetRootLayer(std::move(root)); 133 host_impl->active_tree()->SetRootLayer(std::move(root));
134 host_impl->UpdateNumChildrenAndDrawPropertiesForActiveTree(); 134 host_impl->UpdateNumChildrenAndDrawPropertiesForActiveTree();
135 EXPECT_EQ( 135 EXPECT_EQ(
136 gfx::RectF(gfx::SizeF(bounds)), 136 gfx::RectF(gfx::SizeF(bounds)),
137 host_impl->active_tree()->property_trees()->clip_tree.ViewportClip()); 137 host_impl->active_tree()->property_trees()->clip_tree.ViewportClip());
138 EXPECT_EQ(gfx::Rect(bounds), host_impl->RootLayer()->visible_layer_rect()); 138 EXPECT_EQ(gfx::Rect(bounds),
139 host_impl->active_tree()->root_layer()->visible_layer_rect());
139 140
140 gfx::Size new_bounds(50, 50); 141 gfx::Size new_bounds(50, 50);
141 host_impl->SetViewportSize(new_bounds); 142 host_impl->SetViewportSize(new_bounds);
142 gfx::PointF test_point(51.f, 51.f); 143 gfx::PointF test_point(51.f, 51.f);
143 host_impl->active_tree()->FindLayerThatIsHitByPoint(test_point); 144 host_impl->active_tree()->FindLayerThatIsHitByPoint(test_point);
144 EXPECT_EQ( 145 EXPECT_EQ(
145 gfx::RectF(gfx::SizeF(new_bounds)), 146 gfx::RectF(gfx::SizeF(new_bounds)),
146 host_impl->active_tree()->property_trees()->clip_tree.ViewportClip()); 147 host_impl->active_tree()->property_trees()->clip_tree.ViewportClip());
147 EXPECT_EQ(gfx::Rect(new_bounds), 148 EXPECT_EQ(gfx::Rect(new_bounds),
148 host_impl->RootLayer()->visible_layer_rect()); 149 host_impl->active_tree()->root_layer()->visible_layer_rect());
149 } 150 }
150 151
151 TEST_F(LayerTreeImplTest, HitTestingForSingleLayerAndHud) { 152 TEST_F(LayerTreeImplTest, HitTestingForSingleLayerAndHud) {
152 std::unique_ptr<LayerImpl> root = 153 std::unique_ptr<LayerImpl> root =
153 LayerImpl::Create(host_impl().active_tree(), 12345); 154 LayerImpl::Create(host_impl().active_tree(), 12345);
154 std::unique_ptr<HeadsUpDisplayLayerImpl> hud = 155 std::unique_ptr<HeadsUpDisplayLayerImpl> hud =
155 HeadsUpDisplayLayerImpl::Create(host_impl().active_tree(), 11111); 156 HeadsUpDisplayLayerImpl::Create(host_impl().active_tree(), 11111);
156 157
157 gfx::Transform identity_matrix; 158 gfx::Transform identity_matrix;
158 gfx::Point3F transform_origin; 159 gfx::Point3F transform_origin;
(...skipping 2387 matching lines...) Expand 10 before | Expand all | Expand 10 after
2546 gfx::PointF test_point = gfx::PointF(1.f, 1.f); 2547 gfx::PointF test_point = gfx::PointF(1.f, 1.f);
2547 LayerImpl* result_layer = 2548 LayerImpl* result_layer =
2548 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); 2549 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
2549 2550
2550 CHECK(result_layer); 2551 CHECK(result_layer);
2551 EXPECT_EQ(2, result_layer->id()); 2552 EXPECT_EQ(2, result_layer->id());
2552 } 2553 }
2553 2554
2554 } // namespace 2555 } // namespace
2555 } // namespace cc 2556 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_impl.cc ('k') | cc/trees/occlusion_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698