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

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

Issue 20185002: ContextProvider in OutputSurface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: contextprovider: don't access Context3d() in OutputSurface contructors, it's not bound yet Created 7 years, 4 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_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
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 // Creating an iterator to an empty set should work (but create iterator that 92 // Creating an iterator to an empty set should work (but create iterator that
87 // isn't valid). 93 // isn't valid).
88 94
89 PrioritizedTileSet set; 95 PrioritizedTileSet set;
90 96
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 722
717 set.Clear(); 723 set.Clear();
718 724
719 PrioritizedTileSet::Iterator empty_it(&set, true); 725 PrioritizedTileSet::Iterator empty_it(&set, true);
720 EXPECT_FALSE(empty_it); 726 EXPECT_FALSE(empty_it);
721 } 727 }
722 728
723 } // namespace 729 } // namespace
724 } // namespace cc 730 } // namespace cc
725 731
OLDNEW
« no previous file with comments | « cc/resources/prioritized_resource_unittest.cc ('k') | cc/resources/raster_worker_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698