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

Side by Side Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 1177033008: cc: Turn impl_side_painting and use_one_copy on in LayerTreeSettings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: implon: fixwebkittests Created 5 years, 6 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
« no previous file with comments | « cc/trees/layer_tree_host.cc ('k') | cc/trees/layer_tree_host_impl.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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/trees/layer_tree_host_common.h" 5 #include "cc/trees/layer_tree_host_common.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "cc/animation/layer_animation_controller.h" 10 #include "cc/animation/layer_animation_controller.h"
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 const gfx::ScrollOffset kScrollOffset(50, 100); 314 const gfx::ScrollOffset kScrollOffset(50, 100);
315 const gfx::Vector2dF kScrollDelta(2.34f, 5.67f); 315 const gfx::Vector2dF kScrollDelta(2.34f, 5.67f);
316 const gfx::Vector2d kMaxScrollOffset(200, 200); 316 const gfx::Vector2d kMaxScrollOffset(200, 200);
317 const gfx::PointF kScrollLayerPosition(-kScrollOffset.x(), 317 const gfx::PointF kScrollLayerPosition(-kScrollOffset.x(),
318 -kScrollOffset.y()); 318 -kScrollOffset.y());
319 const float kPageScale = 0.888f; 319 const float kPageScale = 0.888f;
320 const float kDeviceScale = 1.666f; 320 const float kDeviceScale = 1.666f;
321 321
322 FakeImplProxy proxy; 322 FakeImplProxy proxy;
323 TestSharedBitmapManager shared_bitmap_manager; 323 TestSharedBitmapManager shared_bitmap_manager;
324 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); 324 TestTaskGraphRunner task_graph_runner;
325 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
326 &task_graph_runner);
325 327
326 gfx::Transform identity_matrix; 328 gfx::Transform identity_matrix;
327 scoped_ptr<LayerImpl> sublayer_scoped_ptr( 329 scoped_ptr<LayerImpl> sublayer_scoped_ptr(
328 LayerImpl::Create(host_impl.active_tree(), 1)); 330 LayerImpl::Create(host_impl.active_tree(), 1));
329 LayerImpl* sublayer = sublayer_scoped_ptr.get(); 331 LayerImpl* sublayer = sublayer_scoped_ptr.get();
330 sublayer->SetContentsScale(kPageScale * kDeviceScale, 332 sublayer->SetContentsScale(kPageScale * kDeviceScale,
331 kPageScale * kDeviceScale); 333 kPageScale * kDeviceScale);
332 SetLayerPropertiesForTesting(sublayer, identity_matrix, gfx::Point3F(), 334 SetLayerPropertiesForTesting(sublayer, identity_matrix, gfx::Point3F(),
333 gfx::PointF(), gfx::Size(500, 500), true, false, 335 gfx::PointF(), gfx::Size(500, 500), true, false,
334 false); 336 false);
(...skipping 5482 matching lines...) Expand 10 before | Expand all | Expand 10 after
5817 host->SetRootLayer(root); 5819 host->SetRootLayer(root);
5818 5820
5819 ExecuteCalculateDrawProperties(root.get()); 5821 ExecuteCalculateDrawProperties(root.get());
5820 5822
5821 EXPECT_FALSE(child->render_surface()); 5823 EXPECT_FALSE(child->render_surface());
5822 } 5824 }
5823 5825
5824 TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) { 5826 TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) {
5825 FakeImplProxy proxy; 5827 FakeImplProxy proxy;
5826 TestSharedBitmapManager shared_bitmap_manager; 5828 TestSharedBitmapManager shared_bitmap_manager;
5827 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); 5829 TestTaskGraphRunner task_graph_runner;
5830 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
5831 &task_graph_runner);
5828 host_impl.CreatePendingTree(); 5832 host_impl.CreatePendingTree();
5829 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); 5833 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1);
5830 5834
5831 const gfx::Transform identity_matrix; 5835 const gfx::Transform identity_matrix;
5832 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), 5836 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(),
5833 gfx::PointF(), gfx::Size(100, 100), true, false, 5837 gfx::PointF(), gfx::Size(100, 100), true, false,
5834 false); 5838 false);
5835 root->SetDrawsContent(true); 5839 root->SetDrawsContent(true);
5836 5840
5837 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2); 5841 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2);
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
6068 6072
6069 INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest, 6073 INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest,
6070 LCDTextTest, 6074 LCDTextTest,
6071 testing::Combine(testing::Bool(), 6075 testing::Combine(testing::Bool(),
6072 testing::Bool(), 6076 testing::Bool(),
6073 testing::Bool())); 6077 testing::Bool()));
6074 6078
6075 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayer) { 6079 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayer) {
6076 FakeImplProxy proxy; 6080 FakeImplProxy proxy;
6077 TestSharedBitmapManager shared_bitmap_manager; 6081 TestSharedBitmapManager shared_bitmap_manager;
6078 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); 6082 TestTaskGraphRunner task_graph_runner;
6083 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
6084 &task_graph_runner);
6079 host_impl.CreatePendingTree(); 6085 host_impl.CreatePendingTree();
6080 const gfx::Transform identity_matrix; 6086 const gfx::Transform identity_matrix;
6081 6087
6082 scoped_refptr<Layer> root = Layer::Create(layer_settings()); 6088 scoped_refptr<Layer> root = Layer::Create(layer_settings());
6083 SetLayerPropertiesForTesting(root.get(), 6089 SetLayerPropertiesForTesting(root.get(),
6084 identity_matrix, 6090 identity_matrix,
6085 gfx::Point3F(), 6091 gfx::Point3F(),
6086 gfx::PointF(), 6092 gfx::PointF(),
6087 gfx::Size(50, 50), 6093 gfx::Size(50, 50),
6088 true, 6094 true,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
6126 // hidden itself. 6132 // hidden itself.
6127 ASSERT_EQ(1u, render_surface_layer_list.size()); 6133 ASSERT_EQ(1u, render_surface_layer_list.size());
6128 ASSERT_EQ(2u, root->render_surface()->layer_list().size()); 6134 ASSERT_EQ(2u, root->render_surface()->layer_list().size());
6129 EXPECT_EQ(root->id(), root->render_surface()->layer_list().at(0)->id()); 6135 EXPECT_EQ(root->id(), root->render_surface()->layer_list().at(0)->id());
6130 EXPECT_EQ(child->id(), root->render_surface()->layer_list().at(1)->id()); 6136 EXPECT_EQ(child->id(), root->render_surface()->layer_list().at(1)->id());
6131 } 6137 }
6132 6138
6133 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) { 6139 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) {
6134 FakeImplProxy proxy; 6140 FakeImplProxy proxy;
6135 TestSharedBitmapManager shared_bitmap_manager; 6141 TestSharedBitmapManager shared_bitmap_manager;
6136 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); 6142 TestTaskGraphRunner task_graph_runner;
6143 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
6144 &task_graph_runner);
6137 host_impl.CreatePendingTree(); 6145 host_impl.CreatePendingTree();
6138 const gfx::Transform identity_matrix; 6146 const gfx::Transform identity_matrix;
6139 6147
6140 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); 6148 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1);
6141 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), 6149 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(),
6142 gfx::PointF(), gfx::Size(50, 50), true, false, 6150 gfx::PointF(), gfx::Size(50, 50), true, false,
6143 false); 6151 false);
6144 root->SetDrawsContent(true); 6152 root->SetDrawsContent(true);
6145 6153
6146 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2); 6154 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2);
(...skipping 24 matching lines...) Expand all
6171 // hidden itself. 6179 // hidden itself.
6172 ASSERT_EQ(1u, render_surface_layer_list.size()); 6180 ASSERT_EQ(1u, render_surface_layer_list.size());
6173 ASSERT_EQ(2u, root->render_surface()->layer_list().size()); 6181 ASSERT_EQ(2u, root->render_surface()->layer_list().size());
6174 EXPECT_EQ(1, root->render_surface()->layer_list().at(0)->id()); 6182 EXPECT_EQ(1, root->render_surface()->layer_list().at(0)->id());
6175 EXPECT_EQ(2, root->render_surface()->layer_list().at(1)->id()); 6183 EXPECT_EQ(2, root->render_surface()->layer_list().at(1)->id());
6176 } 6184 }
6177 6185
6178 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayers) { 6186 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayers) {
6179 FakeImplProxy proxy; 6187 FakeImplProxy proxy;
6180 TestSharedBitmapManager shared_bitmap_manager; 6188 TestSharedBitmapManager shared_bitmap_manager;
6181 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); 6189 TestTaskGraphRunner task_graph_runner;
6190 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
6191 &task_graph_runner);
6182 host_impl.CreatePendingTree(); 6192 host_impl.CreatePendingTree();
6183 const gfx::Transform identity_matrix; 6193 const gfx::Transform identity_matrix;
6184 6194
6185 scoped_refptr<Layer> root = Layer::Create(layer_settings()); 6195 scoped_refptr<Layer> root = Layer::Create(layer_settings());
6186 SetLayerPropertiesForTesting(root.get(), 6196 SetLayerPropertiesForTesting(root.get(),
6187 identity_matrix, 6197 identity_matrix,
6188 gfx::Point3F(), 6198 gfx::Point3F(),
6189 gfx::PointF(), 6199 gfx::PointF(),
6190 gfx::Size(50, 50), 6200 gfx::Size(50, 50),
6191 true, 6201 true,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
6228 // We should have one render surface and one layers. The child has 6238 // We should have one render surface and one layers. The child has
6229 // hidden itself and the grand child. 6239 // hidden itself and the grand child.
6230 ASSERT_EQ(1u, render_surface_layer_list.size()); 6240 ASSERT_EQ(1u, render_surface_layer_list.size());
6231 ASSERT_EQ(1u, root->render_surface()->layer_list().size()); 6241 ASSERT_EQ(1u, root->render_surface()->layer_list().size());
6232 EXPECT_EQ(root->id(), root->render_surface()->layer_list().at(0)->id()); 6242 EXPECT_EQ(root->id(), root->render_surface()->layer_list().at(0)->id());
6233 } 6243 }
6234 6244
6235 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) { 6245 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) {
6236 FakeImplProxy proxy; 6246 FakeImplProxy proxy;
6237 TestSharedBitmapManager shared_bitmap_manager; 6247 TestSharedBitmapManager shared_bitmap_manager;
6238 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); 6248 TestTaskGraphRunner task_graph_runner;
6249 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
6250 &task_graph_runner);
6239 host_impl.CreatePendingTree(); 6251 host_impl.CreatePendingTree();
6240 const gfx::Transform identity_matrix; 6252 const gfx::Transform identity_matrix;
6241 6253
6242 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); 6254 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1);
6243 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), 6255 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(),
6244 gfx::PointF(), gfx::Size(50, 50), true, false, 6256 gfx::PointF(), gfx::Size(50, 50), true, false,
6245 true); 6257 true);
6246 root->SetDrawsContent(true); 6258 root->SetDrawsContent(true);
6247 6259
6248 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2); 6260 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2);
(...skipping 24 matching lines...) Expand all
6273 ASSERT_EQ(1u, render_surface_layer_list.size()); 6285 ASSERT_EQ(1u, render_surface_layer_list.size());
6274 ASSERT_EQ(1u, root->render_surface()->layer_list().size()); 6286 ASSERT_EQ(1u, root->render_surface()->layer_list().size());
6275 EXPECT_EQ(1, root->render_surface()->layer_list().at(0)->id()); 6287 EXPECT_EQ(1, root->render_surface()->layer_list().at(0)->id());
6276 } 6288 }
6277 6289
6278 void EmptyCopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} 6290 void EmptyCopyOutputCallback(scoped_ptr<CopyOutputResult> result) {}
6279 6291
6280 TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) { 6292 TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) {
6281 FakeImplProxy proxy; 6293 FakeImplProxy proxy;
6282 TestSharedBitmapManager shared_bitmap_manager; 6294 TestSharedBitmapManager shared_bitmap_manager;
6283 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); 6295 TestTaskGraphRunner task_graph_runner;
6296 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
6297 &task_graph_runner);
6284 host_impl.CreatePendingTree(); 6298 host_impl.CreatePendingTree();
6285 const gfx::Transform identity_matrix; 6299 const gfx::Transform identity_matrix;
6286 6300
6287 scoped_refptr<Layer> root = Layer::Create(layer_settings()); 6301 scoped_refptr<Layer> root = Layer::Create(layer_settings());
6288 SetLayerPropertiesForTesting(root.get(), 6302 SetLayerPropertiesForTesting(root.get(),
6289 identity_matrix, 6303 identity_matrix,
6290 gfx::Point3F(), 6304 gfx::Point3F(),
6291 gfx::PointF(), 6305 gfx::PointF(),
6292 gfx::Size(50, 50), 6306 gfx::Size(50, 50),
6293 true, 6307 true,
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
6422 ASSERT_EQ(2u, copy_layer->render_surface()->layer_list().size()); 6436 ASSERT_EQ(2u, copy_layer->render_surface()->layer_list().size());
6423 EXPECT_EQ(copy_layer->id(), 6437 EXPECT_EQ(copy_layer->id(),
6424 copy_layer->render_surface()->layer_list().at(0)->id()); 6438 copy_layer->render_surface()->layer_list().at(0)->id());
6425 EXPECT_EQ(copy_child->id(), 6439 EXPECT_EQ(copy_child->id(),
6426 copy_layer->render_surface()->layer_list().at(1)->id()); 6440 copy_layer->render_surface()->layer_list().at(1)->id());
6427 } 6441 }
6428 6442
6429 TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) { 6443 TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) {
6430 FakeImplProxy proxy; 6444 FakeImplProxy proxy;
6431 TestSharedBitmapManager shared_bitmap_manager; 6445 TestSharedBitmapManager shared_bitmap_manager;
6432 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); 6446 TestTaskGraphRunner task_graph_runner;
6447 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
6448 &task_graph_runner);
6433 host_impl.CreatePendingTree(); 6449 host_impl.CreatePendingTree();
6434 const gfx::Transform identity_matrix; 6450 const gfx::Transform identity_matrix;
6435 6451
6436 scoped_refptr<Layer> root = Layer::Create(layer_settings()); 6452 scoped_refptr<Layer> root = Layer::Create(layer_settings());
6437 SetLayerPropertiesForTesting(root.get(), 6453 SetLayerPropertiesForTesting(root.get(),
6438 identity_matrix, 6454 identity_matrix,
6439 gfx::Point3F(), 6455 gfx::Point3F(),
6440 gfx::PointF(), 6456 gfx::PointF(),
6441 gfx::Size(50, 50), 6457 gfx::Size(50, 50),
6442 true, 6458 true,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
6497 6513
6498 // The root render surface should only have 1 contributing layer, since the 6514 // The root render surface should only have 1 contributing layer, since the
6499 // other layers are empty/clipped away. 6515 // other layers are empty/clipped away.
6500 ASSERT_EQ(1u, root->render_surface()->layer_list().size()); 6516 ASSERT_EQ(1u, root->render_surface()->layer_list().size());
6501 EXPECT_EQ(root->id(), root->render_surface()->layer_list().at(0)->id()); 6517 EXPECT_EQ(root->id(), root->render_surface()->layer_list().at(0)->id());
6502 } 6518 }
6503 6519
6504 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInsideSurface) { 6520 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInsideSurface) {
6505 FakeImplProxy proxy; 6521 FakeImplProxy proxy;
6506 TestSharedBitmapManager shared_bitmap_manager; 6522 TestSharedBitmapManager shared_bitmap_manager;
6507 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); 6523 TestTaskGraphRunner task_graph_runner;
6524 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
6525 &task_graph_runner);
6508 host_impl.CreatePendingTree(); 6526 host_impl.CreatePendingTree();
6509 const gfx::Transform identity_matrix; 6527 const gfx::Transform identity_matrix;
6510 6528
6511 scoped_refptr<Layer> root = Layer::Create(layer_settings()); 6529 scoped_refptr<Layer> root = Layer::Create(layer_settings());
6512 SetLayerPropertiesForTesting(root.get(), 6530 SetLayerPropertiesForTesting(root.get(),
6513 identity_matrix, 6531 identity_matrix,
6514 gfx::Point3F(), 6532 gfx::Point3F(),
6515 gfx::PointF(), 6533 gfx::PointF(),
6516 gfx::Size(50, 50), 6534 gfx::Size(50, 50),
6517 true, 6535 true,
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
7108 render_surface2->render_surface()->content_rect().ToString()); 7126 render_surface2->render_surface()->content_rect().ToString());
7109 7127
7110 // Sanity check our num_unclipped_descendants values. 7128 // Sanity check our num_unclipped_descendants values.
7111 EXPECT_EQ(1u, render_surface1->num_unclipped_descendants()); 7129 EXPECT_EQ(1u, render_surface1->num_unclipped_descendants());
7112 EXPECT_EQ(0u, render_surface2->num_unclipped_descendants()); 7130 EXPECT_EQ(0u, render_surface2->num_unclipped_descendants());
7113 } 7131 }
7114 7132
7115 TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) { 7133 TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) {
7116 FakeImplProxy proxy; 7134 FakeImplProxy proxy;
7117 TestSharedBitmapManager shared_bitmap_manager; 7135 TestSharedBitmapManager shared_bitmap_manager;
7118 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); 7136 TestTaskGraphRunner task_graph_runner;
7137 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
7138 &task_graph_runner);
7119 scoped_ptr<LayerImpl> root = 7139 scoped_ptr<LayerImpl> root =
7120 LayerImpl::Create(host_impl.active_tree(), 12345); 7140 LayerImpl::Create(host_impl.active_tree(), 12345);
7121 scoped_ptr<LayerImpl> child1 = 7141 scoped_ptr<LayerImpl> child1 =
7122 LayerImpl::Create(host_impl.active_tree(), 123456); 7142 LayerImpl::Create(host_impl.active_tree(), 123456);
7123 scoped_ptr<LayerImpl> child2 = 7143 scoped_ptr<LayerImpl> child2 =
7124 LayerImpl::Create(host_impl.active_tree(), 1234567); 7144 LayerImpl::Create(host_impl.active_tree(), 1234567);
7125 scoped_ptr<LayerImpl> child3 = 7145 scoped_ptr<LayerImpl> child3 =
7126 LayerImpl::Create(host_impl.active_tree(), 12345678); 7146 LayerImpl::Create(host_impl.active_tree(), 12345678);
7127 7147
7128 gfx::Transform identity_matrix; 7148 gfx::Transform identity_matrix;
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
7850 // This test verifies that a scrolling layer that gets snapped to 7870 // This test verifies that a scrolling layer that gets snapped to
7851 // integer coordinates doesn't move a fixed position child. 7871 // integer coordinates doesn't move a fixed position child.
7852 // 7872 //
7853 // + root 7873 // + root
7854 // + container 7874 // + container
7855 // + scroller 7875 // + scroller
7856 // + fixed 7876 // + fixed
7857 // 7877 //
7858 FakeImplProxy proxy; 7878 FakeImplProxy proxy;
7859 TestSharedBitmapManager shared_bitmap_manager; 7879 TestSharedBitmapManager shared_bitmap_manager;
7860 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); 7880 TestTaskGraphRunner task_graph_runner;
7881 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
7882 &task_graph_runner);
7861 host_impl.CreatePendingTree(); 7883 host_impl.CreatePendingTree();
7862 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); 7884 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
7863 scoped_ptr<LayerImpl> container = 7885 scoped_ptr<LayerImpl> container =
7864 LayerImpl::Create(host_impl.active_tree(), 2); 7886 LayerImpl::Create(host_impl.active_tree(), 2);
7865 LayerImpl* container_layer = container.get(); 7887 LayerImpl* container_layer = container.get();
7866 scoped_ptr<LayerImpl> scroller = 7888 scoped_ptr<LayerImpl> scroller =
7867 LayerImpl::Create(host_impl.active_tree(), 3); 7889 LayerImpl::Create(host_impl.active_tree(), 3);
7868 LayerImpl* scroll_layer = scroller.get(); 7890 LayerImpl* scroll_layer = scroller.get();
7869 scoped_ptr<LayerImpl> fixed = LayerImpl::Create(host_impl.active_tree(), 4); 7891 scoped_ptr<LayerImpl> fixed = LayerImpl::Create(host_impl.active_tree(), 4);
7870 LayerImpl* fixed_layer = fixed.get(); 7892 LayerImpl* fixed_layer = fixed.get();
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
7994 // This test verifies that a scrolling layer that has fractional scroll offset 8016 // This test verifies that a scrolling layer that has fractional scroll offset
7995 // from main doesn't move a fixed position child. 8017 // from main doesn't move a fixed position child.
7996 // 8018 //
7997 // + root 8019 // + root
7998 // + container 8020 // + container
7999 // + scroller 8021 // + scroller
8000 // + fixed 8022 // + fixed
8001 // 8023 //
8002 FakeImplProxy proxy; 8024 FakeImplProxy proxy;
8003 TestSharedBitmapManager shared_bitmap_manager; 8025 TestSharedBitmapManager shared_bitmap_manager;
8004 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); 8026 TestTaskGraphRunner task_graph_runner;
8027 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
8028 &task_graph_runner);
8005 host_impl.CreatePendingTree(); 8029 host_impl.CreatePendingTree();
8006 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); 8030 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
8007 scoped_ptr<LayerImpl> container = 8031 scoped_ptr<LayerImpl> container =
8008 LayerImpl::Create(host_impl.active_tree(), 2); 8032 LayerImpl::Create(host_impl.active_tree(), 2);
8009 LayerImpl* container_layer = container.get(); 8033 LayerImpl* container_layer = container.get();
8010 scoped_ptr<LayerImpl> scroller = 8034 scoped_ptr<LayerImpl> scroller =
8011 LayerImpl::Create(host_impl.active_tree(), 3); 8035 LayerImpl::Create(host_impl.active_tree(), 3);
8012 LayerImpl* scroll_layer = scroller.get(); 8036 LayerImpl* scroll_layer = scroller.get();
8013 scoped_ptr<LayerImpl> fixed = LayerImpl::Create(host_impl.active_tree(), 4); 8037 scoped_ptr<LayerImpl> fixed = LayerImpl::Create(host_impl.active_tree(), 4);
8014 LayerImpl* fixed_layer = fixed.get(); 8038 LayerImpl* fixed_layer = fixed.get();
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
8088 explicit AnimationScaleFactorTrackingLayerImpl(LayerTreeImpl* tree_impl, 8112 explicit AnimationScaleFactorTrackingLayerImpl(LayerTreeImpl* tree_impl,
8089 int id) 8113 int id)
8090 : LayerImpl(tree_impl, id) { 8114 : LayerImpl(tree_impl, id) {
8091 SetDrawsContent(true); 8115 SetDrawsContent(true);
8092 } 8116 }
8093 }; 8117 };
8094 8118
8095 TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) { 8119 TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) {
8096 FakeImplProxy proxy; 8120 FakeImplProxy proxy;
8097 TestSharedBitmapManager shared_bitmap_manager; 8121 TestSharedBitmapManager shared_bitmap_manager;
8098 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); 8122 TestTaskGraphRunner task_graph_runner;
8123 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
8124 &task_graph_runner);
8099 gfx::Transform identity_matrix; 8125 gfx::Transform identity_matrix;
8100 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> grand_parent = 8126 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> grand_parent =
8101 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 1); 8127 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 1);
8102 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> parent = 8128 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> parent =
8103 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 2); 8129 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 2);
8104 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> child = 8130 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> child =
8105 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 3); 8131 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 3);
8106 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> grand_child = 8132 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> grand_child =
8107 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 4); 8133 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 4);
8108 8134
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
8309 if (layer->mask_layer()) 8335 if (layer->mask_layer())
8310 drawn_layers->insert(layer->mask_layer()); 8336 drawn_layers->insert(layer->mask_layer());
8311 if (layer->replica_layer() && layer->replica_layer()->mask_layer()) 8337 if (layer->replica_layer() && layer->replica_layer()->mask_layer())
8312 drawn_layers->insert(layer->replica_layer()->mask_layer()); 8338 drawn_layers->insert(layer->replica_layer()->mask_layer());
8313 } 8339 }
8314 } 8340 }
8315 8341
8316 TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) { 8342 TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) {
8317 FakeImplProxy proxy; 8343 FakeImplProxy proxy;
8318 TestSharedBitmapManager shared_bitmap_manager; 8344 TestSharedBitmapManager shared_bitmap_manager;
8319 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); 8345 TestTaskGraphRunner task_graph_runner;
8346 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
8347 &task_graph_runner);
8320 gfx::Transform identity_matrix; 8348 gfx::Transform identity_matrix;
8321 8349
8322 scoped_ptr<LayerImpl> grand_parent = 8350 scoped_ptr<LayerImpl> grand_parent =
8323 LayerImpl::Create(host_impl.active_tree(), 1); 8351 LayerImpl::Create(host_impl.active_tree(), 1);
8324 scoped_ptr<LayerImpl> parent = LayerImpl::Create(host_impl.active_tree(), 3); 8352 scoped_ptr<LayerImpl> parent = LayerImpl::Create(host_impl.active_tree(), 3);
8325 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.active_tree(), 5); 8353 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.active_tree(), 5);
8326 scoped_ptr<LayerImpl> grand_child1 = 8354 scoped_ptr<LayerImpl> grand_child1 =
8327 LayerImpl::Create(host_impl.active_tree(), 7); 8355 LayerImpl::Create(host_impl.active_tree(), 7);
8328 scoped_ptr<LayerImpl> grand_child2 = 8356 scoped_ptr<LayerImpl> grand_child2 =
8329 LayerImpl::Create(host_impl.active_tree(), 9); 8357 LayerImpl::Create(host_impl.active_tree(), 9);
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
8552 expected.insert(grand_child2_raw); 8580 expected.insert(grand_child2_raw);
8553 8581
8554 actual.clear(); 8582 actual.clear();
8555 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); 8583 GatherDrawnLayers(render_surface_layer_list_impl(), &actual);
8556 EXPECT_EQ(expected, actual); 8584 EXPECT_EQ(expected, actual);
8557 } 8585 }
8558 8586
8559 TEST_F(LayerTreeHostCommonTest, DrawPropertyScales) { 8587 TEST_F(LayerTreeHostCommonTest, DrawPropertyScales) {
8560 FakeImplProxy proxy; 8588 FakeImplProxy proxy;
8561 TestSharedBitmapManager shared_bitmap_manager; 8589 TestSharedBitmapManager shared_bitmap_manager;
8562 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); 8590 TestTaskGraphRunner task_graph_runner;
8591 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
8592 &task_graph_runner);
8563 8593
8564 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); 8594 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
8565 LayerImpl* root_layer = root.get(); 8595 LayerImpl* root_layer = root.get();
8566 scoped_ptr<LayerImpl> child1 = LayerImpl::Create(host_impl.active_tree(), 2); 8596 scoped_ptr<LayerImpl> child1 = LayerImpl::Create(host_impl.active_tree(), 2);
8567 LayerImpl* child1_layer = child1.get(); 8597 LayerImpl* child1_layer = child1.get();
8568 scoped_ptr<LayerImpl> child2 = LayerImpl::Create(host_impl.active_tree(), 3); 8598 scoped_ptr<LayerImpl> child2 = LayerImpl::Create(host_impl.active_tree(), 3);
8569 LayerImpl* child2_layer = child2.get(); 8599 LayerImpl* child2_layer = child2.get();
8570 8600
8571 root->AddChild(child1.Pass()); 8601 root->AddChild(child1.Pass());
8572 root->AddChild(child2.Pass()); 8602 root->AddChild(child2.Pass());
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
8808 gfx::Size(768 / 2, 10000), 8838 gfx::Size(768 / 2, 10000),
8809 true, 8839 true,
8810 false); 8840 false);
8811 content->SetIsDrawable(true); 8841 content->SetIsDrawable(true);
8812 content->SetForceRenderSurface(true); 8842 content->SetForceRenderSurface(true);
8813 8843
8814 root->AddChild(clip); 8844 root->AddChild(clip);
8815 clip->AddChild(content); 8845 clip->AddChild(content);
8816 8846
8817 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); 8847 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D);
8818 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&client); 8848 TestTaskGraphRunner task_graph_runner;
8849 scoped_ptr<FakeLayerTreeHost> host =
8850 FakeLayerTreeHost::Create(&client, &task_graph_runner);
8819 host->SetRootLayer(root); 8851 host->SetRootLayer(root);
8820 8852
8821 gfx::Size device_viewport_size(768, 582); 8853 gfx::Size device_viewport_size(768, 582);
8822 RenderSurfaceLayerList render_surface_layer_list; 8854 RenderSurfaceLayerList render_surface_layer_list;
8823 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( 8855 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs(
8824 host->root_layer(), device_viewport_size, &render_surface_layer_list); 8856 host->root_layer(), device_viewport_size, &render_surface_layer_list);
8825 inputs.device_scale_factor = 2.f; 8857 inputs.device_scale_factor = 2.f;
8826 inputs.page_scale_factor = 1.f; 8858 inputs.page_scale_factor = 1.f;
8827 inputs.page_scale_layer = NULL; 8859 inputs.page_scale_layer = NULL;
8828 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 8860 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
8829 8861
8830 // Layers in the root render surface have their visible content rect clipped 8862 // Layers in the root render surface have their visible content rect clipped
8831 // by the viewport. 8863 // by the viewport.
8832 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), root->visible_content_rect()); 8864 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), root->visible_content_rect());
8833 8865
8834 // Layers drawing to a child render surface should still have their visible 8866 // Layers drawing to a child render surface should still have their visible
8835 // content rect clipped by the viewport. 8867 // content rect clipped by the viewport.
8836 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), content->visible_content_rect()); 8868 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), content->visible_content_rect());
8837 } 8869 }
8838 8870
8839 TEST_F(LayerTreeHostCommonTest, BoundsDeltaAffectVisibleContentRect) { 8871 TEST_F(LayerTreeHostCommonTest, BoundsDeltaAffectVisibleContentRect) {
8840 FakeImplProxy proxy; 8872 FakeImplProxy proxy;
8841 TestSharedBitmapManager shared_bitmap_manager; 8873 TestSharedBitmapManager shared_bitmap_manager;
8842 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); 8874 TestTaskGraphRunner task_graph_runner;
8875 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
8876 &task_graph_runner);
8843 8877
8844 // Set two layers: the root layer clips it's child, 8878 // Set two layers: the root layer clips it's child,
8845 // the child draws its content. 8879 // the child draws its content.
8846 8880
8847 gfx::Size root_size = gfx::Size(300, 500); 8881 gfx::Size root_size = gfx::Size(300, 500);
8848 8882
8849 // Sublayer should be bigger than the root enlarged by bounds_delta. 8883 // Sublayer should be bigger than the root enlarged by bounds_delta.
8850 gfx::Size sublayer_size = gfx::Size(300, 1000); 8884 gfx::Size sublayer_size = gfx::Size(300, 1000);
8851 8885
8852 // Device viewport accomidated the root and the top controls. 8886 // Device viewport accomidated the root and the top controls.
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
9439 9473
9440 greatgrandchild->RequestCopyOfOutput( 9474 greatgrandchild->RequestCopyOfOutput(
9441 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback))); 9475 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback)));
9442 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 9476 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
9443 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_rect_from_property_trees()); 9477 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_rect_from_property_trees());
9444 } 9478 }
9445 9479
9446 TEST_F(LayerTreeHostCommonTest, SkippingSubtreeImpl) { 9480 TEST_F(LayerTreeHostCommonTest, SkippingSubtreeImpl) {
9447 FakeImplProxy proxy; 9481 FakeImplProxy proxy;
9448 TestSharedBitmapManager shared_bitmap_manager; 9482 TestSharedBitmapManager shared_bitmap_manager;
9449 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); 9483 TestTaskGraphRunner task_graph_runner;
9484 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
9485 &task_graph_runner);
9450 9486
9451 gfx::Transform identity; 9487 gfx::Transform identity;
9452 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); 9488 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
9453 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.active_tree(), 2); 9489 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.active_tree(), 2);
9454 scoped_ptr<LayerImpl> grandchild = 9490 scoped_ptr<LayerImpl> grandchild =
9455 LayerImpl::Create(host_impl.active_tree(), 3); 9491 LayerImpl::Create(host_impl.active_tree(), 3);
9456 9492
9457 scoped_ptr<FakePictureLayerImpl> greatgrandchild( 9493 scoped_ptr<FakePictureLayerImpl> greatgrandchild(
9458 FakePictureLayerImpl::Create(host_impl.active_tree(), 4)); 9494 FakePictureLayerImpl::Create(host_impl.active_tree(), 4));
9459 9495
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
9711 EXPECT_FALSE(root->layer_or_descendant_is_drawn()); 9747 EXPECT_FALSE(root->layer_or_descendant_is_drawn());
9712 EXPECT_FALSE(root->visited()); 9748 EXPECT_FALSE(root->visited());
9713 EXPECT_FALSE(root->sorted_for_recursion()); 9749 EXPECT_FALSE(root->sorted_for_recursion());
9714 EXPECT_FALSE(child->layer_or_descendant_is_drawn()); 9750 EXPECT_FALSE(child->layer_or_descendant_is_drawn());
9715 EXPECT_FALSE(child->visited()); 9751 EXPECT_FALSE(child->visited());
9716 EXPECT_FALSE(child->sorted_for_recursion()); 9752 EXPECT_FALSE(child->sorted_for_recursion());
9717 } 9753 }
9718 9754
9719 } // namespace 9755 } // namespace
9720 } // namespace cc 9756 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host.cc ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698