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