OLD | NEW |
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 #ifndef CC_TEST_LAYER_TREE_HOST_COMMON_TEST_H_ | 5 #ifndef CC_TEST_LAYER_TREE_HOST_COMMON_TEST_H_ |
6 #define CC_TEST_LAYER_TREE_HOST_COMMON_TEST_H_ | 6 #define CC_TEST_LAYER_TREE_HOST_COMMON_TEST_H_ |
7 | 7 |
8 #include <algorithm> | |
9 #include <vector> | 8 #include <vector> |
10 | 9 |
11 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
12 #include "cc/layers/layer_lists.h" | 11 #include "cc/layers/layer_lists.h" |
13 #include "cc/layers/layer_settings.h" | 12 #include "cc/layers/layer_settings.h" |
14 #include "cc/test/fake_layer_tree_host_client.h" | 13 #include "cc/test/fake_layer_tree_host_client.h" |
15 #include "cc/test/layer_test_common.h" | 14 #include "cc/test/layer_test_common.h" |
16 #include "cc/test/test_task_graph_runner.h" | 15 #include "cc/test/test_task_graph_runner.h" |
17 #include "cc/trees/layer_tree_settings.h" | 16 #include "cc/trees/layer_tree_settings.h" |
18 #include "cc/trees/property_tree.h" | 17 #include "cc/trees/property_tree.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 const gfx::Size& bounds, | 59 const gfx::Size& bounds, |
61 bool flatten_transform, | 60 bool flatten_transform, |
62 bool is_3d_sorted); | 61 bool is_3d_sorted); |
63 | 62 |
64 void SetLayerPropertiesForTesting(LayerImpl* layer, | 63 void SetLayerPropertiesForTesting(LayerImpl* layer, |
65 const gfx::Transform& transform, | 64 const gfx::Transform& transform, |
66 const gfx::Point3F& transform_origin, | 65 const gfx::Point3F& transform_origin, |
67 const gfx::PointF& position, | 66 const gfx::PointF& position, |
68 const gfx::Size& bounds, | 67 const gfx::Size& bounds, |
69 bool flatten_transform, | 68 bool flatten_transform, |
70 bool is_3d_sorted); | |
71 | |
72 void SetLayerPropertiesForTesting(LayerImpl* layer, | |
73 const gfx::Transform& transform, | |
74 const gfx::Point3F& transform_origin, | |
75 const gfx::PointF& position, | |
76 const gfx::Size& bounds, | |
77 bool flatten_transform, | |
78 bool is_3d_sorted, | 69 bool is_3d_sorted, |
79 bool create_render_surface); | 70 bool create_render_surface); |
80 | 71 |
81 void ExecuteCalculateDrawProperties(Layer* root_layer, | 72 void ExecuteCalculateDrawProperties(Layer* root_layer, |
82 float device_scale_factor, | 73 float device_scale_factor, |
83 float page_scale_factor, | 74 float page_scale_factor, |
84 Layer* page_scale_application_layer, | 75 Layer* page_scale_application_layer, |
85 bool can_use_lcd_text, | 76 bool can_use_lcd_text, |
86 bool layers_always_allowed_lcd_text); | 77 bool layers_always_allowed_lcd_text); |
87 | 78 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 void ExecuteCalculateDrawPropertiesWithPropertyTrees(Layer* layer); | 111 void ExecuteCalculateDrawPropertiesWithPropertyTrees(Layer* layer); |
121 void ExecuteCalculateDrawPropertiesWithPropertyTrees(LayerImpl* layer); | 112 void ExecuteCalculateDrawPropertiesWithPropertyTrees(LayerImpl* layer); |
122 | 113 |
123 void ExecuteCalculateDrawPropertiesWithoutSeparateSurfaces( | 114 void ExecuteCalculateDrawPropertiesWithoutSeparateSurfaces( |
124 LayerImpl* root_layer); | 115 LayerImpl* root_layer); |
125 | 116 |
126 LayerImplList* render_surface_layer_list_impl() const { | 117 LayerImplList* render_surface_layer_list_impl() const { |
127 return render_surface_layer_list_impl_.get(); | 118 return render_surface_layer_list_impl_.get(); |
128 } | 119 } |
129 | 120 |
130 LayerImplList* update_layer_list_impl() const { | |
131 return update_layer_list_impl_.get(); | |
132 } | |
133 bool UpdateLayerListImplContains(int id) const { | |
134 return std::count_if( | |
135 update_layer_list_impl_->begin(), update_layer_list_impl_->end(), | |
136 [id](LayerImpl* layer) { return layer->id() == id; }) != 0; | |
137 } | |
138 | |
139 const LayerList& update_layer_list() const { return update_layer_list_; } | 121 const LayerList& update_layer_list() const { return update_layer_list_; } |
140 bool UpdateLayerListContains(int id) const; | 122 bool UpdateLayerListContains(int id) const; |
141 | 123 |
142 int render_surface_layer_list_count() const { | 124 int render_surface_layer_list_count() const { |
143 return render_surface_layer_list_count_; | 125 return render_surface_layer_list_count_; |
144 } | 126 } |
145 | 127 |
146 const LayerSettings& layer_settings() { return layer_settings_; } | 128 const LayerSettings& layer_settings() { return layer_settings_; } |
147 | 129 |
148 private: | 130 private: |
149 scoped_ptr<std::vector<LayerImpl*>> render_surface_layer_list_impl_; | 131 scoped_ptr<std::vector<LayerImpl*>> render_surface_layer_list_impl_; |
150 LayerList update_layer_list_; | 132 LayerList update_layer_list_; |
151 scoped_ptr<LayerImplList> update_layer_list_impl_; | |
152 LayerSettings layer_settings_; | 133 LayerSettings layer_settings_; |
153 | 134 |
154 int render_surface_layer_list_count_; | 135 int render_surface_layer_list_count_; |
155 }; | 136 }; |
156 | 137 |
157 class LayerTreeHostCommonTest : public LayerTreeHostCommonTestBase, | 138 class LayerTreeHostCommonTest : public LayerTreeHostCommonTestBase, |
158 public testing::Test { | 139 public testing::Test { |
159 public: | 140 public: |
160 LayerTreeHostCommonTest(); | 141 LayerTreeHostCommonTest(); |
161 explicit LayerTreeHostCommonTest(const LayerTreeSettings& settings); | 142 explicit LayerTreeHostCommonTest(const LayerTreeSettings& settings); |
162 }; | 143 }; |
163 | 144 |
164 } // namespace cc | 145 } // namespace cc |
165 | 146 |
166 #endif // CC_TEST_LAYER_TREE_HOST_COMMON_TEST_H_ | 147 #endif // CC_TEST_LAYER_TREE_HOST_COMMON_TEST_H_ |
OLD | NEW |