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

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

Issue 608503005: Revert of cc: Remove use of PassAs() and constructor-casting with scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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_perftest.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/test/fake_impl_proxy.h" 9 #include "cc/test/fake_impl_proxy.h"
10 #include "cc/test/fake_layer_tree_host_impl.h" 10 #include "cc/test/fake_layer_tree_host_impl.h"
11 #include "cc/test/fake_output_surface.h" 11 #include "cc/test/fake_output_surface.h"
12 #include "cc/test/geometry_test_utils.h" 12 #include "cc/test/geometry_test_utils.h"
13 #include "cc/test/layer_tree_host_common_test.h" 13 #include "cc/test/layer_tree_host_common_test.h"
14 #include "cc/test/test_shared_bitmap_manager.h" 14 #include "cc/test/test_shared_bitmap_manager.h"
15 #include "cc/trees/layer_tree_host_impl.h" 15 #include "cc/trees/layer_tree_host_impl.h"
16 #include "ui/gfx/size_conversions.h" 16 #include "ui/gfx/size_conversions.h"
17 17
18 namespace cc { 18 namespace cc {
19 namespace { 19 namespace {
20 20
21 class LayerTreeImplTest : public LayerTreeHostCommonTest { 21 class LayerTreeImplTest : public LayerTreeHostCommonTest {
22 public: 22 public:
23 LayerTreeImplTest() { 23 LayerTreeImplTest() {
24 LayerTreeSettings settings; 24 LayerTreeSettings settings;
25 settings.layer_transforms_should_scale_layer_contents = true; 25 settings.layer_transforms_should_scale_layer_contents = true;
26 host_impl_.reset( 26 host_impl_.reset(
27 new FakeLayerTreeHostImpl(settings, &proxy_, &shared_bitmap_manager_)); 27 new FakeLayerTreeHostImpl(settings, &proxy_, &shared_bitmap_manager_));
28 EXPECT_TRUE(host_impl_->InitializeRenderer(FakeOutputSurface::Create3d())); 28 EXPECT_TRUE(host_impl_->InitializeRenderer(
29 FakeOutputSurface::Create3d().PassAs<OutputSurface>()));
29 } 30 }
30 31
31 FakeLayerTreeHostImpl& host_impl() { return *host_impl_; } 32 FakeLayerTreeHostImpl& host_impl() { return *host_impl_; }
32 33
33 LayerImpl* root_layer() { return host_impl_->active_tree()->root_layer(); } 34 LayerImpl* root_layer() { return host_impl_->active_tree()->root_layer(); }
34 35
35 const LayerImplList& RenderSurfaceLayerList() const { 36 const LayerImplList& RenderSurfaceLayerList() const {
36 return host_impl_->active_tree()->RenderSurfaceLayerList(); 37 return host_impl_->active_tree()->RenderSurfaceLayerList();
37 } 38 }
38 39
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 SetLayerPropertiesForTesting(hud.get(), 117 SetLayerPropertiesForTesting(hud.get(),
117 identity_matrix, 118 identity_matrix,
118 transform_origin, 119 transform_origin,
119 position, 120 position,
120 hud_bounds, 121 hud_bounds,
121 true, 122 true,
122 false); 123 false);
123 hud->SetDrawsContent(true); 124 hud->SetDrawsContent(true);
124 125
125 host_impl().active_tree()->set_hud_layer(hud.get()); 126 host_impl().active_tree()->set_hud_layer(hud.get());
126 root->AddChild(hud.Pass()); 127 root->AddChild(hud.PassAs<LayerImpl>());
127 128
128 host_impl().SetViewportSize(hud_bounds); 129 host_impl().SetViewportSize(hud_bounds);
129 host_impl().active_tree()->SetRootLayer(root.Pass()); 130 host_impl().active_tree()->SetRootLayer(root.Pass());
130 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 131 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
131 132
132 // Sanity check the scenario we just created. 133 // Sanity check the scenario we just created.
133 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 134 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
134 ASSERT_EQ(2u, root_layer()->render_surface()->layer_list().size()); 135 ASSERT_EQ(2u, root_layer()->render_surface()->layer_list().size());
135 136
136 // Hit testing for a point inside HUD, but outside root should return null 137 // Hit testing for a point inside HUD, but outside root should return null
(...skipping 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after
2356 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); 2357 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers());
2357 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); 2358 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1);
2358 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2)); 2359 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2));
2359 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3)); 2360 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3));
2360 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4)); 2361 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4));
2361 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers()); 2362 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers());
2362 } 2363 }
2363 2364
2364 } // namespace 2365 } // namespace
2365 } // namespace cc 2366 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_impl.cc ('k') | cc/trees/occlusion_tracker_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698