| 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/mock_quad_culler.h" | 13 #include "cc/test/mock_quad_culler.h" |
| 14 #include "cc/trees/single_thread_proxy.h" | 14 #include "cc/trees/single_thread_proxy.h" |
| 15 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 17 |
| 18 namespace cc { | 18 namespace cc { |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 class TiledLayerImplTest : public testing::Test { | 21 class TiledLayerImplTest : public testing::Test { |
| 22 public: | 22 public: |
| 23 TiledLayerImplTest() : host_impl_(&proxy_) {} | 23 TiledLayerImplTest() : host_impl_(&proxy_, &shared_bitmap_manager_) {} |
| 24 | 24 |
| 25 scoped_ptr<TiledLayerImpl> CreateLayerNoTiles( | 25 scoped_ptr<TiledLayerImpl> CreateLayerNoTiles( |
| 26 const gfx::Size& tile_size, | 26 const gfx::Size& tile_size, |
| 27 const gfx::Size& layer_size, | 27 const gfx::Size& layer_size, |
| 28 LayerTilingData::BorderTexelOption border_texels) { | 28 LayerTilingData::BorderTexelOption border_texels) { |
| 29 scoped_ptr<TiledLayerImpl> layer = | 29 scoped_ptr<TiledLayerImpl> layer = |
| 30 TiledLayerImpl::Create(host_impl_.active_tree(), 1); | 30 TiledLayerImpl::Create(host_impl_.active_tree(), 1); |
| 31 scoped_ptr<LayerTilingData> tiler = | 31 scoped_ptr<LayerTilingData> tiler = |
| 32 LayerTilingData::Create(tile_size, border_texels); | 32 LayerTilingData::Create(tile_size, border_texels); |
| 33 tiler->SetBounds(layer_size); | 33 tiler->SetBounds(layer_size); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 layer->draw_properties().visible_content_rect = visible_content_rect; | 78 layer->draw_properties().visible_content_rect = visible_content_rect; |
| 79 layer->SetBounds(layer_size); | 79 layer->SetBounds(layer_size); |
| 80 | 80 |
| 81 MockQuadCuller quad_culler(quads, shared_states); | 81 MockQuadCuller quad_culler(quads, shared_states); |
| 82 AppendQuadsData data; | 82 AppendQuadsData data; |
| 83 layer->AppendQuads(&quad_culler, &data); | 83 layer->AppendQuads(&quad_culler, &data); |
| 84 } | 84 } |
| 85 | 85 |
| 86 protected: | 86 protected: |
| 87 FakeImplProxy proxy_; | 87 FakeImplProxy proxy_; |
| 88 TestSharedBitmapManager shared_bitmap_manager_; |
| 88 FakeLayerTreeHostImpl host_impl_; | 89 FakeLayerTreeHostImpl host_impl_; |
| 89 }; | 90 }; |
| 90 | 91 |
| 91 TEST_F(TiledLayerImplTest, EmptyQuadList) { | 92 TEST_F(TiledLayerImplTest, EmptyQuadList) { |
| 92 gfx::Size tile_size(90, 90); | 93 gfx::Size tile_size(90, 90); |
| 93 int num_tiles_x = 8; | 94 int num_tiles_x = 8; |
| 94 int num_tiles_y = 4; | 95 int num_tiles_y = 4; |
| 95 gfx::Size layer_size(tile_size.width() * num_tiles_x, | 96 gfx::Size layer_size(tile_size.width() * num_tiles_x, |
| 96 tile_size.height() * num_tiles_y); | 97 tile_size.height() * num_tiles_y); |
| 97 | 98 |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 scoped_ptr<TiledLayerImpl> layer = | 311 scoped_ptr<TiledLayerImpl> layer = |
| 311 CreateLayer(tile_size, layer_size, LayerTilingData::NO_BORDER_TEXELS); | 312 CreateLayer(tile_size, layer_size, LayerTilingData::NO_BORDER_TEXELS); |
| 312 | 313 |
| 313 EXPECT_EQ(0u, layer->ContentsResourceId()); | 314 EXPECT_EQ(0u, layer->ContentsResourceId()); |
| 314 EXPECT_EQ(0, layer->TilingForTesting()->num_tiles_x()); | 315 EXPECT_EQ(0, layer->TilingForTesting()->num_tiles_x()); |
| 315 EXPECT_EQ(0, layer->TilingForTesting()->num_tiles_y()); | 316 EXPECT_EQ(0, layer->TilingForTesting()->num_tiles_y()); |
| 316 } | 317 } |
| 317 | 318 |
| 318 } // namespace | 319 } // namespace |
| 319 } // namespace cc | 320 } // namespace cc |
| OLD | NEW |