| 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> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 do { \ | 28 do { \ |
| 29 EXPECT_CALL(*layer_tree_host_, SetNeedsUpdateLayers()).Times((expect)); \ | 29 EXPECT_CALL(*layer_tree_host_, SetNeedsUpdateLayers()).Times((expect)); \ |
| 30 code_to_test; \ | 30 code_to_test; \ |
| 31 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); \ | 31 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); \ |
| 32 } while (false) | 32 } while (false) |
| 33 | 33 |
| 34 namespace gfx { class Rect; } | 34 namespace gfx { class Rect; } |
| 35 | 35 |
| 36 namespace cc { | 36 namespace cc { |
| 37 class LayerImpl; | 37 class LayerImpl; |
| 38 class OutputSurface; | 38 class CompositorFrameSink; |
| 39 class QuadList; | 39 class QuadList; |
| 40 class RenderSurfaceImpl; | 40 class RenderSurfaceImpl; |
| 41 class ResourceProvider; | 41 class ResourceProvider; |
| 42 | 42 |
| 43 class LayerTestCommon { | 43 class LayerTestCommon { |
| 44 public: | 44 public: |
| 45 static const char* quad_string; | 45 static const char* quad_string; |
| 46 | 46 |
| 47 static void VerifyQuadsExactlyCoverRect(const QuadList& quads, | 47 static void VerifyQuadsExactlyCoverRect(const QuadList& quads, |
| 48 const gfx::Rect& rect); | 48 const gfx::Rect& rect); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 void AppendQuadsWithOcclusion(LayerImpl* layer_impl, | 133 void AppendQuadsWithOcclusion(LayerImpl* layer_impl, |
| 134 const gfx::Rect& occluded); | 134 const gfx::Rect& occluded); |
| 135 void AppendQuadsForPassWithOcclusion(LayerImpl* layer_impl, | 135 void AppendQuadsForPassWithOcclusion(LayerImpl* layer_impl, |
| 136 RenderPass* given_render_pass, | 136 RenderPass* given_render_pass, |
| 137 const gfx::Rect& occluded); | 137 const gfx::Rect& occluded); |
| 138 void AppendSurfaceQuadsWithOcclusion(RenderSurfaceImpl* surface_impl, | 138 void AppendSurfaceQuadsWithOcclusion(RenderSurfaceImpl* surface_impl, |
| 139 const gfx::Rect& occluded); | 139 const gfx::Rect& occluded); |
| 140 | 140 |
| 141 void RequestCopyOfOutput(); | 141 void RequestCopyOfOutput(); |
| 142 | 142 |
| 143 OutputSurface* output_surface() const { | 143 CompositorFrameSink* compositor_frame_sink() const { |
| 144 return host_->host_impl()->output_surface(); | 144 return host_->host_impl()->compositor_frame_sink(); |
| 145 } | 145 } |
| 146 ResourceProvider* resource_provider() const { | 146 ResourceProvider* resource_provider() const { |
| 147 return host_->host_impl()->resource_provider(); | 147 return host_->host_impl()->resource_provider(); |
| 148 } | 148 } |
| 149 LayerImpl* root_layer_for_testing() const { | 149 LayerImpl* root_layer_for_testing() const { |
| 150 return host_impl()->active_tree()->root_layer_for_testing(); | 150 return host_impl()->active_tree()->root_layer_for_testing(); |
| 151 } | 151 } |
| 152 FakeLayerTreeHost* host() { return host_.get(); } | 152 FakeLayerTreeHost* host() { return host_.get(); } |
| 153 FakeLayerTreeHostImpl* host_impl() const { return host_->host_impl(); } | 153 FakeLayerTreeHostImpl* host_impl() const { return host_->host_impl(); } |
| 154 TaskRunnerProvider* task_runner_provider() const { | 154 TaskRunnerProvider* task_runner_provider() const { |
| 155 return host_->host_impl()->task_runner_provider(); | 155 return host_->host_impl()->task_runner_provider(); |
| 156 } | 156 } |
| 157 const QuadList& quad_list() const { return render_pass_->quad_list; } | 157 const QuadList& quad_list() const { return render_pass_->quad_list; } |
| 158 scoped_refptr<AnimationTimeline> timeline() { return timeline_; } | 158 scoped_refptr<AnimationTimeline> timeline() { return timeline_; } |
| 159 scoped_refptr<AnimationTimeline> timeline_impl() { return timeline_impl_; } | 159 scoped_refptr<AnimationTimeline> timeline_impl() { return timeline_impl_; } |
| 160 | 160 |
| 161 void SetElementIdsForTesting() { | 161 void SetElementIdsForTesting() { |
| 162 host_impl()->active_tree()->SetElementIdsForTesting(); | 162 host_impl()->active_tree()->SetElementIdsForTesting(); |
| 163 } | 163 } |
| 164 | 164 |
| 165 private: | 165 private: |
| 166 FakeLayerTreeHostClient client_; | 166 FakeLayerTreeHostClient client_; |
| 167 TestTaskGraphRunner task_graph_runner_; | 167 TestTaskGraphRunner task_graph_runner_; |
| 168 std::unique_ptr<OutputSurface> output_surface_; | 168 std::unique_ptr<CompositorFrameSink> compositor_frame_sink_; |
| 169 std::unique_ptr<FakeLayerTreeHost> host_; | 169 std::unique_ptr<FakeLayerTreeHost> host_; |
| 170 std::unique_ptr<RenderPass> render_pass_; | 170 std::unique_ptr<RenderPass> render_pass_; |
| 171 scoped_refptr<AnimationTimeline> timeline_; | 171 scoped_refptr<AnimationTimeline> timeline_; |
| 172 scoped_refptr<AnimationTimeline> timeline_impl_; | 172 scoped_refptr<AnimationTimeline> timeline_impl_; |
| 173 int layer_impl_id_; | 173 int layer_impl_id_; |
| 174 }; | 174 }; |
| 175 }; | 175 }; |
| 176 | 176 |
| 177 } // namespace cc | 177 } // namespace cc |
| 178 | 178 |
| 179 #endif // CC_TEST_LAYER_TEST_COMMON_H_ | 179 #endif // CC_TEST_LAYER_TEST_COMMON_H_ |
| OLD | NEW |