| 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 <algorithm> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 } | 127 } |
| 128 bool UpdateLayerListImplContains(int id) const { | 128 bool UpdateLayerListImplContains(int id) const { |
| 129 return std::count_if( | 129 return std::count_if( |
| 130 update_layer_list_impl_->begin(), update_layer_list_impl_->end(), | 130 update_layer_list_impl_->begin(), update_layer_list_impl_->end(), |
| 131 [id](LayerImpl* layer) { return layer->id() == id; }) != 0; | 131 [id](LayerImpl* layer) { return layer->id() == id; }) != 0; |
| 132 } | 132 } |
| 133 | 133 |
| 134 const LayerList& update_layer_list() const { return update_layer_list_; } | 134 const LayerList& update_layer_list() const { return update_layer_list_; } |
| 135 bool UpdateLayerListContains(int id) const; | 135 bool UpdateLayerListContains(int id) const; |
| 136 | 136 |
| 137 scoped_refptr<Layer> CreateTestLayer(); |
| 138 std::unique_ptr<LayerImpl> CreateTestLayerImpl(LayerTreeImpl* tree_impl, |
| 139 int id); |
| 140 |
| 137 private: | 141 private: |
| 138 std::unique_ptr<std::vector<LayerImpl*>> render_surface_layer_list_impl_; | 142 std::unique_ptr<std::vector<LayerImpl*>> render_surface_layer_list_impl_; |
| 139 LayerList update_layer_list_; | 143 LayerList update_layer_list_; |
| 140 std::unique_ptr<LayerImplList> update_layer_list_impl_; | 144 std::unique_ptr<LayerImplList> update_layer_list_impl_; |
| 141 }; | 145 }; |
| 142 | 146 |
| 143 class LayerTreeHostCommonTest : public LayerTreeHostCommonTestBase, | 147 class LayerTreeHostCommonTest : public LayerTreeHostCommonTestBase, |
| 144 public testing::Test { | 148 public testing::Test { |
| 145 public: | 149 public: |
| 146 LayerTreeHostCommonTest(); | 150 LayerTreeHostCommonTest(); |
| 147 explicit LayerTreeHostCommonTest(const LayerTreeSettings& settings); | 151 explicit LayerTreeHostCommonTest(const LayerTreeSettings& settings); |
| 148 | 152 |
| 149 protected: | 153 protected: |
| 150 static void SetScrollOffsetDelta(LayerImpl* layer_impl, | 154 static void SetScrollOffsetDelta(LayerImpl* layer_impl, |
| 151 const gfx::Vector2dF& delta) { | 155 const gfx::Vector2dF& delta) { |
| 152 if (layer_impl->layer_tree_impl() | 156 if (layer_impl->layer_tree_impl() |
| 153 ->property_trees() | 157 ->property_trees() |
| 154 ->scroll_tree.SetScrollOffsetDeltaForTesting(layer_impl->id(), | 158 ->scroll_tree.SetScrollOffsetDeltaForTesting(layer_impl->id(), |
| 155 delta)) | 159 delta)) |
| 156 layer_impl->layer_tree_impl()->DidUpdateScrollOffset( | 160 layer_impl->layer_tree_impl()->DidUpdateScrollOffset( |
| 157 layer_impl->id(), layer_impl->transform_tree_index()); | 161 layer_impl->id(), layer_impl->transform_tree_index()); |
| 158 } | 162 } |
| 159 }; | 163 }; |
| 160 | 164 |
| 161 } // namespace cc | 165 } // namespace cc |
| 162 | 166 |
| 163 #endif // CC_TEST_LAYER_TREE_HOST_COMMON_TEST_H_ | 167 #endif // CC_TEST_LAYER_TREE_HOST_COMMON_TEST_H_ |
| OLD | NEW |