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

Side by Side Diff: cc/resources/picture_layer_tiling_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
« 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_picture_layer_tiling_client.h" 14 #include "cc/test/fake_picture_layer_tiling_client.h"
14 #include "cc/test/fake_tile_manager_client.h" 15 #include "cc/test/fake_tile_manager_client.h"
15 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
16 #include "ui/gfx/size_conversions.h" 17 #include "ui/gfx/size_conversions.h"
17 18
18 namespace cc { 19 namespace cc {
19 namespace { 20 namespace {
20 21
21 TEST(PictureLayerTilingSetTest, NoResources) { 22 TEST(PictureLayerTilingSetTest, NoResources) {
22 FakePictureLayerTilingClient client; 23 FakePictureLayerTilingClient client;
(...skipping 29 matching lines...) Expand all
52 } 53 }
53 54
54 class PictureLayerTilingSetTestWithResources : public testing::Test { 55 class PictureLayerTilingSetTestWithResources : public testing::Test {
55 public: 56 public:
56 void runTest( 57 void runTest(
57 int num_tilings, 58 int num_tilings,
58 float min_scale, 59 float min_scale,
59 float scale_increment, 60 float scale_increment,
60 float ideal_contents_scale, 61 float ideal_contents_scale,
61 float expected_scale) { 62 float expected_scale) {
63 FakeOutputSurfaceClient output_surface_client;
62 scoped_ptr<FakeOutputSurface> output_surface = 64 scoped_ptr<FakeOutputSurface> output_surface =
63 FakeOutputSurface::Create3d(); 65 FakeOutputSurface::Create3d();
66 CHECK(output_surface->BindToClient(&output_surface_client));
67
64 scoped_ptr<ResourceProvider> resource_provider = 68 scoped_ptr<ResourceProvider> resource_provider =
65 ResourceProvider::Create(output_surface.get(), 0); 69 ResourceProvider::Create(output_surface.get(), 0);
66 70
67 FakePictureLayerTilingClient client; 71 FakePictureLayerTilingClient client;
68 client.SetTileSize(gfx::Size(256, 256)); 72 client.SetTileSize(gfx::Size(256, 256));
69 gfx::Size layer_bounds(1000, 800); 73 gfx::Size layer_bounds(1000, 800);
70 PictureLayerTilingSet set(&client, layer_bounds); 74 PictureLayerTilingSet set(&client, layer_bounds);
71 75
72 float scale = min_scale; 76 float scale = min_scale;
73 for (int i = 0; i < num_tilings; ++i, scale += scale_increment) { 77 for (int i = 0; i < num_tilings; ++i, scale += scale_increment) {
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 std::vector<Tile*> new_tiles = target_->tiling_at(0)->AllTilesForTesting(); 416 std::vector<Tile*> new_tiles = target_->tiling_at(0)->AllTilesForTesting();
413 for (size_t i = 0; i < original_tiles.size(); ++i) { 417 for (size_t i = 0; i < original_tiles.size(); ++i) {
414 std::vector<Tile*>::iterator find = 418 std::vector<Tile*>::iterator find =
415 std::find(new_tiles.begin(), new_tiles.end(), original_tiles[i]); 419 std::find(new_tiles.begin(), new_tiles.end(), original_tiles[i]);
416 EXPECT_TRUE(find == new_tiles.end()); 420 EXPECT_TRUE(find == new_tiles.end());
417 } 421 }
418 } 422 }
419 423
420 } // namespace 424 } // namespace
421 } // namespace cc 425 } // 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