| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "cc/resources/managed_tile_state.h" | 8 #include "cc/resources/managed_tile_state.h" |
| 9 #include "cc/resources/prioritized_tile_set.h" | 9 #include "cc/resources/prioritized_tile_set.h" |
| 10 #include "cc/resources/tile.h" | 10 #include "cc/resources/tile.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 public: | 52 public: |
| 53 PrioritizedTileSetTest() { | 53 PrioritizedTileSetTest() { |
| 54 output_surface_ = FakeOutputSurface::Create3d().Pass(); | 54 output_surface_ = FakeOutputSurface::Create3d().Pass(); |
| 55 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 55 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
| 56 | 56 |
| 57 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); | 57 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); |
| 58 resource_provider_ = | 58 resource_provider_ = |
| 59 ResourceProvider::Create( | 59 ResourceProvider::Create( |
| 60 output_surface_.get(), shared_bitmap_manager_.get(), 0, false, 1) | 60 output_surface_.get(), shared_bitmap_manager_.get(), 0, false, 1) |
| 61 .Pass(); | 61 .Pass(); |
| 62 resource_pool_ = ResourcePool::Create( |
| 63 resource_provider_.get(), GL_TEXTURE_2D, RGBA_8888); |
| 62 tile_manager_.reset( | 64 tile_manager_.reset( |
| 63 new FakeTileManager(&tile_manager_client_, resource_provider_.get())); | 65 new FakeTileManager(&tile_manager_client_, resource_pool_.get())); |
| 64 picture_pile_ = FakePicturePileImpl::CreateInfiniteFilledPile(); | 66 picture_pile_ = FakePicturePileImpl::CreateInfiniteFilledPile(); |
| 65 } | 67 } |
| 66 | 68 |
| 67 scoped_refptr<Tile> CreateTile() { | 69 scoped_refptr<Tile> CreateTile() { |
| 68 return tile_manager_->CreateTile(picture_pile_.get(), | 70 return tile_manager_->CreateTile(picture_pile_.get(), |
| 69 settings_.default_tile_size, | 71 settings_.default_tile_size, |
| 70 gfx::Rect(), | 72 gfx::Rect(), |
| 71 gfx::Rect(), | 73 gfx::Rect(), |
| 72 1.0, | 74 1.0, |
| 73 0, | 75 0, |
| 74 0, | 76 0, |
| 75 Tile::USE_LCD_TEXT); | 77 Tile::USE_LCD_TEXT); |
| 76 } | 78 } |
| 77 | 79 |
| 78 private: | 80 private: |
| 79 LayerTreeSettings settings_; | 81 LayerTreeSettings settings_; |
| 80 FakeOutputSurfaceClient output_surface_client_; | 82 FakeOutputSurfaceClient output_surface_client_; |
| 81 scoped_ptr<FakeOutputSurface> output_surface_; | 83 scoped_ptr<FakeOutputSurface> output_surface_; |
| 82 scoped_ptr<SharedBitmapManager> shared_bitmap_manager_; | 84 scoped_ptr<SharedBitmapManager> shared_bitmap_manager_; |
| 83 scoped_ptr<ResourceProvider> resource_provider_; | 85 scoped_ptr<ResourceProvider> resource_provider_; |
| 86 scoped_ptr<ResourcePool> resource_pool_; |
| 84 FakeTileManagerClient tile_manager_client_; | 87 FakeTileManagerClient tile_manager_client_; |
| 85 scoped_ptr<FakeTileManager> tile_manager_; | 88 scoped_ptr<FakeTileManager> tile_manager_; |
| 86 scoped_refptr<FakePicturePileImpl> picture_pile_; | 89 scoped_refptr<FakePicturePileImpl> picture_pile_; |
| 87 }; | 90 }; |
| 88 | 91 |
| 89 TEST_F(PrioritizedTileSetTest, EmptyIterator) { | 92 TEST_F(PrioritizedTileSetTest, EmptyIterator) { |
| 90 // Creating an iterator to an empty set should work (but create iterator that | 93 // Creating an iterator to an empty set should work (but create iterator that |
| 91 // isn't valid). | 94 // isn't valid). |
| 92 | 95 |
| 93 PrioritizedTileSet set; | 96 PrioritizedTileSet set; |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 | 722 |
| 720 set.Clear(); | 723 set.Clear(); |
| 721 | 724 |
| 722 PrioritizedTileSet::Iterator empty_it(&set, true); | 725 PrioritizedTileSet::Iterator empty_it(&set, true); |
| 723 EXPECT_FALSE(empty_it); | 726 EXPECT_FALSE(empty_it); |
| 724 } | 727 } |
| 725 | 728 |
| 726 } // namespace | 729 } // namespace |
| 727 } // namespace cc | 730 } // namespace cc |
| 728 | 731 |
| OLD | NEW |