| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_TEST_COMMON_H_ | 5 #ifndef CC_TEST_LAYER_TEST_COMMON_H_ |
| 6 #define CC_TEST_LAYER_TEST_COMMON_H_ | 6 #define CC_TEST_LAYER_TEST_COMMON_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "cc/animation/animation_timeline.h" | 13 #include "cc/animation/animation_timeline.h" |
| 14 #include "cc/quads/render_pass.h" | 14 #include "cc/quads/render_pass.h" |
| 15 #include "cc/test/fake_layer_tree_host.h" | 15 #include "cc/test/fake_layer_tree_host.h" |
| 16 #include "cc/test/fake_layer_tree_host_client.h" | 16 #include "cc/test/fake_layer_tree_host_client.h" |
| 17 #include "cc/test/test_task_graph_runner.h" | 17 #include "cc/test/test_task_graph_runner.h" |
| 18 #include "cc/trees/effect_node.h" |
| 18 #include "cc/trees/layer_tree_host_impl.h" | 19 #include "cc/trees/layer_tree_host_impl.h" |
| 19 | 20 |
| 20 #define EXPECT_SET_NEEDS_COMMIT(expect, code_to_test) \ | 21 #define EXPECT_SET_NEEDS_COMMIT(expect, code_to_test) \ |
| 21 do { \ | 22 do { \ |
| 22 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times((expect)); \ | 23 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times((expect)); \ |
| 23 code_to_test; \ | 24 code_to_test; \ |
| 24 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); \ | 25 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); \ |
| 25 } while (false) | 26 } while (false) |
| 26 | 27 |
| 27 #define EXPECT_SET_NEEDS_UPDATE(expect, code_to_test) \ | 28 #define EXPECT_SET_NEEDS_UPDATE(expect, code_to_test) \ |
| 28 do { \ | 29 do { \ |
| 29 EXPECT_CALL(*layer_tree_host_, SetNeedsUpdateLayers()).Times((expect)); \ | 30 EXPECT_CALL(*layer_tree_host_, SetNeedsUpdateLayers()).Times((expect)); \ |
| 30 code_to_test; \ | 31 code_to_test; \ |
| 31 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); \ | 32 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); \ |
| 32 } while (false) | 33 } while (false) |
| 33 | 34 |
| 34 namespace gfx { class Rect; } | 35 namespace gfx { class Rect; } |
| 35 | 36 |
| 36 namespace cc { | 37 namespace cc { |
| 37 class LayerImpl; | 38 class LayerImpl; |
| 38 class CompositorFrameSink; | 39 class CompositorFrameSink; |
| 39 class QuadList; | 40 class QuadList; |
| 40 class RenderSurfaceImpl; | 41 class RenderSurfaceImpl; |
| 41 class ResourceProvider; | 42 class ResourceProvider; |
| 42 | 43 |
| 44 RenderSurfaceImpl* GetRenderSurface(LayerImpl* layer_impl); |
| 45 const RenderSurfaceImpl* GetRenderSurface(const LayerImpl* layer_impl); |
| 46 |
| 43 class LayerTestCommon { | 47 class LayerTestCommon { |
| 44 public: | 48 public: |
| 45 static const char* quad_string; | 49 static const char* quad_string; |
| 46 | 50 |
| 47 static void VerifyQuadsExactlyCoverRect(const QuadList& quads, | 51 static void VerifyQuadsExactlyCoverRect(const QuadList& quads, |
| 48 const gfx::Rect& rect); | 52 const gfx::Rect& rect); |
| 49 | 53 |
| 50 static void VerifyQuadsAreOccluded(const QuadList& quads, | 54 static void VerifyQuadsAreOccluded(const QuadList& quads, |
| 51 const gfx::Rect& occluded, | 55 const gfx::Rect& occluded, |
| 52 size_t* partially_occluded_count); | 56 size_t* partially_occluded_count); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 std::unique_ptr<RenderPass> render_pass_; | 207 std::unique_ptr<RenderPass> render_pass_; |
| 204 scoped_refptr<AnimationTimeline> timeline_; | 208 scoped_refptr<AnimationTimeline> timeline_; |
| 205 scoped_refptr<AnimationTimeline> timeline_impl_; | 209 scoped_refptr<AnimationTimeline> timeline_impl_; |
| 206 int layer_impl_id_; | 210 int layer_impl_id_; |
| 207 }; | 211 }; |
| 208 }; | 212 }; |
| 209 | 213 |
| 210 } // namespace cc | 214 } // namespace cc |
| 211 | 215 |
| 212 #endif // CC_TEST_LAYER_TEST_COMMON_H_ | 216 #endif // CC_TEST_LAYER_TEST_COMMON_H_ |
| OLD | NEW |