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 #include "cc/layers/tiled_layer_impl.h" | 5 #include "cc/layers/tiled_layer_impl.h" |
6 | 6 |
7 #include "cc/layers/append_quads_data.h" | 7 #include "cc/layers/append_quads_data.h" |
8 #include "cc/quads/tile_draw_quad.h" | 8 #include "cc/quads/tile_draw_quad.h" |
9 #include "cc/resources/layer_tiling_data.h" | 9 #include "cc/resources/layer_tiling_data.h" |
10 #include "cc/test/fake_impl_proxy.h" | 10 #include "cc/test/fake_impl_proxy.h" |
11 #include "cc/test/fake_layer_tree_host_impl.h" | 11 #include "cc/test/fake_layer_tree_host_impl.h" |
12 #include "cc/test/layer_test_common.h" | 12 #include "cc/test/layer_test_common.h" |
| 13 #include "cc/test/test_task_graph_runner.h" |
13 #include "cc/trees/single_thread_proxy.h" | 14 #include "cc/trees/single_thread_proxy.h" |
14 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
16 | 17 |
17 namespace cc { | 18 namespace cc { |
18 namespace { | 19 namespace { |
19 | 20 |
20 class TiledLayerImplTest : public testing::Test { | 21 class TiledLayerImplTest : public testing::Test { |
21 public: | 22 public: |
22 TiledLayerImplTest() : host_impl_(&proxy_, &shared_bitmap_manager_) {} | 23 TiledLayerImplTest() |
| 24 : host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_) {} |
23 | 25 |
24 scoped_ptr<TiledLayerImpl> CreateLayerNoTiles( | 26 scoped_ptr<TiledLayerImpl> CreateLayerNoTiles( |
25 const gfx::Size& tile_size, | 27 const gfx::Size& tile_size, |
26 const gfx::Size& layer_size, | 28 const gfx::Size& layer_size, |
27 LayerTilingData::BorderTexelOption border_texels) { | 29 LayerTilingData::BorderTexelOption border_texels) { |
28 scoped_ptr<TiledLayerImpl> layer = | 30 scoped_ptr<TiledLayerImpl> layer = |
29 TiledLayerImpl::Create(host_impl_.active_tree(), 1); | 31 TiledLayerImpl::Create(host_impl_.active_tree(), 1); |
30 scoped_ptr<LayerTilingData> tiler = | 32 scoped_ptr<LayerTilingData> tiler = |
31 LayerTilingData::Create(tile_size, border_texels); | 33 LayerTilingData::Create(tile_size, border_texels); |
32 tiler->SetTilingSize(layer_size); | 34 tiler->SetTilingSize(layer_size); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 layer->draw_properties().visible_content_rect = visible_content_rect; | 72 layer->draw_properties().visible_content_rect = visible_content_rect; |
71 layer->SetBounds(layer_size); | 73 layer->SetBounds(layer_size); |
72 | 74 |
73 AppendQuadsData data; | 75 AppendQuadsData data; |
74 layer->AppendQuads(render_pass, &data); | 76 layer->AppendQuads(render_pass, &data); |
75 } | 77 } |
76 | 78 |
77 protected: | 79 protected: |
78 FakeImplProxy proxy_; | 80 FakeImplProxy proxy_; |
79 TestSharedBitmapManager shared_bitmap_manager_; | 81 TestSharedBitmapManager shared_bitmap_manager_; |
| 82 TestTaskGraphRunner task_graph_runner_; |
80 FakeLayerTreeHostImpl host_impl_; | 83 FakeLayerTreeHostImpl host_impl_; |
81 }; | 84 }; |
82 | 85 |
83 TEST_F(TiledLayerImplTest, EmptyQuadList) { | 86 TEST_F(TiledLayerImplTest, EmptyQuadList) { |
84 gfx::Size tile_size(90, 90); | 87 gfx::Size tile_size(90, 90); |
85 int num_tiles_x = 8; | 88 int num_tiles_x = 8; |
86 int num_tiles_y = 4; | 89 int num_tiles_y = 4; |
87 gfx::Size layer_size(tile_size.width() * num_tiles_x, | 90 gfx::Size layer_size(tile_size.width() * num_tiles_x, |
88 tile_size.height() * num_tiles_y); | 91 tile_size.height() * num_tiles_y); |
89 | 92 |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 LayerTestCommon::VerifyQuadsAreOccluded( | 369 LayerTestCommon::VerifyQuadsAreOccluded( |
367 impl.quad_list(), occluded, &partially_occluded_count); | 370 impl.quad_list(), occluded, &partially_occluded_count); |
368 // The layer outputs one quad, which is partially occluded. | 371 // The layer outputs one quad, which is partially occluded. |
369 EXPECT_EQ(100u - 10u, impl.quad_list().size()); | 372 EXPECT_EQ(100u - 10u, impl.quad_list().size()); |
370 EXPECT_EQ(10u + 10u, partially_occluded_count); | 373 EXPECT_EQ(10u + 10u, partially_occluded_count); |
371 } | 374 } |
372 } | 375 } |
373 | 376 |
374 } // namespace | 377 } // namespace |
375 } // namespace cc | 378 } // namespace cc |
OLD | NEW |