| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 EXPECT_EQ(expected_quad_size, quads.size()); | 56 EXPECT_EQ(expected_quad_size, quads.size()); |
| 57 } | 57 } |
| 58 | 58 |
| 59 TEST(UIResourceLayerImplTest, VerifyDrawQuads) { | 59 TEST(UIResourceLayerImplTest, VerifyDrawQuads) { |
| 60 FakeImplProxy proxy; | 60 FakeImplProxy proxy; |
| 61 TestSharedBitmapManager shared_bitmap_manager; | 61 TestSharedBitmapManager shared_bitmap_manager; |
| 62 TestTaskGraphRunner task_graph_runner; | 62 TestTaskGraphRunner task_graph_runner; |
| 63 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); | 63 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); |
| 64 FakeUIResourceLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, | 64 FakeUIResourceLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, |
| 65 &task_graph_runner); | 65 &task_graph_runner); |
| 66 host_impl.SetVisible(true); |
| 66 host_impl.InitializeRenderer(output_surface.get()); | 67 host_impl.InitializeRenderer(output_surface.get()); |
| 67 | 68 |
| 68 // Make sure we're appending quads when there are valid values. | 69 // Make sure we're appending quads when there are valid values. |
| 69 gfx::Size bitmap_size(100, 100); | 70 gfx::Size bitmap_size(100, 100); |
| 70 gfx::Size layer_size(100, 100);; | 71 gfx::Size layer_size(100, 100);; |
| 71 size_t expected_quad_size = 1; | 72 size_t expected_quad_size = 1; |
| 72 bool opaque = true; | 73 bool opaque = true; |
| 73 UIResourceId uid = 1; | 74 UIResourceId uid = 1; |
| 74 scoped_ptr<UIResourceLayerImpl> layer = GenerateUIResourceLayer(&host_impl, | 75 scoped_ptr<UIResourceLayerImpl> layer = GenerateUIResourceLayer(&host_impl, |
| 75 bitmap_size, | 76 bitmap_size, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 103 EXPECT_EQ(expected_opaque_bounds, opaque_rect); | 104 EXPECT_EQ(expected_opaque_bounds, opaque_rect); |
| 104 } | 105 } |
| 105 | 106 |
| 106 TEST(UIResourceLayerImplTest, VerifySetOpaqueOnSkBitmap) { | 107 TEST(UIResourceLayerImplTest, VerifySetOpaqueOnSkBitmap) { |
| 107 FakeImplProxy proxy; | 108 FakeImplProxy proxy; |
| 108 TestSharedBitmapManager shared_bitmap_manager; | 109 TestSharedBitmapManager shared_bitmap_manager; |
| 109 TestTaskGraphRunner task_graph_runner; | 110 TestTaskGraphRunner task_graph_runner; |
| 110 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); | 111 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); |
| 111 FakeUIResourceLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, | 112 FakeUIResourceLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, |
| 112 &task_graph_runner); | 113 &task_graph_runner); |
| 114 host_impl.SetVisible(true); |
| 113 host_impl.InitializeRenderer(output_surface.get()); | 115 host_impl.InitializeRenderer(output_surface.get()); |
| 114 | 116 |
| 115 gfx::Size bitmap_size(100, 100); | 117 gfx::Size bitmap_size(100, 100); |
| 116 gfx::Size layer_size(100, 100);; | 118 gfx::Size layer_size(100, 100);; |
| 117 bool opaque = false; | 119 bool opaque = false; |
| 118 UIResourceId uid = 1; | 120 UIResourceId uid = 1; |
| 119 scoped_ptr<UIResourceLayerImpl> layer = GenerateUIResourceLayer(&host_impl, | 121 scoped_ptr<UIResourceLayerImpl> layer = GenerateUIResourceLayer(&host_impl, |
| 120 bitmap_size, | 122 bitmap_size, |
| 121 layer_size, | 123 layer_size, |
| 122 opaque, | 124 opaque, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 134 OpaqueBoundsTest(layer.Pass(), expected_opaque_bounds); | 136 OpaqueBoundsTest(layer.Pass(), expected_opaque_bounds); |
| 135 } | 137 } |
| 136 | 138 |
| 137 TEST(UIResourceLayerImplTest, VerifySetOpaqueOnLayer) { | 139 TEST(UIResourceLayerImplTest, VerifySetOpaqueOnLayer) { |
| 138 FakeImplProxy proxy; | 140 FakeImplProxy proxy; |
| 139 TestSharedBitmapManager shared_bitmap_manager; | 141 TestSharedBitmapManager shared_bitmap_manager; |
| 140 TestTaskGraphRunner task_graph_runner; | 142 TestTaskGraphRunner task_graph_runner; |
| 141 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); | 143 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); |
| 142 FakeUIResourceLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, | 144 FakeUIResourceLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, |
| 143 &task_graph_runner); | 145 &task_graph_runner); |
| 146 host_impl.SetVisible(true); |
| 144 host_impl.InitializeRenderer(output_surface.get()); | 147 host_impl.InitializeRenderer(output_surface.get()); |
| 145 | 148 |
| 146 gfx::Size bitmap_size(100, 100); | 149 gfx::Size bitmap_size(100, 100); |
| 147 gfx::Size layer_size(100, 100); | 150 gfx::Size layer_size(100, 100); |
| 148 bool skbitmap_opaque = false; | 151 bool skbitmap_opaque = false; |
| 149 UIResourceId uid = 1; | 152 UIResourceId uid = 1; |
| 150 scoped_ptr<UIResourceLayerImpl> layer = GenerateUIResourceLayer( | 153 scoped_ptr<UIResourceLayerImpl> layer = GenerateUIResourceLayer( |
| 151 &host_impl, bitmap_size, layer_size, skbitmap_opaque, uid); | 154 &host_impl, bitmap_size, layer_size, skbitmap_opaque, uid); |
| 152 layer->SetContentsOpaque(false); | 155 layer->SetContentsOpaque(false); |
| 153 gfx::Rect expected_opaque_bounds; | 156 gfx::Rect expected_opaque_bounds; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 LayerTestCommon::VerifyQuadsAreOccluded( | 212 LayerTestCommon::VerifyQuadsAreOccluded( |
| 210 impl.quad_list(), occluded, &partially_occluded_count); | 213 impl.quad_list(), occluded, &partially_occluded_count); |
| 211 // The layer outputs one quad, which is partially occluded. | 214 // The layer outputs one quad, which is partially occluded. |
| 212 EXPECT_EQ(1u, impl.quad_list().size()); | 215 EXPECT_EQ(1u, impl.quad_list().size()); |
| 213 EXPECT_EQ(1u, partially_occluded_count); | 216 EXPECT_EQ(1u, partially_occluded_count); |
| 214 } | 217 } |
| 215 } | 218 } |
| 216 | 219 |
| 217 } // namespace | 220 } // namespace |
| 218 } // namespace cc | 221 } // namespace cc |
| OLD | NEW |