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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "cc/test/fake_layer_tree_host.h" | 10 #include "cc/test/fake_layer_tree_host.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #define EXPECT_SET_NEEDS_UPDATE(expect, code_to_test) \ | 21 #define EXPECT_SET_NEEDS_UPDATE(expect, code_to_test) \ |
22 do { \ | 22 do { \ |
23 EXPECT_CALL(*layer_tree_host_, SetNeedsUpdateLayers()).Times((expect)); \ | 23 EXPECT_CALL(*layer_tree_host_, SetNeedsUpdateLayers()).Times((expect)); \ |
24 code_to_test; \ | 24 code_to_test; \ |
25 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); \ | 25 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); \ |
26 } while (false) | 26 } while (false) |
27 | 27 |
28 namespace gfx { class Rect; } | 28 namespace gfx { class Rect; } |
29 | 29 |
30 namespace cc { | 30 namespace cc { |
| 31 class LayerImpl; |
31 class OutputSurface; | 32 class OutputSurface; |
32 class QuadList; | 33 class QuadList; |
| 34 class RenderSurfaceImpl; |
33 class ResourceProvider; | 35 class ResourceProvider; |
34 | 36 |
35 class LayerTestCommon { | 37 class LayerTestCommon { |
36 public: | 38 public: |
37 static const char* quad_string; | 39 static const char* quad_string; |
38 | 40 |
39 static void VerifyQuadsExactlyCoverRect(const QuadList& quads, | 41 static void VerifyQuadsExactlyCoverRect(const QuadList& quads, |
40 const gfx::Rect& rect); | 42 const gfx::Rect& rect); |
41 | 43 |
42 static void VerifyQuadsCoverRectWithOcclusion( | 44 static void VerifyQuadsCoverRectWithOcclusion( |
(...skipping 19 matching lines...) Expand all Loading... |
62 T* AddChildToRoot(A a) { | 64 T* AddChildToRoot(A a) { |
63 scoped_ptr<T> layer = T::Create(host_->host_impl()->active_tree(), 2, a); | 65 scoped_ptr<T> layer = T::Create(host_->host_impl()->active_tree(), 2, a); |
64 T* ptr = layer.get(); | 66 T* ptr = layer.get(); |
65 root_layer_impl_->AddChild(layer.template PassAs<LayerImpl>()); | 67 root_layer_impl_->AddChild(layer.template PassAs<LayerImpl>()); |
66 return ptr; | 68 return ptr; |
67 } | 69 } |
68 | 70 |
69 void CalcDrawProps(const gfx::Size& viewport_size); | 71 void CalcDrawProps(const gfx::Size& viewport_size); |
70 void AppendQuadsWithOcclusion(LayerImpl* layer_impl, | 72 void AppendQuadsWithOcclusion(LayerImpl* layer_impl, |
71 const gfx::Rect& occluded); | 73 const gfx::Rect& occluded); |
| 74 void AppendSurfaceQuadsWithOcclusion(RenderSurfaceImpl* surface_impl, |
| 75 const gfx::Rect& occluded); |
72 | 76 |
73 OutputSurface* output_surface() const { | 77 OutputSurface* output_surface() const { |
74 return host_->host_impl()->output_surface(); | 78 return host_->host_impl()->output_surface(); |
75 } | 79 } |
76 ResourceProvider* resource_provider() const { | 80 ResourceProvider* resource_provider() const { |
77 return host_->host_impl()->resource_provider(); | 81 return host_->host_impl()->resource_provider(); |
78 } | 82 } |
79 FakeLayerTreeHostImpl* host_impl() const { return host_->host_impl(); } | 83 FakeLayerTreeHostImpl* host_impl() const { return host_->host_impl(); } |
80 const QuadList& quad_list() const { return quad_culler_.quad_list(); } | 84 const QuadList& quad_list() const { return quad_culler_.quad_list(); } |
81 | 85 |
82 private: | 86 private: |
83 scoped_ptr<FakeLayerTreeHost> host_; | 87 scoped_ptr<FakeLayerTreeHost> host_; |
84 scoped_ptr<LayerImpl> root_layer_impl_; | 88 scoped_ptr<LayerImpl> root_layer_impl_; |
85 MockQuadCuller quad_culler_; | 89 MockQuadCuller quad_culler_; |
86 }; | 90 }; |
87 }; | 91 }; |
88 | 92 |
89 } // namespace cc | 93 } // namespace cc |
90 | 94 |
91 #endif // CC_TEST_LAYER_TEST_COMMON_H_ | 95 #endif // CC_TEST_LAYER_TEST_COMMON_H_ |
OLD | NEW |