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

Side by Side Diff: cc/layers/picture_layer_unittest.cc

Issue 723343002: Update from https://crrev.com/304121 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « cc/layers/picture_layer_impl_unittest.cc ('k') | cc/layers/render_surface_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 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/layers/picture_layer.h" 5 #include "cc/layers/picture_layer.h"
6 6
7 #include "cc/layers/content_layer_client.h" 7 #include "cc/layers/content_layer_client.h"
8 #include "cc/layers/picture_layer_impl.h" 8 #include "cc/layers/picture_layer_impl.h"
9 #include "cc/resources/resource_update_queue.h" 9 #include "cc/resources/resource_update_queue.h"
10 #include "cc/test/fake_layer_tree_host.h" 10 #include "cc/test/fake_layer_tree_host.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 TestSharedBitmapManager shared_bitmap_manager; 59 TestSharedBitmapManager shared_bitmap_manager;
60 FakeLayerTreeHostImpl host_impl( 60 FakeLayerTreeHostImpl host_impl(
61 ImplSidePaintingSettings(), &proxy, &shared_bitmap_manager); 61 ImplSidePaintingSettings(), &proxy, &shared_bitmap_manager);
62 host_impl.CreatePendingTree(); 62 host_impl.CreatePendingTree();
63 scoped_ptr<FakePictureLayerImpl> layer_impl = 63 scoped_ptr<FakePictureLayerImpl> layer_impl =
64 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1); 64 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1);
65 65
66 layer->PushPropertiesTo(layer_impl.get()); 66 layer->PushPropertiesTo(layer_impl.get());
67 EXPECT_FALSE(layer_impl->CanHaveTilings()); 67 EXPECT_FALSE(layer_impl->CanHaveTilings());
68 EXPECT_TRUE(layer_impl->bounds() == gfx::Size(0, 0)); 68 EXPECT_TRUE(layer_impl->bounds() == gfx::Size(0, 0));
69 EXPECT_EQ(gfx::Size(), layer_impl->pile()->tiling_size()); 69 EXPECT_EQ(gfx::Size(), layer_impl->raster_source()->GetSize());
70 EXPECT_FALSE(layer_impl->pile()->HasRecordings()); 70 EXPECT_FALSE(layer_impl->raster_source()->HasRecordings());
71 } 71 }
72 } 72 }
73 73
74 TEST(PictureLayerTest, SuitableForGpuRasterization) { 74 TEST(PictureLayerTest, SuitableForGpuRasterization) {
75 MockContentLayerClient client; 75 MockContentLayerClient client;
76 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); 76 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client);
77 PicturePile* pile = layer->GetPicturePileForTesting(); 77 RecordingSource* recording_source = layer->GetRecordingSourceForTesting();
78 78
79 // Layer is suitable for gpu rasterization by default. 79 // Layer is suitable for gpu rasterization by default.
80 EXPECT_TRUE(pile->is_suitable_for_gpu_rasterization()); 80 EXPECT_TRUE(recording_source->IsSuitableForGpuRasterization());
81 EXPECT_TRUE(layer->IsSuitableForGpuRasterization()); 81 EXPECT_TRUE(layer->IsSuitableForGpuRasterization());
82 82
83 // Veto gpu rasterization. 83 // Veto gpu rasterization.
84 pile->SetUnsuitableForGpuRasterizationForTesting(); 84 recording_source->SetUnsuitableForGpuRasterizationForTesting();
85 EXPECT_FALSE(pile->is_suitable_for_gpu_rasterization()); 85 EXPECT_FALSE(recording_source->IsSuitableForGpuRasterization());
86 EXPECT_FALSE(layer->IsSuitableForGpuRasterization()); 86 EXPECT_FALSE(layer->IsSuitableForGpuRasterization());
87 } 87 }
88 88
89 TEST(PictureLayerTest, UseTileGridSize) { 89 TEST(PictureLayerTest, UseTileGridSize) {
90 LayerTreeSettings settings; 90 LayerTreeSettings settings;
91 settings.default_tile_grid_size = gfx::Size(123, 123); 91 settings.default_tile_grid_size = gfx::Size(123, 123);
92 92
93 MockContentLayerClient client; 93 MockContentLayerClient client;
94 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); 94 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client);
95 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); 95 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D);
96 scoped_ptr<FakeLayerTreeHost> host = 96 scoped_ptr<FakeLayerTreeHost> host =
97 FakeLayerTreeHost::Create(&host_client, settings); 97 FakeLayerTreeHost::Create(&host_client, settings);
98 host->SetRootLayer(layer); 98 host->SetRootLayer(layer);
99 99
100 // Tile-grid is set according to its setting. 100 // Tile-grid is set according to its setting.
101 SkTileGridFactory::TileGridInfo info = 101 SkTileGridFactory::TileGridInfo info =
102 layer->GetPicturePileForTesting()->GetTileGridInfoForTesting(); 102 layer->GetRecordingSourceForTesting()->GetTileGridInfoForTesting();
103 EXPECT_EQ(info.fTileInterval.width(), 123 - 2 * info.fMargin.width()); 103 EXPECT_EQ(info.fTileInterval.width(), 123 - 2 * info.fMargin.width());
104 EXPECT_EQ(info.fTileInterval.height(), 123 - 2 * info.fMargin.height()); 104 EXPECT_EQ(info.fTileInterval.height(), 123 - 2 * info.fMargin.height());
105 } 105 }
106 106
107 } // namespace 107 } // namespace
108 } // namespace cc 108 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl_unittest.cc ('k') | cc/layers/render_surface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698