Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(492)

Side by Side Diff: cc/resources/tile_manager_unittest.cc

Issue 202763002: Switch to use SharedBitmapManager all the time in cc_unittests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/resources/tile.h" 5 #include "cc/resources/tile.h"
6 #include "cc/resources/tile_priority.h" 6 #include "cc/resources/tile_priority.h"
7 #include "cc/test/fake_output_surface.h" 7 #include "cc/test/fake_output_surface.h"
8 #include "cc/test/fake_output_surface_client.h" 8 #include "cc/test/fake_output_surface_client.h"
9 #include "cc/test/fake_picture_pile_impl.h" 9 #include "cc/test/fake_picture_pile_impl.h"
10 #include "cc/test/fake_tile_manager.h" 10 #include "cc/test/fake_tile_manager.h"
11 #include "cc/test/test_shared_bitmap_manager.h"
11 #include "cc/test/test_tile_priorities.h" 12 #include "cc/test/test_tile_priorities.h"
12 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
13 14
14 namespace cc { 15 namespace cc {
15 namespace { 16 namespace {
16 17
17 class TileManagerTest : public testing::TestWithParam<bool>, 18 class TileManagerTest : public testing::TestWithParam<bool>,
18 public TileManagerClient { 19 public TileManagerClient {
19 public: 20 public:
20 typedef std::vector<scoped_refptr<Tile> > TileVector; 21 typedef std::vector<scoped_refptr<Tile> > TileVector;
21 22
22 TileManagerTest() 23 TileManagerTest()
23 : memory_limit_policy_(ALLOW_ANYTHING), 24 : memory_limit_policy_(ALLOW_ANYTHING),
24 max_tiles_(0), 25 max_tiles_(0),
25 ready_to_activate_(false) {} 26 ready_to_activate_(false) {}
26 27
27 void Initialize(int max_tiles, 28 void Initialize(int max_tiles,
28 TileMemoryLimitPolicy memory_limit_policy, 29 TileMemoryLimitPolicy memory_limit_policy,
29 TreePriority tree_priority, 30 TreePriority tree_priority,
30 bool allow_on_demand_raster = true) { 31 bool allow_on_demand_raster = true) {
31 output_surface_ = FakeOutputSurface::Create3d(); 32 output_surface_ = FakeOutputSurface::Create3d();
32 CHECK(output_surface_->BindToClient(&output_surface_client_)); 33 CHECK(output_surface_->BindToClient(&output_surface_client_));
33 34
34 resource_provider_ = 35 shared_bitmap_manager_.reset(new TestSharedBitmapManager());
35 ResourceProvider::Create(output_surface_.get(), NULL, 0, false, 1); 36 resource_provider_ = ResourceProvider::Create(
37 output_surface_.get(), shared_bitmap_manager_.get(), 0, false, 1);
36 tile_manager_ = make_scoped_ptr(new FakeTileManager( 38 tile_manager_ = make_scoped_ptr(new FakeTileManager(
37 this, resource_provider_.get(), allow_on_demand_raster)); 39 this, resource_provider_.get(), allow_on_demand_raster));
38 40
39 memory_limit_policy_ = memory_limit_policy; 41 memory_limit_policy_ = memory_limit_policy;
40 max_tiles_ = max_tiles; 42 max_tiles_ = max_tiles;
41 picture_pile_ = FakePicturePileImpl::CreatePile(); 43 picture_pile_ = FakePicturePileImpl::CreatePile();
42 44
43 SetTreePriority(tree_priority); 45 SetTreePriority(tree_priority);
44 } 46 }
45 47
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 135
134 protected: 136 protected:
135 GlobalStateThatImpactsTilePriority global_state_; 137 GlobalStateThatImpactsTilePriority global_state_;
136 138
137 private: 139 private:
138 LayerTreeSettings settings_; 140 LayerTreeSettings settings_;
139 scoped_ptr<FakeTileManager> tile_manager_; 141 scoped_ptr<FakeTileManager> tile_manager_;
140 scoped_refptr<FakePicturePileImpl> picture_pile_; 142 scoped_refptr<FakePicturePileImpl> picture_pile_;
141 FakeOutputSurfaceClient output_surface_client_; 143 FakeOutputSurfaceClient output_surface_client_;
142 scoped_ptr<FakeOutputSurface> output_surface_; 144 scoped_ptr<FakeOutputSurface> output_surface_;
145 scoped_ptr<SharedBitmapManager> shared_bitmap_manager_;
143 scoped_ptr<ResourceProvider> resource_provider_; 146 scoped_ptr<ResourceProvider> resource_provider_;
144 TileMemoryLimitPolicy memory_limit_policy_; 147 TileMemoryLimitPolicy memory_limit_policy_;
145 int max_tiles_; 148 int max_tiles_;
146 bool ready_to_activate_; 149 bool ready_to_activate_;
147 }; 150 };
148 151
149 TEST_P(TileManagerTest, EnoughMemoryAllowAnything) { 152 TEST_P(TileManagerTest, EnoughMemoryAllowAnything) {
150 // A few tiles of each type of priority, with enough memory for all tiles. 153 // A few tiles of each type of priority, with enough memory for all tiles.
151 154
152 Initialize(10, ALLOW_ANYTHING, SMOOTHNESS_TAKES_PRIORITY); 155 Initialize(10, ALLOW_ANYTHING, SMOOTHNESS_TAKES_PRIORITY);
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 } 624 }
622 625
623 // If true, the max tile limit should be applied as bytes; if false, 626 // If true, the max tile limit should be applied as bytes; if false,
624 // as num_resources_limit. 627 // as num_resources_limit.
625 INSTANTIATE_TEST_CASE_P(TileManagerTests, 628 INSTANTIATE_TEST_CASE_P(TileManagerTests,
626 TileManagerTest, 629 TileManagerTest,
627 ::testing::Values(true, false)); 630 ::testing::Values(true, false));
628 631
629 } // namespace 632 } // namespace
630 } // namespace cc 633 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698