| 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/picture_image_layer_impl.h" | 5 #include "cc/layers/picture_image_layer_impl.h" |
| 6 | 6 |
| 7 #include "cc/layers/append_quads_data.h" | 7 #include "cc/layers/append_quads_data.h" |
| 8 #include "cc/resources/tile_priority.h" | 8 #include "cc/resources/tile_priority.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" |
| 11 #include "cc/test/fake_output_surface.h" | 11 #include "cc/test/fake_output_surface.h" |
| 12 #include "cc/test/fake_picture_layer_tiling_client.h" | 12 #include "cc/test/fake_picture_layer_tiling_client.h" |
| 13 #include "cc/test/impl_side_painting_settings.h" | |
| 14 #include "cc/test/mock_quad_culler.h" | 13 #include "cc/test/mock_quad_culler.h" |
| 15 #include "cc/test/test_shared_bitmap_manager.h" | 14 #include "cc/test/test_shared_bitmap_manager.h" |
| 16 #include "cc/trees/layer_tree_impl.h" | 15 #include "cc/trees/layer_tree_impl.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 17 |
| 19 namespace cc { | 18 namespace cc { |
| 20 namespace { | 19 namespace { |
| 21 | 20 |
| 22 class TestablePictureImageLayerImpl : public PictureImageLayerImpl { | 21 class TestablePictureImageLayerImpl : public PictureImageLayerImpl { |
| 23 public: | 22 public: |
| 24 TestablePictureImageLayerImpl(LayerTreeImpl* tree_impl, int id) | 23 TestablePictureImageLayerImpl(LayerTreeImpl* tree_impl, int id) |
| 25 : PictureImageLayerImpl(tree_impl, id) { | 24 : PictureImageLayerImpl(tree_impl, id) { |
| 26 } | 25 } |
| 27 | 26 |
| 28 PictureLayerTilingSet* tilings() { return tilings_.get(); } | 27 PictureLayerTilingSet* tilings() { return tilings_.get(); } |
| 29 | 28 |
| 30 friend class PictureImageLayerImplTest; | 29 friend class PictureImageLayerImplTest; |
| 31 }; | 30 }; |
| 32 | 31 |
| 33 class PictureImageLayerImplTest : public testing::Test { | 32 class PictureImageLayerImplTest : public testing::Test { |
| 34 public: | 33 public: |
| 35 PictureImageLayerImplTest() | 34 PictureImageLayerImplTest() |
| 36 : proxy_(base::MessageLoopProxy::current()), | 35 : proxy_(base::MessageLoopProxy::current()), |
| 37 host_impl_(ImplSidePaintingSettings(), | 36 host_impl_(LayerTreeSettings(true), |
| 38 &proxy_, | 37 &proxy_, |
| 39 &shared_bitmap_manager_) { | 38 &shared_bitmap_manager_) { |
| 40 tiling_client_.SetTileSize(ImplSidePaintingSettings().default_tile_size); | 39 tiling_client_.SetTileSize(LayerTreeSettings().default_tile_size); |
| 41 host_impl_.CreatePendingTree(); | 40 host_impl_.CreatePendingTree(); |
| 42 host_impl_.InitializeRenderer( | 41 host_impl_.InitializeRenderer( |
| 43 FakeOutputSurface::Create3d().PassAs<OutputSurface>()); | 42 FakeOutputSurface::Create3d().PassAs<OutputSurface>()); |
| 44 } | 43 } |
| 45 | 44 |
| 46 scoped_ptr<TestablePictureImageLayerImpl> CreateLayer(int id, | 45 scoped_ptr<TestablePictureImageLayerImpl> CreateLayer(int id, |
| 47 WhichTree which_tree) { | 46 WhichTree which_tree) { |
| 48 LayerTreeImpl* tree = NULL; | 47 LayerTreeImpl* tree = NULL; |
| 49 switch (which_tree) { | 48 switch (which_tree) { |
| 50 case ACTIVE_TREE: | 49 case ACTIVE_TREE: |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 active_layer->DidDraw(NULL); | 172 active_layer->DidDraw(NULL); |
| 174 | 173 |
| 175 EXPECT_EQ(DrawQuad::TILED_CONTENT, quad_culler.quad_list()[0]->material); | 174 EXPECT_EQ(DrawQuad::TILED_CONTENT, quad_culler.quad_list()[0]->material); |
| 176 | 175 |
| 177 // Tiles are ready at correct scale, so should not set had_incomplete_tile. | 176 // Tiles are ready at correct scale, so should not set had_incomplete_tile. |
| 178 EXPECT_FALSE(data.had_incomplete_tile); | 177 EXPECT_FALSE(data.had_incomplete_tile); |
| 179 } | 178 } |
| 180 | 179 |
| 181 } // namespace | 180 } // namespace |
| 182 } // namespace cc | 181 } // namespace cc |
| OLD | NEW |