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

Side by Side Diff: cc/resources/picture_layer_tiling_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
« no previous file with comments | « cc/output/software_renderer_unittest.cc ('k') | cc/resources/prioritized_resource_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/picture_layer_tiling_set.h" 5 #include "cc/resources/picture_layer_tiling_set.h"
6 6
7 #include <map> 7 #include <map>
8 #include <vector> 8 #include <vector>
9 9
10 #include "cc/resources/resource_pool.h" 10 #include "cc/resources/resource_pool.h"
11 #include "cc/resources/resource_provider.h" 11 #include "cc/resources/resource_provider.h"
12 #include "cc/test/fake_output_surface.h" 12 #include "cc/test/fake_output_surface.h"
13 #include "cc/test/fake_output_surface_client.h" 13 #include "cc/test/fake_output_surface_client.h"
14 #include "cc/test/fake_picture_layer_tiling_client.h" 14 #include "cc/test/fake_picture_layer_tiling_client.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 "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 #include "ui/gfx/size_conversions.h" 18 #include "ui/gfx/size_conversions.h"
18 19
19 namespace cc { 20 namespace cc {
20 namespace { 21 namespace {
21 22
22 TEST(PictureLayerTilingSetTest, NoResources) { 23 TEST(PictureLayerTilingSetTest, NoResources) {
23 FakePictureLayerTilingClient client; 24 FakePictureLayerTilingClient client;
24 gfx::Size layer_bounds(1000, 800); 25 gfx::Size layer_bounds(1000, 800);
25 PictureLayerTilingSet set(&client, layer_bounds); 26 PictureLayerTilingSet set(&client, layer_bounds);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 int num_tilings, 59 int num_tilings,
59 float min_scale, 60 float min_scale,
60 float scale_increment, 61 float scale_increment,
61 float ideal_contents_scale, 62 float ideal_contents_scale,
62 float expected_scale) { 63 float expected_scale) {
63 FakeOutputSurfaceClient output_surface_client; 64 FakeOutputSurfaceClient output_surface_client;
64 scoped_ptr<FakeOutputSurface> output_surface = 65 scoped_ptr<FakeOutputSurface> output_surface =
65 FakeOutputSurface::Create3d(); 66 FakeOutputSurface::Create3d();
66 CHECK(output_surface->BindToClient(&output_surface_client)); 67 CHECK(output_surface->BindToClient(&output_surface_client));
67 68
68 scoped_ptr<ResourceProvider> resource_provider = 69 scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
69 ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1); 70 new TestSharedBitmapManager());
71 scoped_ptr<ResourceProvider> resource_provider = ResourceProvider::Create(
72 output_surface.get(), shared_bitmap_manager.get(), 0, false, 1);
70 73
71 FakePictureLayerTilingClient client(resource_provider.get()); 74 FakePictureLayerTilingClient client(resource_provider.get());
72 client.SetTileSize(gfx::Size(256, 256)); 75 client.SetTileSize(gfx::Size(256, 256));
73 gfx::Size layer_bounds(1000, 800); 76 gfx::Size layer_bounds(1000, 800);
74 PictureLayerTilingSet set(&client, layer_bounds); 77 PictureLayerTilingSet set(&client, layer_bounds);
75 78
76 float scale = min_scale; 79 float scale = min_scale;
77 for (int i = 0; i < num_tilings; ++i, scale += scale_increment) { 80 for (int i = 0; i < num_tilings; ++i, scale += scale_increment) {
78 PictureLayerTiling* tiling = set.AddTiling(scale); 81 PictureLayerTiling* tiling = set.AddTiling(scale);
79 tiling->CreateAllTilesForTesting(); 82 tiling->CreateAllTilesForTesting();
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 std::vector<Tile*> new_tiles = target_->tiling_at(0)->AllTilesForTesting(); 410 std::vector<Tile*> new_tiles = target_->tiling_at(0)->AllTilesForTesting();
408 for (size_t i = 0; i < original_tiles.size(); ++i) { 411 for (size_t i = 0; i < original_tiles.size(); ++i) {
409 std::vector<Tile*>::iterator find = 412 std::vector<Tile*>::iterator find =
410 std::find(new_tiles.begin(), new_tiles.end(), original_tiles[i]); 413 std::find(new_tiles.begin(), new_tiles.end(), original_tiles[i]);
411 EXPECT_TRUE(find == new_tiles.end()); 414 EXPECT_TRUE(find == new_tiles.end());
412 } 415 }
413 } 416 }
414 417
415 } // namespace 418 } // namespace
416 } // namespace cc 419 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/software_renderer_unittest.cc ('k') | cc/resources/prioritized_resource_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698