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

Side by Side Diff: cc/resources/prioritized_tile_set_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 <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_output_surface_client.h"
13 #include "cc/test/fake_picture_pile_impl.h" 13 #include "cc/test/fake_picture_pile_impl.h"
14 #include "cc/test/fake_tile_manager.h" 14 #include "cc/test/fake_tile_manager.h"
15 #include "cc/test/fake_tile_manager_client.h" 15 #include "cc/test/fake_tile_manager_client.h"
16 #include "cc/test/test_shared_bitmap_manager.h"
16 #include "cc/test/test_tile_priorities.h" 17 #include "cc/test/test_tile_priorities.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 19
19 namespace cc { 20 namespace cc {
20 21
21 class BinComparator { 22 class BinComparator {
22 public: 23 public:
23 bool operator()(const scoped_refptr<Tile>& a, 24 bool operator()(const scoped_refptr<Tile>& a,
24 const scoped_refptr<Tile>& b) const { 25 const scoped_refptr<Tile>& b) const {
25 const ManagedTileState& ams = a->managed_state(); 26 const ManagedTileState& ams = a->managed_state();
(...skipping 20 matching lines...) Expand all
46 }; 47 };
47 48
48 namespace { 49 namespace {
49 50
50 class PrioritizedTileSetTest : public testing::Test { 51 class PrioritizedTileSetTest : public testing::Test {
51 public: 52 public:
52 PrioritizedTileSetTest() { 53 PrioritizedTileSetTest() {
53 output_surface_ = FakeOutputSurface::Create3d().Pass(); 54 output_surface_ = FakeOutputSurface::Create3d().Pass();
54 CHECK(output_surface_->BindToClient(&output_surface_client_)); 55 CHECK(output_surface_->BindToClient(&output_surface_client_));
55 56
57 shared_bitmap_manager_.reset(new TestSharedBitmapManager());
56 resource_provider_ = 58 resource_provider_ =
57 ResourceProvider::Create(output_surface_.get(), 59 ResourceProvider::Create(
58 NULL, 60 output_surface_.get(), shared_bitmap_manager_.get(), 0, false, 1)
59 0, 61 .Pass();
60 false,
61 1).Pass();
62 tile_manager_.reset( 62 tile_manager_.reset(
63 new FakeTileManager(&tile_manager_client_, resource_provider_.get())); 63 new FakeTileManager(&tile_manager_client_, resource_provider_.get()));
64 picture_pile_ = FakePicturePileImpl::CreateInfiniteFilledPile(); 64 picture_pile_ = FakePicturePileImpl::CreateInfiniteFilledPile();
65 } 65 }
66 66
67 scoped_refptr<Tile> CreateTile() { 67 scoped_refptr<Tile> CreateTile() {
68 return tile_manager_->CreateTile(picture_pile_.get(), 68 return tile_manager_->CreateTile(picture_pile_.get(),
69 settings_.default_tile_size, 69 settings_.default_tile_size,
70 gfx::Rect(), 70 gfx::Rect(),
71 gfx::Rect(), 71 gfx::Rect(),
72 1.0, 72 1.0,
73 0, 73 0,
74 0, 74 0,
75 Tile::USE_LCD_TEXT); 75 Tile::USE_LCD_TEXT);
76 } 76 }
77 77
78 private: 78 private:
79 LayerTreeSettings settings_; 79 LayerTreeSettings settings_;
80 FakeOutputSurfaceClient output_surface_client_; 80 FakeOutputSurfaceClient output_surface_client_;
81 scoped_ptr<FakeOutputSurface> output_surface_; 81 scoped_ptr<FakeOutputSurface> output_surface_;
82 scoped_ptr<SharedBitmapManager> shared_bitmap_manager_;
82 scoped_ptr<ResourceProvider> resource_provider_; 83 scoped_ptr<ResourceProvider> resource_provider_;
83 FakeTileManagerClient tile_manager_client_; 84 FakeTileManagerClient tile_manager_client_;
84 scoped_ptr<FakeTileManager> tile_manager_; 85 scoped_ptr<FakeTileManager> tile_manager_;
85 scoped_refptr<FakePicturePileImpl> picture_pile_; 86 scoped_refptr<FakePicturePileImpl> picture_pile_;
86 }; 87 };
87 88
88 TEST_F(PrioritizedTileSetTest, EmptyIterator) { 89 TEST_F(PrioritizedTileSetTest, EmptyIterator) {
89 // Creating an iterator to an empty set should work (but create iterator that 90 // Creating an iterator to an empty set should work (but create iterator that
90 // isn't valid). 91 // isn't valid).
91 92
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 719
719 set.Clear(); 720 set.Clear();
720 721
721 PrioritizedTileSet::Iterator empty_it(&set, true); 722 PrioritizedTileSet::Iterator empty_it(&set, true);
722 EXPECT_FALSE(empty_it); 723 EXPECT_FALSE(empty_it);
723 } 724 }
724 725
725 } // namespace 726 } // namespace
726 } // namespace cc 727 } // namespace cc
727 728
OLDNEW
« no previous file with comments | « cc/resources/prioritized_resource_unittest.cc ('k') | cc/resources/raster_worker_pool_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698