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

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

Issue 1411663002: cc: Split Proxy to eliminate unnecessary dependencies on the impl side (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update perf tests. Created 5 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_unittest.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_proxy.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/layer_tree_host_impl.h" 17 #include "cc/trees/layer_tree_host_impl.h"
18 #include "ui/gfx/geometry/size_conversions.h" 18 #include "ui/gfx/geometry/size_conversions.h"
19 19
20 namespace cc { 20 namespace cc {
21 namespace { 21 namespace {
22 22
23 class LayerTreeImplTest : public LayerTreeHostCommonTest { 23 class LayerTreeImplTest : public LayerTreeHostCommonTest {
24 public: 24 public:
25 LayerTreeImplTest() : output_surface_(FakeOutputSurface::Create3d()) { 25 LayerTreeImplTest() : output_surface_(FakeOutputSurface::Create3d()) {
26 LayerTreeSettings settings; 26 LayerTreeSettings settings;
27 settings.layer_transforms_should_scale_layer_contents = true; 27 settings.layer_transforms_should_scale_layer_contents = true;
28 settings.verify_property_trees = true; 28 settings.verify_property_trees = true;
29 host_impl_.reset(new FakeLayerTreeHostImpl( 29 host_impl_.reset(new FakeLayerTreeHostImpl(settings, &task_runner_provider_,
30 settings, &proxy_, &shared_bitmap_manager_, &task_graph_runner_)); 30 &shared_bitmap_manager_,
31 &task_graph_runner_));
31 host_impl_->SetVisible(true); 32 host_impl_->SetVisible(true);
32 EXPECT_TRUE(host_impl_->InitializeRenderer(output_surface_.get())); 33 EXPECT_TRUE(host_impl_->InitializeRenderer(output_surface_.get()));
33 } 34 }
34 35
35 FakeLayerTreeHostImpl& host_impl() { return *host_impl_; } 36 FakeLayerTreeHostImpl& host_impl() { return *host_impl_; }
36 37
37 LayerImpl* root_layer() { return host_impl_->active_tree()->root_layer(); } 38 LayerImpl* root_layer() { return host_impl_->active_tree()->root_layer(); }
38 39
39 const LayerImplList& RenderSurfaceLayerList() const { 40 const LayerImplList& RenderSurfaceLayerList() const {
40 return host_impl_->active_tree()->RenderSurfaceLayerList(); 41 return host_impl_->active_tree()->RenderSurfaceLayerList();
41 } 42 }
42 43
43 private: 44 private:
44 TestSharedBitmapManager shared_bitmap_manager_; 45 TestSharedBitmapManager shared_bitmap_manager_;
45 TestTaskGraphRunner task_graph_runner_; 46 TestTaskGraphRunner task_graph_runner_;
46 FakeImplProxy proxy_; 47 FakeImplTaskRunnerProvider task_runner_provider_;
47 scoped_ptr<OutputSurface> output_surface_; 48 scoped_ptr<OutputSurface> output_surface_;
48 scoped_ptr<FakeLayerTreeHostImpl> host_impl_; 49 scoped_ptr<FakeLayerTreeHostImpl> host_impl_;
49 }; 50 };
50 51
51 TEST_F(LayerTreeImplTest, HitTestingForSingleLayer) { 52 TEST_F(LayerTreeImplTest, HitTestingForSingleLayer) {
52 scoped_ptr<LayerImpl> root = 53 scoped_ptr<LayerImpl> root =
53 LayerImpl::Create(host_impl().active_tree(), 12345); 54 LayerImpl::Create(host_impl().active_tree(), 12345);
54 55
55 gfx::Transform identity_matrix; 56 gfx::Transform identity_matrix;
56 gfx::Point3F transform_origin; 57 gfx::Point3F transform_origin;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 result_layer = 91 result_layer =
91 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); 92 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
92 ASSERT_TRUE(result_layer); 93 ASSERT_TRUE(result_layer);
93 EXPECT_EQ(12345, result_layer->id()); 94 EXPECT_EQ(12345, result_layer->id());
94 } 95 }
95 96
96 TEST_F(LayerTreeImplTest, UpdateViewportAndHitTest) { 97 TEST_F(LayerTreeImplTest, UpdateViewportAndHitTest) {
97 // Ensures that the viewport rect is correctly updated by the clip tree. 98 // Ensures that the viewport rect is correctly updated by the clip tree.
98 TestSharedBitmapManager shared_bitmap_manager; 99 TestSharedBitmapManager shared_bitmap_manager;
99 TestTaskGraphRunner task_graph_runner; 100 TestTaskGraphRunner task_graph_runner;
100 FakeImplProxy proxy; 101 FakeImplTaskRunnerProvider task_runner_provider;
101 LayerTreeSettings settings; 102 LayerTreeSettings settings;
102 settings.verify_property_trees = true; 103 settings.verify_property_trees = true;
103 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); 104 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d();
104 scoped_ptr<FakeLayerTreeHostImpl> host_impl; 105 scoped_ptr<FakeLayerTreeHostImpl> host_impl;
105 host_impl.reset(new FakeLayerTreeHostImpl( 106 host_impl.reset(new FakeLayerTreeHostImpl(settings, &task_runner_provider,
106 settings, &proxy, &shared_bitmap_manager, &task_graph_runner)); 107 &shared_bitmap_manager,
108 &task_graph_runner));
107 host_impl->SetVisible(true); 109 host_impl->SetVisible(true);
108 EXPECT_TRUE(host_impl->InitializeRenderer(output_surface.get())); 110 EXPECT_TRUE(host_impl->InitializeRenderer(output_surface.get()));
109 scoped_ptr<LayerImpl> root = 111 scoped_ptr<LayerImpl> root =
110 LayerImpl::Create(host_impl->active_tree(), 12345); 112 LayerImpl::Create(host_impl->active_tree(), 12345);
111 113
112 gfx::Transform identity_matrix; 114 gfx::Transform identity_matrix;
113 gfx::Point3F transform_origin; 115 gfx::Point3F transform_origin;
114 gfx::PointF position; 116 gfx::PointF position;
115 gfx::Size bounds(100, 100); 117 gfx::Size bounds(100, 100);
116 SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin, 118 SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
(...skipping 1998 matching lines...) Expand 10 before | Expand all | Expand 10 after
2115 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); 2117 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers());
2116 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); 2118 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1);
2117 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2)); 2119 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2));
2118 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3)); 2120 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3));
2119 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4)); 2121 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4));
2120 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers()); 2122 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers());
2121 } 2123 }
2122 2124
2123 } // namespace 2125 } // namespace
2124 } // namespace cc 2126 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_impl.cc ('k') | cc/trees/occlusion_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698