| 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/quads/draw_quad.h" | 7 #include "cc/quads/draw_quad.h" |
| 8 #include "cc/resources/ui_resource_bitmap.h" | 8 #include "cc/resources/ui_resource_bitmap.h" |
| 9 #include "cc/resources/ui_resource_client.h" | 9 #include "cc/resources/ui_resource_client.h" |
| 10 #include "cc/test/fake_impl_proxy.h" | 10 #include "cc/test/fake_impl_proxy.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 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 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 48 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
| 49 | 49 |
| 50 AppendQuadsData data; | 50 AppendQuadsData data; |
| 51 layer->AppendQuads(render_pass.get(), Occlusion(), &data); | 51 layer->AppendQuads(render_pass.get(), &data); |
| 52 | 52 |
| 53 // Verify quad rects | 53 // Verify quad rects |
| 54 const QuadList& quads = render_pass->quad_list; | 54 const QuadList& quads = render_pass->quad_list; |
| 55 EXPECT_EQ(expected_quad_size, quads.size()); | 55 EXPECT_EQ(expected_quad_size, quads.size()); |
| 56 } | 56 } |
| 57 | 57 |
| 58 TEST(UIResourceLayerImplTest, VerifyDrawQuads) { | 58 TEST(UIResourceLayerImplTest, VerifyDrawQuads) { |
| 59 FakeImplProxy proxy; | 59 FakeImplProxy proxy; |
| 60 TestSharedBitmapManager shared_bitmap_manager; | 60 TestSharedBitmapManager shared_bitmap_manager; |
| 61 FakeUIResourceLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); | 61 FakeUIResourceLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 81 opaque, | 81 opaque, |
| 82 uid); | 82 uid); |
| 83 QuadSizeTest(layer.Pass(), expected_quad_size); | 83 QuadSizeTest(layer.Pass(), expected_quad_size); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void OpaqueBoundsTest(scoped_ptr<UIResourceLayerImpl> layer, | 86 void OpaqueBoundsTest(scoped_ptr<UIResourceLayerImpl> layer, |
| 87 const gfx::Rect& expected_opaque_bounds) { | 87 const gfx::Rect& expected_opaque_bounds) { |
| 88 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 88 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
| 89 | 89 |
| 90 AppendQuadsData data; | 90 AppendQuadsData data; |
| 91 layer->AppendQuads(render_pass.get(), Occlusion(), &data); | 91 layer->AppendQuads(render_pass.get(), &data); |
| 92 | 92 |
| 93 // Verify quad rects | 93 // Verify quad rects |
| 94 const QuadList& quads = render_pass->quad_list; | 94 const QuadList& quads = render_pass->quad_list; |
| 95 EXPECT_GE(quads.size(), (size_t)0); | 95 EXPECT_GE(quads.size(), (size_t)0); |
| 96 gfx::Rect opaque_rect = quads.front()->opaque_rect; | 96 gfx::Rect opaque_rect = quads.front()->opaque_rect; |
| 97 EXPECT_EQ(expected_opaque_bounds, opaque_rect); | 97 EXPECT_EQ(expected_opaque_bounds, opaque_rect); |
| 98 } | 98 } |
| 99 | 99 |
| 100 TEST(UIResourceLayerImplTest, VerifySetOpaqueOnSkBitmap) { | 100 TEST(UIResourceLayerImplTest, VerifySetOpaqueOnSkBitmap) { |
| 101 FakeImplProxy proxy; | 101 FakeImplProxy proxy; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 LayerTestCommon::VerifyQuadsAreOccluded( | 196 LayerTestCommon::VerifyQuadsAreOccluded( |
| 197 impl.quad_list(), occluded, &partially_occluded_count); | 197 impl.quad_list(), occluded, &partially_occluded_count); |
| 198 // The layer outputs one quad, which is partially occluded. | 198 // The layer outputs one quad, which is partially occluded. |
| 199 EXPECT_EQ(1u, impl.quad_list().size()); | 199 EXPECT_EQ(1u, impl.quad_list().size()); |
| 200 EXPECT_EQ(1u, partially_occluded_count); | 200 EXPECT_EQ(1u, partially_occluded_count); |
| 201 } | 201 } |
| 202 } | 202 } |
| 203 | 203 |
| 204 } // namespace | 204 } // namespace |
| 205 } // namespace cc | 205 } // namespace cc |
| OLD | NEW |