OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "cc/layers/append_quads_data.h" | 5 #include "cc/layers/append_quads_data.h" |
6 #include "cc/layers/ui_resource_layer_impl.h" | 6 #include "cc/layers/ui_resource_layer_impl.h" |
7 #include "cc/resources/ui_resource_bitmap.h" | 7 #include "cc/resources/ui_resource_bitmap.h" |
8 #include "cc/resources/ui_resource_client.h" | 8 #include "cc/resources/ui_resource_client.h" |
9 #include "cc/test/fake_impl_proxy.h" | 9 #include "cc/test/fake_impl_proxy.h" |
10 #include "cc/test/fake_layer_tree_host_impl.h" | 10 #include "cc/test/fake_layer_tree_host_impl.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 UIResourceBitmap bitmap(bitmap_size, opaque); | 38 UIResourceBitmap bitmap(bitmap_size, opaque); |
39 | 39 |
40 host_impl->CreateUIResource(uid, bitmap); | 40 host_impl->CreateUIResource(uid, bitmap); |
41 layer->SetUIResourceId(uid); | 41 layer->SetUIResourceId(uid); |
42 | 42 |
43 return layer.Pass(); | 43 return layer.Pass(); |
44 } | 44 } |
45 | 45 |
46 void QuadSizeTest(scoped_ptr<UIResourceLayerImpl> layer, | 46 void QuadSizeTest(scoped_ptr<UIResourceLayerImpl> layer, |
47 size_t expected_quad_size) { | 47 size_t expected_quad_size) { |
48 MockQuadCuller quad_culler; | 48 MockOcclusionTracker<LayerImpl> occlusion_tracker; |
| 49 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
| 50 MockQuadCuller quad_culler(render_pass.get(), &occlusion_tracker); |
| 51 |
49 AppendQuadsData data; | 52 AppendQuadsData data; |
50 layer->AppendQuads(&quad_culler, &data); | 53 layer->AppendQuads(&quad_culler, &data); |
51 | 54 |
52 // Verify quad rects | 55 // Verify quad rects |
53 const QuadList& quads = quad_culler.quad_list(); | 56 const QuadList& quads = quad_culler.quad_list(); |
54 EXPECT_EQ(expected_quad_size, quads.size()); | 57 EXPECT_EQ(expected_quad_size, quads.size()); |
55 } | 58 } |
56 | 59 |
57 TEST(UIResourceLayerImplTest, VerifyDrawQuads) { | 60 TEST(UIResourceLayerImplTest, VerifyDrawQuads) { |
58 FakeImplProxy proxy; | 61 FakeImplProxy proxy; |
(...skipping 18 matching lines...) Expand all Loading... |
77 layer = GenerateUIResourceLayer(&host_impl, | 80 layer = GenerateUIResourceLayer(&host_impl, |
78 bitmap_size, | 81 bitmap_size, |
79 layer_size, | 82 layer_size, |
80 opaque, | 83 opaque, |
81 uid); | 84 uid); |
82 QuadSizeTest(layer.Pass(), expected_quad_size); | 85 QuadSizeTest(layer.Pass(), expected_quad_size); |
83 } | 86 } |
84 | 87 |
85 void OpaqueBoundsTest(scoped_ptr<UIResourceLayerImpl> layer, | 88 void OpaqueBoundsTest(scoped_ptr<UIResourceLayerImpl> layer, |
86 const gfx::Rect& expected_opaque_bounds) { | 89 const gfx::Rect& expected_opaque_bounds) { |
87 MockQuadCuller quad_culler; | 90 MockOcclusionTracker<LayerImpl> occlusion_tracker; |
| 91 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
| 92 MockQuadCuller quad_culler(render_pass.get(), &occlusion_tracker); |
| 93 |
88 AppendQuadsData data; | 94 AppendQuadsData data; |
89 layer->AppendQuads(&quad_culler, &data); | 95 layer->AppendQuads(&quad_culler, &data); |
90 | 96 |
91 // Verify quad rects | 97 // Verify quad rects |
92 const QuadList& quads = quad_culler.quad_list(); | 98 const QuadList& quads = quad_culler.quad_list(); |
93 EXPECT_GE(quads.size(), (size_t)0); | 99 EXPECT_GE(quads.size(), (size_t)0); |
94 gfx::Rect opaque_rect = quads.at(0)->opaque_rect; | 100 gfx::Rect opaque_rect = quads.at(0)->opaque_rect; |
95 EXPECT_EQ(expected_opaque_bounds, opaque_rect); | 101 EXPECT_EQ(expected_opaque_bounds, opaque_rect); |
96 } | 102 } |
97 | 103 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 occluded, | 203 occluded, |
198 &partially_occluded_count); | 204 &partially_occluded_count); |
199 // The layer outputs one quad, which is partially occluded. | 205 // The layer outputs one quad, which is partially occluded. |
200 EXPECT_EQ(1u, impl.quad_list().size()); | 206 EXPECT_EQ(1u, impl.quad_list().size()); |
201 EXPECT_EQ(1u, partially_occluded_count); | 207 EXPECT_EQ(1u, partially_occluded_count); |
202 } | 208 } |
203 } | 209 } |
204 | 210 |
205 } // namespace | 211 } // namespace |
206 } // namespace cc | 212 } // namespace cc |
OLD | NEW |