| 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" |
| 11 #include "cc/test/fake_output_surface.h" | 11 #include "cc/test/fake_output_surface.h" |
| 12 #include "cc/test/fake_output_surface_client.h" |
| 12 #include "cc/test/fake_picture_pile_impl.h" | 13 #include "cc/test/fake_picture_pile_impl.h" |
| 13 #include "cc/test/fake_tile_manager.h" | 14 #include "cc/test/fake_tile_manager.h" |
| 14 #include "cc/test/fake_tile_manager_client.h" | 15 #include "cc/test/fake_tile_manager_client.h" |
| 15 #include "cc/test/test_tile_priorities.h" | 16 #include "cc/test/test_tile_priorities.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 18 |
| 18 namespace cc { | 19 namespace cc { |
| 19 | 20 |
| 20 class BinComparator { | 21 class BinComparator { |
| 21 public: | 22 public: |
| (...skipping 25 matching lines...) Expand all Loading... |
| 47 if (a_rect.y() != b_rect.y()) | 48 if (a_rect.y() != b_rect.y()) |
| 48 return a_rect.y() < b_rect.y(); | 49 return a_rect.y() < b_rect.y(); |
| 49 return a_rect.x() < b_rect.x(); | 50 return a_rect.x() < b_rect.x(); |
| 50 } | 51 } |
| 51 }; | 52 }; |
| 52 | 53 |
| 53 namespace { | 54 namespace { |
| 54 | 55 |
| 55 class PrioritizedTileSetTest : public testing::Test { | 56 class PrioritizedTileSetTest : public testing::Test { |
| 56 public: | 57 public: |
| 57 PrioritizedTileSetTest() | 58 PrioritizedTileSetTest() { |
| 58 : output_surface_(FakeOutputSurface::Create3d()), | 59 output_surface_ = FakeOutputSurface::Create3d().Pass(); |
| 59 resource_provider_(ResourceProvider::Create(output_surface_.get(), 0)), | 60 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
| 60 tile_manager_(new FakeTileManager(&tile_manager_client_, | 61 |
| 61 resource_provider_.get())), | 62 resource_provider_ = ResourceProvider::Create(output_surface_.get(), |
| 62 picture_pile_(FakePicturePileImpl::CreatePile()) {} | 63 0).Pass(); |
| 64 tile_manager_.reset(new FakeTileManager(&tile_manager_client_, |
| 65 resource_provider_.get())); |
| 66 picture_pile_ = FakePicturePileImpl::CreatePile(); |
| 67 } |
| 63 | 68 |
| 64 scoped_refptr<Tile> CreateTile() { | 69 scoped_refptr<Tile> CreateTile() { |
| 65 return make_scoped_refptr(new Tile(tile_manager_.get(), | 70 return make_scoped_refptr(new Tile(tile_manager_.get(), |
| 66 picture_pile_.get(), | 71 picture_pile_.get(), |
| 67 settings_.default_tile_size, | 72 settings_.default_tile_size, |
| 68 gfx::Rect(), | 73 gfx::Rect(), |
| 69 gfx::Rect(), | 74 gfx::Rect(), |
| 70 1.0, | 75 1.0, |
| 71 0, | 76 0, |
| 72 0, | 77 0, |
| 73 true)); | 78 true)); |
| 74 } | 79 } |
| 75 | 80 |
| 76 private: | 81 private: |
| 77 FakeTileManagerClient tile_manager_client_; | |
| 78 LayerTreeSettings settings_; | 82 LayerTreeSettings settings_; |
| 83 FakeOutputSurfaceClient output_surface_client_; |
| 79 scoped_ptr<FakeOutputSurface> output_surface_; | 84 scoped_ptr<FakeOutputSurface> output_surface_; |
| 80 scoped_ptr<ResourceProvider> resource_provider_; | 85 scoped_ptr<ResourceProvider> resource_provider_; |
| 86 FakeTileManagerClient tile_manager_client_; |
| 81 scoped_ptr<FakeTileManager> tile_manager_; | 87 scoped_ptr<FakeTileManager> tile_manager_; |
| 82 scoped_refptr<FakePicturePileImpl> picture_pile_; | 88 scoped_refptr<FakePicturePileImpl> picture_pile_; |
| 83 }; | 89 }; |
| 84 | 90 |
| 85 TEST_F(PrioritizedTileSetTest, EmptyIterator) { | 91 TEST_F(PrioritizedTileSetTest, EmptyIterator) { |
| 86 PrioritizedTileSet set; | 92 PrioritizedTileSet set; |
| 87 set.Sort(); | 93 set.Sort(); |
| 88 | 94 |
| 89 PrioritizedTileSet::PriorityIterator it(&set); | 95 PrioritizedTileSet::PriorityIterator it(&set); |
| 90 EXPECT_FALSE(it); | 96 EXPECT_FALSE(it); |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 | 467 |
| 462 set.Clear(); | 468 set.Clear(); |
| 463 | 469 |
| 464 PrioritizedTileSet::PriorityIterator empty_it(&set); | 470 PrioritizedTileSet::PriorityIterator empty_it(&set); |
| 465 EXPECT_FALSE(empty_it); | 471 EXPECT_FALSE(empty_it); |
| 466 } | 472 } |
| 467 | 473 |
| 468 } // namespace | 474 } // namespace |
| 469 } // namespace cc | 475 } // namespace cc |
| 470 | 476 |
| OLD | NEW |