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

Side by Side Diff: cc/trees/layer_tree_host_common_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/trees/layer_sorter_unittest.cc ('k') | cc/trees/layer_tree_host_impl_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 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 <set> 7 #include <set>
8 8
9 #include "cc/animation/layer_animation_controller.h" 9 #include "cc/animation/layer_animation_controller.h"
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) { 381 TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) {
382 const gfx::Vector2d kScrollOffset(50, 100); 382 const gfx::Vector2d kScrollOffset(50, 100);
383 const gfx::Vector2dF kScrollDelta(2.34f, 5.67f); 383 const gfx::Vector2dF kScrollDelta(2.34f, 5.67f);
384 const gfx::Vector2d kMaxScrollOffset(200, 200); 384 const gfx::Vector2d kMaxScrollOffset(200, 200);
385 const gfx::PointF kScrollLayerPosition(-kScrollOffset.x(), 385 const gfx::PointF kScrollLayerPosition(-kScrollOffset.x(),
386 -kScrollOffset.y()); 386 -kScrollOffset.y());
387 const float kPageScale = 0.888f; 387 const float kPageScale = 0.888f;
388 const float kDeviceScale = 1.666f; 388 const float kDeviceScale = 1.666f;
389 389
390 FakeImplProxy proxy; 390 FakeImplProxy proxy;
391 FakeLayerTreeHostImpl host_impl(&proxy); 391 TestSharedBitmapManager shared_bitmap_manager;
392 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
392 393
393 gfx::Transform identity_matrix; 394 gfx::Transform identity_matrix;
394 scoped_ptr<LayerImpl> sublayer_scoped_ptr( 395 scoped_ptr<LayerImpl> sublayer_scoped_ptr(
395 LayerImpl::Create(host_impl.active_tree(), 1)); 396 LayerImpl::Create(host_impl.active_tree(), 1));
396 LayerImpl* sublayer = sublayer_scoped_ptr.get(); 397 LayerImpl* sublayer = sublayer_scoped_ptr.get();
397 sublayer->SetContentsScale(kPageScale * kDeviceScale, 398 sublayer->SetContentsScale(kPageScale * kDeviceScale,
398 kPageScale * kDeviceScale); 399 kPageScale * kDeviceScale);
399 SetLayerPropertiesForTesting(sublayer, 400 SetLayerPropertiesForTesting(sublayer,
400 identity_matrix, 401 identity_matrix,
401 gfx::Point(), 402 gfx::Point(),
(...skipping 3632 matching lines...) Expand 10 before | Expand all | Expand 10 after
4034 EXPECT_FALSE(result_layer); 4035 EXPECT_FALSE(result_layer);
4035 4036
4036 test_point = gfx::Point(10, 20); 4037 test_point = gfx::Point(10, 20);
4037 result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint( 4038 result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
4038 test_point, render_surface_layer_list); 4039 test_point, render_surface_layer_list);
4039 EXPECT_FALSE(result_layer); 4040 EXPECT_FALSE(result_layer);
4040 } 4041 }
4041 4042
4042 TEST_F(LayerTreeHostCommonTest, HitTestingForSingleLayer) { 4043 TEST_F(LayerTreeHostCommonTest, HitTestingForSingleLayer) {
4043 FakeImplProxy proxy; 4044 FakeImplProxy proxy;
4044 FakeLayerTreeHostImpl host_impl(&proxy); 4045 TestSharedBitmapManager shared_bitmap_manager;
4046 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
4045 scoped_ptr<LayerImpl> root = 4047 scoped_ptr<LayerImpl> root =
4046 LayerImpl::Create(host_impl.active_tree(), 12345); 4048 LayerImpl::Create(host_impl.active_tree(), 12345);
4047 4049
4048 gfx::Transform identity_matrix; 4050 gfx::Transform identity_matrix;
4049 gfx::PointF anchor; 4051 gfx::PointF anchor;
4050 gfx::PointF position; 4052 gfx::PointF position;
4051 gfx::Size bounds(100, 100); 4053 gfx::Size bounds(100, 100);
4052 SetLayerPropertiesForTesting(root.get(), 4054 SetLayerPropertiesForTesting(root.get(),
4053 identity_matrix, 4055 identity_matrix,
4054 anchor, 4056 anchor,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
4088 4090
4089 test_point = gfx::Point(99, 99); 4091 test_point = gfx::Point(99, 99);
4090 result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint( 4092 result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
4091 test_point, render_surface_layer_list); 4093 test_point, render_surface_layer_list);
4092 ASSERT_TRUE(result_layer); 4094 ASSERT_TRUE(result_layer);
4093 EXPECT_EQ(12345, result_layer->id()); 4095 EXPECT_EQ(12345, result_layer->id());
4094 } 4096 }
4095 4097
4096 TEST_F(LayerTreeHostCommonTest, HitTestingForSingleLayerAndHud) { 4098 TEST_F(LayerTreeHostCommonTest, HitTestingForSingleLayerAndHud) {
4097 FakeImplProxy proxy; 4099 FakeImplProxy proxy;
4098 FakeLayerTreeHostImpl host_impl(&proxy); 4100 TestSharedBitmapManager shared_bitmap_manager;
4101 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
4099 scoped_ptr<LayerImpl> root = 4102 scoped_ptr<LayerImpl> root =
4100 LayerImpl::Create(host_impl.active_tree(), 12345); 4103 LayerImpl::Create(host_impl.active_tree(), 12345);
4101 scoped_ptr<HeadsUpDisplayLayerImpl> hud = 4104 scoped_ptr<HeadsUpDisplayLayerImpl> hud =
4102 HeadsUpDisplayLayerImpl::Create(host_impl.active_tree(), 11111); 4105 HeadsUpDisplayLayerImpl::Create(host_impl.active_tree(), 11111);
4103 4106
4104 gfx::Transform identity_matrix; 4107 gfx::Transform identity_matrix;
4105 gfx::PointF anchor; 4108 gfx::PointF anchor;
4106 gfx::PointF position; 4109 gfx::PointF position;
4107 gfx::Size bounds(100, 100); 4110 gfx::Size bounds(100, 100);
4108 SetLayerPropertiesForTesting(root.get(), 4111 SetLayerPropertiesForTesting(root.get(),
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
4159 4162
4160 test_point = gfx::Point(99, 99); 4163 test_point = gfx::Point(99, 99);
4161 result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint( 4164 result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
4162 test_point, render_surface_layer_list); 4165 test_point, render_surface_layer_list);
4163 ASSERT_TRUE(result_layer); 4166 ASSERT_TRUE(result_layer);
4164 EXPECT_EQ(12345, result_layer->id()); 4167 EXPECT_EQ(12345, result_layer->id());
4165 } 4168 }
4166 4169
4167 TEST_F(LayerTreeHostCommonTest, HitTestingForUninvertibleTransform) { 4170 TEST_F(LayerTreeHostCommonTest, HitTestingForUninvertibleTransform) {
4168 FakeImplProxy proxy; 4171 FakeImplProxy proxy;
4169 FakeLayerTreeHostImpl host_impl(&proxy); 4172 TestSharedBitmapManager shared_bitmap_manager;
4173 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
4170 scoped_ptr<LayerImpl> root = 4174 scoped_ptr<LayerImpl> root =
4171 LayerImpl::Create(host_impl.active_tree(), 12345); 4175 LayerImpl::Create(host_impl.active_tree(), 12345);
4172 4176
4173 gfx::Transform uninvertible_transform; 4177 gfx::Transform uninvertible_transform;
4174 uninvertible_transform.matrix().set(0, 0, 0.0); 4178 uninvertible_transform.matrix().set(0, 0, 0.0);
4175 uninvertible_transform.matrix().set(1, 1, 0.0); 4179 uninvertible_transform.matrix().set(1, 1, 0.0);
4176 uninvertible_transform.matrix().set(2, 2, 0.0); 4180 uninvertible_transform.matrix().set(2, 2, 0.0);
4177 uninvertible_transform.matrix().set(3, 3, 0.0); 4181 uninvertible_transform.matrix().set(3, 3, 0.0);
4178 ASSERT_FALSE(uninvertible_transform.IsInvertible()); 4182 ASSERT_FALSE(uninvertible_transform.IsInvertible());
4179 4183
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
4235 EXPECT_FALSE(result_layer); 4239 EXPECT_FALSE(result_layer);
4236 4240
4237 test_point = gfx::Point(-1, -1); 4241 test_point = gfx::Point(-1, -1);
4238 result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint( 4242 result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
4239 test_point, render_surface_layer_list); 4243 test_point, render_surface_layer_list);
4240 EXPECT_FALSE(result_layer); 4244 EXPECT_FALSE(result_layer);
4241 } 4245 }
4242 4246
4243 TEST_F(LayerTreeHostCommonTest, HitTestingForSinglePositionedLayer) { 4247 TEST_F(LayerTreeHostCommonTest, HitTestingForSinglePositionedLayer) {
4244 FakeImplProxy proxy; 4248 FakeImplProxy proxy;
4245 FakeLayerTreeHostImpl host_impl(&proxy); 4249 TestSharedBitmapManager shared_bitmap_manager;
4250 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
4246 scoped_ptr<LayerImpl> root = 4251 scoped_ptr<LayerImpl> root =
4247 LayerImpl::Create(host_impl.active_tree(), 12345); 4252 LayerImpl::Create(host_impl.active_tree(), 12345);
4248 4253
4249 gfx::Transform identity_matrix; 4254 gfx::Transform identity_matrix;
4250 gfx::PointF anchor; 4255 gfx::PointF anchor;
4251 // this layer is positioned, and hit testing should correctly know where the 4256 // this layer is positioned, and hit testing should correctly know where the
4252 // layer is located. 4257 // layer is located.
4253 gfx::PointF position(50.f, 50.f); 4258 gfx::PointF position(50.f, 50.f);
4254 gfx::Size bounds(100, 100); 4259 gfx::Size bounds(100, 100);
4255 SetLayerPropertiesForTesting(root.get(), 4260 SetLayerPropertiesForTesting(root.get(),
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
4293 4298
4294 test_point = gfx::Point(99, 99); 4299 test_point = gfx::Point(99, 99);
4295 result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint( 4300 result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
4296 test_point, render_surface_layer_list); 4301 test_point, render_surface_layer_list);
4297 ASSERT_TRUE(result_layer); 4302 ASSERT_TRUE(result_layer);
4298 EXPECT_EQ(12345, result_layer->id()); 4303 EXPECT_EQ(12345, result_layer->id());
4299 } 4304 }
4300 4305
4301 TEST_F(LayerTreeHostCommonTest, HitTestingForSingleRotatedLayer) { 4306 TEST_F(LayerTreeHostCommonTest, HitTestingForSingleRotatedLayer) {
4302 FakeImplProxy proxy; 4307 FakeImplProxy proxy;
4303 FakeLayerTreeHostImpl host_impl(&proxy); 4308 TestSharedBitmapManager shared_bitmap_manager;
4309 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
4304 scoped_ptr<LayerImpl> root = 4310 scoped_ptr<LayerImpl> root =
4305 LayerImpl::Create(host_impl.active_tree(), 12345); 4311 LayerImpl::Create(host_impl.active_tree(), 12345);
4306 4312
4307 gfx::Transform identity_matrix; 4313 gfx::Transform identity_matrix;
4308 gfx::Transform rotation45_degrees_about_center; 4314 gfx::Transform rotation45_degrees_about_center;
4309 rotation45_degrees_about_center.Translate(50.0, 50.0); 4315 rotation45_degrees_about_center.Translate(50.0, 50.0);
4310 rotation45_degrees_about_center.RotateAboutZAxis(45.0); 4316 rotation45_degrees_about_center.RotateAboutZAxis(45.0);
4311 rotation45_degrees_about_center.Translate(-50.0, -50.0); 4317 rotation45_degrees_about_center.Translate(-50.0, -50.0);
4312 gfx::PointF anchor; 4318 gfx::PointF anchor;
4313 gfx::PointF position; 4319 gfx::PointF position;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
4359 ASSERT_FALSE(result_layer); 4365 ASSERT_FALSE(result_layer);
4360 4366
4361 test_point = gfx::Point(-1, 50); 4367 test_point = gfx::Point(-1, 50);
4362 result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint( 4368 result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
4363 test_point, render_surface_layer_list); 4369 test_point, render_surface_layer_list);
4364 ASSERT_FALSE(result_layer); 4370 ASSERT_FALSE(result_layer);
4365 } 4371 }
4366 4372
4367 TEST_F(LayerTreeHostCommonTest, HitTestingForSinglePerspectiveLayer) { 4373 TEST_F(LayerTreeHostCommonTest, HitTestingForSinglePerspectiveLayer) {
4368 FakeImplProxy proxy; 4374 FakeImplProxy proxy;
4369 FakeLayerTreeHostImpl host_impl(&proxy); 4375 TestSharedBitmapManager shared_bitmap_manager;
4376 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
4370 scoped_ptr<LayerImpl> root = 4377 scoped_ptr<LayerImpl> root =
4371 LayerImpl::Create(host_impl.active_tree(), 12345); 4378 LayerImpl::Create(host_impl.active_tree(), 12345);
4372 4379
4373 gfx::Transform identity_matrix; 4380 gfx::Transform identity_matrix;
4374 4381
4375 // perspective_projection_about_center * translation_by_z is designed so that 4382 // perspective_projection_about_center * translation_by_z is designed so that
4376 // the 100 x 100 layer becomes 50 x 50, and remains centered at (50, 50). 4383 // the 100 x 100 layer becomes 50 x 50, and remains centered at (50, 50).
4377 gfx::Transform perspective_projection_about_center; 4384 gfx::Transform perspective_projection_about_center;
4378 perspective_projection_about_center.Translate(50.0, 50.0); 4385 perspective_projection_about_center.Translate(50.0, 50.0);
4379 perspective_projection_about_center.ApplyPerspectiveDepth(1.0); 4386 perspective_projection_about_center.ApplyPerspectiveDepth(1.0);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
4437 // space. This test makes sure that hit testing works correctly accounts for 4444 // space. This test makes sure that hit testing works correctly accounts for
4438 // the contents scale. A contents scale that is not 1 effectively forces a 4445 // the contents scale. A contents scale that is not 1 effectively forces a
4439 // non-identity transform between layer's content space and layer's origin 4446 // non-identity transform between layer's content space and layer's origin
4440 // space. The hit testing code must take this into account. 4447 // space. The hit testing code must take this into account.
4441 // 4448 //
4442 // To test this, the layer is positioned at (25, 25), and is size (50, 50). If 4449 // To test this, the layer is positioned at (25, 25), and is size (50, 50). If
4443 // contents scale is ignored, then hit testing will mis-interpret the visible 4450 // contents scale is ignored, then hit testing will mis-interpret the visible
4444 // content rect as being larger than the actual bounds of the layer. 4451 // content rect as being larger than the actual bounds of the layer.
4445 // 4452 //
4446 FakeImplProxy proxy; 4453 FakeImplProxy proxy;
4447 FakeLayerTreeHostImpl host_impl(&proxy); 4454 TestSharedBitmapManager shared_bitmap_manager;
4455 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
4448 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); 4456 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
4449 4457
4450 gfx::Transform identity_matrix; 4458 gfx::Transform identity_matrix;
4451 gfx::PointF anchor; 4459 gfx::PointF anchor;
4452 4460
4453 SetLayerPropertiesForTesting(root.get(), 4461 SetLayerPropertiesForTesting(root.get(),
4454 identity_matrix, 4462 identity_matrix,
4455 anchor, 4463 anchor,
4456 gfx::PointF(), 4464 gfx::PointF(),
4457 gfx::Size(100, 100), 4465 gfx::Size(100, 100),
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
4525 } 4533 }
4526 4534
4527 TEST_F(LayerTreeHostCommonTest, HitTestingForSimpleClippedLayer) { 4535 TEST_F(LayerTreeHostCommonTest, HitTestingForSimpleClippedLayer) {
4528 // Test that hit-testing will only work for the visible portion of a layer, 4536 // Test that hit-testing will only work for the visible portion of a layer,
4529 // and not the entire layer bounds. Here we just test the simple axis-aligned 4537 // and not the entire layer bounds. Here we just test the simple axis-aligned
4530 // case. 4538 // case.
4531 gfx::Transform identity_matrix; 4539 gfx::Transform identity_matrix;
4532 gfx::PointF anchor; 4540 gfx::PointF anchor;
4533 4541
4534 FakeImplProxy proxy; 4542 FakeImplProxy proxy;
4535 FakeLayerTreeHostImpl host_impl(&proxy); 4543 TestSharedBitmapManager shared_bitmap_manager;
4544 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
4536 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); 4545 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
4537 SetLayerPropertiesForTesting(root.get(), 4546 SetLayerPropertiesForTesting(root.get(),
4538 identity_matrix, 4547 identity_matrix,
4539 anchor, 4548 anchor,
4540 gfx::PointF(), 4549 gfx::PointF(),
4541 gfx::Size(100, 100), 4550 gfx::Size(100, 100),
4542 true, 4551 true,
4543 false); 4552 false);
4544 { 4553 {
4545 scoped_ptr<LayerImpl> clipping_layer = 4554 scoped_ptr<LayerImpl> clipping_layer =
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
4618 // multiple ancestors that clip in non axis-aligned ways. To pass this test, 4627 // multiple ancestors that clip in non axis-aligned ways. To pass this test,
4619 // the hit testing algorithm needs to recognize that multiple parent layers 4628 // the hit testing algorithm needs to recognize that multiple parent layers
4620 // may clip the layer, and should not actually hit those clipped areas. 4629 // may clip the layer, and should not actually hit those clipped areas.
4621 // 4630 //
4622 // The child and grand_child layers are both initialized to clip the 4631 // The child and grand_child layers are both initialized to clip the
4623 // rotated_leaf. The child layer is rotated about the top-left corner, so that 4632 // rotated_leaf. The child layer is rotated about the top-left corner, so that
4624 // the root + child clips combined create a triangle. The rotated_leaf will 4633 // the root + child clips combined create a triangle. The rotated_leaf will
4625 // only be visible where it overlaps this triangle. 4634 // only be visible where it overlaps this triangle.
4626 // 4635 //
4627 FakeImplProxy proxy; 4636 FakeImplProxy proxy;
4628 FakeLayerTreeHostImpl host_impl(&proxy); 4637 TestSharedBitmapManager shared_bitmap_manager;
4638 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
4629 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 123); 4639 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 123);
4630 4640
4631 gfx::Transform identity_matrix; 4641 gfx::Transform identity_matrix;
4632 gfx::PointF anchor; 4642 gfx::PointF anchor;
4633 gfx::PointF position; 4643 gfx::PointF position;
4634 gfx::Size bounds(100, 100); 4644 gfx::Size bounds(100, 100);
4635 SetLayerPropertiesForTesting(root.get(), 4645 SetLayerPropertiesForTesting(root.get(),
4636 identity_matrix, 4646 identity_matrix,
4637 anchor, 4647 anchor,
4638 position, 4648 position,
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
4771 EXPECT_EQ(2468, result_layer->id()); 4781 EXPECT_EQ(2468, result_layer->id());
4772 } 4782 }
4773 4783
4774 TEST_F(LayerTreeHostCommonTest, HitTestingForNonClippingIntermediateLayer) { 4784 TEST_F(LayerTreeHostCommonTest, HitTestingForNonClippingIntermediateLayer) {
4775 // This test checks that hit testing code does not accidentally clip to layer 4785 // This test checks that hit testing code does not accidentally clip to layer
4776 // bounds for a layer that actually does not clip. 4786 // bounds for a layer that actually does not clip.
4777 gfx::Transform identity_matrix; 4787 gfx::Transform identity_matrix;
4778 gfx::PointF anchor; 4788 gfx::PointF anchor;
4779 4789
4780 FakeImplProxy proxy; 4790 FakeImplProxy proxy;
4781 FakeLayerTreeHostImpl host_impl(&proxy); 4791 TestSharedBitmapManager shared_bitmap_manager;
4792 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
4782 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); 4793 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
4783 SetLayerPropertiesForTesting(root.get(), 4794 SetLayerPropertiesForTesting(root.get(),
4784 identity_matrix, 4795 identity_matrix,
4785 anchor, 4796 anchor,
4786 gfx::PointF(), 4797 gfx::PointF(),
4787 gfx::Size(100, 100), 4798 gfx::Size(100, 100),
4788 true, 4799 true,
4789 false); 4800 false);
4790 { 4801 {
4791 scoped_ptr<LayerImpl> intermediate_layer = 4802 scoped_ptr<LayerImpl> intermediate_layer =
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
4855 4866
4856 test_point = gfx::Point(89, 89); 4867 test_point = gfx::Point(89, 89);
4857 result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint( 4868 result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
4858 test_point, render_surface_layer_list); 4869 test_point, render_surface_layer_list);
4859 ASSERT_TRUE(result_layer); 4870 ASSERT_TRUE(result_layer);
4860 EXPECT_EQ(456, result_layer->id()); 4871 EXPECT_EQ(456, result_layer->id());
4861 } 4872 }
4862 4873
4863 TEST_F(LayerTreeHostCommonTest, HitTestingForMultipleLayers) { 4874 TEST_F(LayerTreeHostCommonTest, HitTestingForMultipleLayers) {
4864 FakeImplProxy proxy; 4875 FakeImplProxy proxy;
4865 FakeLayerTreeHostImpl host_impl(&proxy); 4876 TestSharedBitmapManager shared_bitmap_manager;
4877 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
4866 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); 4878 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
4867 4879
4868 gfx::Transform identity_matrix; 4880 gfx::Transform identity_matrix;
4869 gfx::PointF anchor; 4881 gfx::PointF anchor;
4870 gfx::PointF position; 4882 gfx::PointF position;
4871 gfx::Size bounds(100, 100); 4883 gfx::Size bounds(100, 100);
4872 SetLayerPropertiesForTesting(root.get(), 4884 SetLayerPropertiesForTesting(root.get(),
4873 identity_matrix, 4885 identity_matrix,
4874 anchor, 4886 anchor,
4875 position, 4887 position,
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
5002 ASSERT_TRUE(result_layer); 5014 ASSERT_TRUE(result_layer);
5003 EXPECT_EQ(4, result_layer->id()); 5015 EXPECT_EQ(4, result_layer->id());
5004 } 5016 }
5005 5017
5006 TEST_F(LayerTreeHostCommonTest, HitTestingForMultipleLayerLists) { 5018 TEST_F(LayerTreeHostCommonTest, HitTestingForMultipleLayerLists) {
5007 // 5019 //
5008 // The geometry is set up similarly to the previous case, but 5020 // The geometry is set up similarly to the previous case, but
5009 // all layers are forced to be render surfaces now. 5021 // all layers are forced to be render surfaces now.
5010 // 5022 //
5011 FakeImplProxy proxy; 5023 FakeImplProxy proxy;
5012 FakeLayerTreeHostImpl host_impl(&proxy); 5024 TestSharedBitmapManager shared_bitmap_manager;
5025 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
5013 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); 5026 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
5014 5027
5015 gfx::Transform identity_matrix; 5028 gfx::Transform identity_matrix;
5016 gfx::PointF anchor; 5029 gfx::PointF anchor;
5017 gfx::PointF position; 5030 gfx::PointF position;
5018 gfx::Size bounds(100, 100); 5031 gfx::Size bounds(100, 100);
5019 SetLayerPropertiesForTesting(root.get(), 5032 SetLayerPropertiesForTesting(root.get(),
5020 identity_matrix, 5033 identity_matrix,
5021 anchor, 5034 anchor,
5022 position, 5035 position,
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
5155 // be on top. 5168 // be on top.
5156 test_point = gfx::Point(20, 51); 5169 test_point = gfx::Point(20, 51);
5157 result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint( 5170 result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
5158 test_point, render_surface_layer_list); 5171 test_point, render_surface_layer_list);
5159 ASSERT_TRUE(result_layer); 5172 ASSERT_TRUE(result_layer);
5160 EXPECT_EQ(4, result_layer->id()); 5173 EXPECT_EQ(4, result_layer->id());
5161 } 5174 }
5162 5175
5163 TEST_F(LayerTreeHostCommonTest, HitTestingForEmptyLayers) { 5176 TEST_F(LayerTreeHostCommonTest, HitTestingForEmptyLayers) {
5164 FakeImplProxy proxy; 5177 FakeImplProxy proxy;
5165 FakeLayerTreeHostImpl host_impl(&proxy); 5178 TestSharedBitmapManager shared_bitmap_manager;
5179 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
5166 5180
5167 // Layer 1 - root 5181 // Layer 1 - root
5168 scoped_ptr<LayerImpl> root = 5182 scoped_ptr<LayerImpl> root =
5169 LayerImpl::Create(host_impl.active_tree(), 1); 5183 LayerImpl::Create(host_impl.active_tree(), 1);
5170 gfx::Transform identity_matrix; 5184 gfx::Transform identity_matrix;
5171 gfx::PointF anchor; 5185 gfx::PointF anchor;
5172 gfx::PointF position; 5186 gfx::PointF position;
5173 gfx::Size bounds(100, 100); 5187 gfx::Size bounds(100, 100);
5174 SetLayerPropertiesForTesting(root.get(), 5188 SetLayerPropertiesForTesting(root.get(),
5175 identity_matrix, 5189 identity_matrix,
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
5289 5303
5290 test_point = gfx::Point(10, 20); 5304 test_point = gfx::Point(10, 20);
5291 result_layer = 5305 result_layer =
5292 LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion( 5306 LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
5293 test_point, render_surface_layer_list); 5307 test_point, render_surface_layer_list);
5294 EXPECT_FALSE(result_layer); 5308 EXPECT_FALSE(result_layer);
5295 } 5309 }
5296 5310
5297 TEST_F(LayerTreeHostCommonTest, HitCheckingTouchHandlerRegionsForSingleLayer) { 5311 TEST_F(LayerTreeHostCommonTest, HitCheckingTouchHandlerRegionsForSingleLayer) {
5298 FakeImplProxy proxy; 5312 FakeImplProxy proxy;
5299 FakeLayerTreeHostImpl host_impl(&proxy); 5313 TestSharedBitmapManager shared_bitmap_manager;
5314 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
5300 scoped_ptr<LayerImpl> root = 5315 scoped_ptr<LayerImpl> root =
5301 LayerImpl::Create(host_impl.active_tree(), 12345); 5316 LayerImpl::Create(host_impl.active_tree(), 12345);
5302 5317
5303 gfx::Transform identity_matrix; 5318 gfx::Transform identity_matrix;
5304 Region touch_handler_region(gfx::Rect(10, 10, 50, 50)); 5319 Region touch_handler_region(gfx::Rect(10, 10, 50, 50));
5305 gfx::PointF anchor; 5320 gfx::PointF anchor;
5306 gfx::PointF position; 5321 gfx::PointF position;
5307 gfx::Size bounds(100, 100); 5322 gfx::Size bounds(100, 100);
5308 SetLayerPropertiesForTesting(root.get(), 5323 SetLayerPropertiesForTesting(root.get(),
5309 identity_matrix, 5324 identity_matrix,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
5373 result_layer = 5388 result_layer =
5374 LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion( 5389 LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
5375 test_point, render_surface_layer_list); 5390 test_point, render_surface_layer_list);
5376 ASSERT_TRUE(result_layer); 5391 ASSERT_TRUE(result_layer);
5377 EXPECT_EQ(12345, result_layer->id()); 5392 EXPECT_EQ(12345, result_layer->id());
5378 } 5393 }
5379 5394
5380 TEST_F(LayerTreeHostCommonTest, 5395 TEST_F(LayerTreeHostCommonTest,
5381 HitCheckingTouchHandlerRegionsForUninvertibleTransform) { 5396 HitCheckingTouchHandlerRegionsForUninvertibleTransform) {
5382 FakeImplProxy proxy; 5397 FakeImplProxy proxy;
5383 FakeLayerTreeHostImpl host_impl(&proxy); 5398 TestSharedBitmapManager shared_bitmap_manager;
5399 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
5384 scoped_ptr<LayerImpl> root = 5400 scoped_ptr<LayerImpl> root =
5385 LayerImpl::Create(host_impl.active_tree(), 12345); 5401 LayerImpl::Create(host_impl.active_tree(), 12345);
5386 5402
5387 gfx::Transform uninvertible_transform; 5403 gfx::Transform uninvertible_transform;
5388 uninvertible_transform.matrix().set(0, 0, 0.0); 5404 uninvertible_transform.matrix().set(0, 0, 0.0);
5389 uninvertible_transform.matrix().set(1, 1, 0.0); 5405 uninvertible_transform.matrix().set(1, 1, 0.0);
5390 uninvertible_transform.matrix().set(2, 2, 0.0); 5406 uninvertible_transform.matrix().set(2, 2, 0.0);
5391 uninvertible_transform.matrix().set(3, 3, 0.0); 5407 uninvertible_transform.matrix().set(3, 3, 0.0);
5392 ASSERT_FALSE(uninvertible_transform.IsInvertible()); 5408 ASSERT_FALSE(uninvertible_transform.IsInvertible());
5393 5409
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
5460 test_point = gfx::Point(-1, -1); 5476 test_point = gfx::Point(-1, -1);
5461 result_layer = 5477 result_layer =
5462 LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion( 5478 LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
5463 test_point, render_surface_layer_list); 5479 test_point, render_surface_layer_list);
5464 EXPECT_FALSE(result_layer); 5480 EXPECT_FALSE(result_layer);
5465 } 5481 }
5466 5482
5467 TEST_F(LayerTreeHostCommonTest, 5483 TEST_F(LayerTreeHostCommonTest,
5468 HitCheckingTouchHandlerRegionsForSinglePositionedLayer) { 5484 HitCheckingTouchHandlerRegionsForSinglePositionedLayer) {
5469 FakeImplProxy proxy; 5485 FakeImplProxy proxy;
5470 FakeLayerTreeHostImpl host_impl(&proxy); 5486 TestSharedBitmapManager shared_bitmap_manager;
5487 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
5471 scoped_ptr<LayerImpl> root = 5488 scoped_ptr<LayerImpl> root =
5472 LayerImpl::Create(host_impl.active_tree(), 12345); 5489 LayerImpl::Create(host_impl.active_tree(), 12345);
5473 5490
5474 gfx::Transform identity_matrix; 5491 gfx::Transform identity_matrix;
5475 Region touch_handler_region(gfx::Rect(10, 10, 50, 50)); 5492 Region touch_handler_region(gfx::Rect(10, 10, 50, 50));
5476 gfx::PointF anchor; 5493 gfx::PointF anchor;
5477 // this layer is positioned, and hit testing should correctly know where the 5494 // this layer is positioned, and hit testing should correctly know where the
5478 // layer is located. 5495 // layer is located.
5479 gfx::PointF position(50.f, 50.f); 5496 gfx::PointF position(50.f, 50.f);
5480 gfx::Size bounds(100, 100); 5497 gfx::Size bounds(100, 100);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
5545 // space. This test makes sure that hit testing works correctly accounts for 5562 // space. This test makes sure that hit testing works correctly accounts for
5546 // the contents scale. A contents scale that is not 1 effectively forces a 5563 // the contents scale. A contents scale that is not 1 effectively forces a
5547 // non-identity transform between layer's content space and layer's origin 5564 // non-identity transform between layer's content space and layer's origin
5548 // space. The hit testing code must take this into account. 5565 // space. The hit testing code must take this into account.
5549 // 5566 //
5550 // To test this, the layer is positioned at (25, 25), and is size (50, 50). If 5567 // To test this, the layer is positioned at (25, 25), and is size (50, 50). If
5551 // contents scale is ignored, then hit checking will mis-interpret the visible 5568 // contents scale is ignored, then hit checking will mis-interpret the visible
5552 // content rect as being larger than the actual bounds of the layer. 5569 // content rect as being larger than the actual bounds of the layer.
5553 // 5570 //
5554 FakeImplProxy proxy; 5571 FakeImplProxy proxy;
5555 FakeLayerTreeHostImpl host_impl(&proxy); 5572 TestSharedBitmapManager shared_bitmap_manager;
5573 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
5556 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); 5574 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
5557 5575
5558 gfx::Transform identity_matrix; 5576 gfx::Transform identity_matrix;
5559 gfx::PointF anchor; 5577 gfx::PointF anchor;
5560 5578
5561 SetLayerPropertiesForTesting(root.get(), 5579 SetLayerPropertiesForTesting(root.get(),
5562 identity_matrix, 5580 identity_matrix,
5563 anchor, 5581 anchor,
5564 gfx::PointF(), 5582 gfx::PointF(),
5565 gfx::Size(100, 100), 5583 gfx::Size(100, 100),
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
5652 ASSERT_TRUE(result_layer); 5670 ASSERT_TRUE(result_layer);
5653 EXPECT_EQ(12345, result_layer->id()); 5671 EXPECT_EQ(12345, result_layer->id());
5654 } 5672 }
5655 5673
5656 TEST_F(LayerTreeHostCommonTest, 5674 TEST_F(LayerTreeHostCommonTest,
5657 HitCheckingTouchHandlerRegionsForSingleLayerWithDeviceScale) { 5675 HitCheckingTouchHandlerRegionsForSingleLayerWithDeviceScale) {
5658 // The layer's device_scale_factor and page_scale_factor should scale the 5676 // The layer's device_scale_factor and page_scale_factor should scale the
5659 // content rect and we should be able to hit the touch handler region by 5677 // content rect and we should be able to hit the touch handler region by
5660 // scaling the points accordingly. 5678 // scaling the points accordingly.
5661 FakeImplProxy proxy; 5679 FakeImplProxy proxy;
5662 FakeLayerTreeHostImpl host_impl(&proxy); 5680 TestSharedBitmapManager shared_bitmap_manager;
5681 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
5663 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); 5682 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
5664 5683
5665 gfx::Transform identity_matrix; 5684 gfx::Transform identity_matrix;
5666 gfx::PointF anchor; 5685 gfx::PointF anchor;
5667 // Set the bounds of the root layer big enough to fit the child when scaled. 5686 // Set the bounds of the root layer big enough to fit the child when scaled.
5668 SetLayerPropertiesForTesting(root.get(), 5687 SetLayerPropertiesForTesting(root.get(),
5669 identity_matrix, 5688 identity_matrix,
5670 anchor, 5689 anchor,
5671 gfx::PointF(), 5690 gfx::PointF(),
5672 gfx::Size(100, 100), 5691 gfx::Size(100, 100),
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
5783 5802
5784 TEST_F(LayerTreeHostCommonTest, 5803 TEST_F(LayerTreeHostCommonTest,
5785 HitCheckingTouchHandlerRegionsForSimpleClippedLayer) { 5804 HitCheckingTouchHandlerRegionsForSimpleClippedLayer) {
5786 // Test that hit-checking will only work for the visible portion of a layer, 5805 // Test that hit-checking will only work for the visible portion of a layer,
5787 // and not the entire layer bounds. Here we just test the simple axis-aligned 5806 // and not the entire layer bounds. Here we just test the simple axis-aligned
5788 // case. 5807 // case.
5789 gfx::Transform identity_matrix; 5808 gfx::Transform identity_matrix;
5790 gfx::PointF anchor; 5809 gfx::PointF anchor;
5791 5810
5792 FakeImplProxy proxy; 5811 FakeImplProxy proxy;
5793 FakeLayerTreeHostImpl host_impl(&proxy); 5812 TestSharedBitmapManager shared_bitmap_manager;
5813 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
5794 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); 5814 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
5795 SetLayerPropertiesForTesting(root.get(), 5815 SetLayerPropertiesForTesting(root.get(),
5796 identity_matrix, 5816 identity_matrix,
5797 anchor, 5817 anchor,
5798 gfx::PointF(), 5818 gfx::PointF(),
5799 gfx::Size(100, 100), 5819 gfx::Size(100, 100),
5800 true, 5820 true,
5801 false); 5821 false);
5802 { 5822 {
5803 scoped_ptr<LayerImpl> clipping_layer = 5823 scoped_ptr<LayerImpl> clipping_layer =
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
5883 ASSERT_TRUE(result_layer); 5903 ASSERT_TRUE(result_layer);
5884 EXPECT_EQ(456, result_layer->id()); 5904 EXPECT_EQ(456, result_layer->id());
5885 } 5905 }
5886 5906
5887 TEST_F(LayerTreeHostCommonTest, 5907 TEST_F(LayerTreeHostCommonTest,
5888 HitCheckingTouchHandlerOverlappingRegions) { 5908 HitCheckingTouchHandlerOverlappingRegions) {
5889 gfx::Transform identity_matrix; 5909 gfx::Transform identity_matrix;
5890 gfx::PointF anchor; 5910 gfx::PointF anchor;
5891 5911
5892 FakeImplProxy proxy; 5912 FakeImplProxy proxy;
5893 FakeLayerTreeHostImpl host_impl(&proxy); 5913 TestSharedBitmapManager shared_bitmap_manager;
5914 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
5894 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); 5915 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
5895 SetLayerPropertiesForTesting(root.get(), 5916 SetLayerPropertiesForTesting(root.get(),
5896 identity_matrix, 5917 identity_matrix,
5897 anchor, 5918 anchor,
5898 gfx::PointF(), 5919 gfx::PointF(),
5899 gfx::Size(100, 100), 5920 gfx::Size(100, 100),
5900 true, 5921 true,
5901 false); 5922 false);
5902 { 5923 {
5903 scoped_ptr<LayerImpl> touch_layer = 5924 scoped_ptr<LayerImpl> touch_layer =
(...skipping 1677 matching lines...) Expand 10 before | Expand all | Expand 10 after
7581 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 7602 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
7582 host->SetRootLayer(root); 7603 host->SetRootLayer(root);
7583 7604
7584 ExecuteCalculateDrawProperties(root.get()); 7605 ExecuteCalculateDrawProperties(root.get());
7585 7606
7586 EXPECT_FALSE(child->render_surface()); 7607 EXPECT_FALSE(child->render_surface());
7587 } 7608 }
7588 7609
7589 TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) { 7610 TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) {
7590 FakeImplProxy proxy; 7611 FakeImplProxy proxy;
7591 FakeLayerTreeHostImpl host_impl(&proxy); 7612 TestSharedBitmapManager shared_bitmap_manager;
7613 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
7592 host_impl.CreatePendingTree(); 7614 host_impl.CreatePendingTree();
7593 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); 7615 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1);
7594 7616
7595 const gfx::Transform identity_matrix; 7617 const gfx::Transform identity_matrix;
7596 SetLayerPropertiesForTesting(root.get(), 7618 SetLayerPropertiesForTesting(root.get(),
7597 identity_matrix, 7619 identity_matrix,
7598 gfx::PointF(), 7620 gfx::PointF(),
7599 gfx::PointF(), 7621 gfx::PointF(),
7600 gfx::Size(100, 100), 7622 gfx::Size(100, 100),
7601 true, 7623 true,
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
7780 EXPECT_EQ(can_use_lcd_text_, child_->can_use_lcd_text()); 7802 EXPECT_EQ(can_use_lcd_text_, child_->can_use_lcd_text());
7781 EXPECT_EQ(can_use_lcd_text_, grand_child_->can_use_lcd_text()); 7803 EXPECT_EQ(can_use_lcd_text_, grand_child_->can_use_lcd_text());
7782 } 7804 }
7783 7805
7784 INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest, 7806 INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest,
7785 LCDTextTest, 7807 LCDTextTest,
7786 testing::Combine(testing::Bool(), testing::Bool())); 7808 testing::Combine(testing::Bool(), testing::Bool()));
7787 7809
7788 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayer) { 7810 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayer) {
7789 FakeImplProxy proxy; 7811 FakeImplProxy proxy;
7790 FakeLayerTreeHostImpl host_impl(&proxy); 7812 TestSharedBitmapManager shared_bitmap_manager;
7813 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
7791 host_impl.CreatePendingTree(); 7814 host_impl.CreatePendingTree();
7792 const gfx::Transform identity_matrix; 7815 const gfx::Transform identity_matrix;
7793 7816
7794 scoped_refptr<Layer> root = Layer::Create(); 7817 scoped_refptr<Layer> root = Layer::Create();
7795 SetLayerPropertiesForTesting(root.get(), 7818 SetLayerPropertiesForTesting(root.get(),
7796 identity_matrix, 7819 identity_matrix,
7797 gfx::PointF(), 7820 gfx::PointF(),
7798 gfx::PointF(), 7821 gfx::PointF(),
7799 gfx::Size(50, 50), 7822 gfx::Size(50, 50),
7800 true, 7823 true,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
7837 // We should have one render surface and two layers. The grand child has 7860 // We should have one render surface and two layers. The grand child has
7838 // hidden itself. 7861 // hidden itself.
7839 ASSERT_EQ(1u, render_surface_layer_list.size()); 7862 ASSERT_EQ(1u, render_surface_layer_list.size());
7840 ASSERT_EQ(2u, root->render_surface()->layer_list().size()); 7863 ASSERT_EQ(2u, root->render_surface()->layer_list().size());
7841 EXPECT_EQ(root->id(), root->render_surface()->layer_list().at(0)->id()); 7864 EXPECT_EQ(root->id(), root->render_surface()->layer_list().at(0)->id());
7842 EXPECT_EQ(child->id(), root->render_surface()->layer_list().at(1)->id()); 7865 EXPECT_EQ(child->id(), root->render_surface()->layer_list().at(1)->id());
7843 } 7866 }
7844 7867
7845 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) { 7868 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) {
7846 FakeImplProxy proxy; 7869 FakeImplProxy proxy;
7847 FakeLayerTreeHostImpl host_impl(&proxy); 7870 TestSharedBitmapManager shared_bitmap_manager;
7871 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
7848 host_impl.CreatePendingTree(); 7872 host_impl.CreatePendingTree();
7849 const gfx::Transform identity_matrix; 7873 const gfx::Transform identity_matrix;
7850 7874
7851 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); 7875 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1);
7852 SetLayerPropertiesForTesting(root.get(), 7876 SetLayerPropertiesForTesting(root.get(),
7853 identity_matrix, 7877 identity_matrix,
7854 gfx::PointF(), 7878 gfx::PointF(),
7855 gfx::PointF(), 7879 gfx::PointF(),
7856 gfx::Size(50, 50), 7880 gfx::Size(50, 50),
7857 true, 7881 true,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
7892 // We should have one render surface and two layers. The grand child has 7916 // We should have one render surface and two layers. The grand child has
7893 // hidden itself. 7917 // hidden itself.
7894 ASSERT_EQ(1u, render_surface_layer_list.size()); 7918 ASSERT_EQ(1u, render_surface_layer_list.size());
7895 ASSERT_EQ(2u, root->render_surface()->layer_list().size()); 7919 ASSERT_EQ(2u, root->render_surface()->layer_list().size());
7896 EXPECT_EQ(1, root->render_surface()->layer_list().at(0)->id()); 7920 EXPECT_EQ(1, root->render_surface()->layer_list().at(0)->id());
7897 EXPECT_EQ(2, root->render_surface()->layer_list().at(1)->id()); 7921 EXPECT_EQ(2, root->render_surface()->layer_list().at(1)->id());
7898 } 7922 }
7899 7923
7900 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayers) { 7924 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayers) {
7901 FakeImplProxy proxy; 7925 FakeImplProxy proxy;
7902 FakeLayerTreeHostImpl host_impl(&proxy); 7926 TestSharedBitmapManager shared_bitmap_manager;
7927 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
7903 host_impl.CreatePendingTree(); 7928 host_impl.CreatePendingTree();
7904 const gfx::Transform identity_matrix; 7929 const gfx::Transform identity_matrix;
7905 7930
7906 scoped_refptr<Layer> root = Layer::Create(); 7931 scoped_refptr<Layer> root = Layer::Create();
7907 SetLayerPropertiesForTesting(root.get(), 7932 SetLayerPropertiesForTesting(root.get(),
7908 identity_matrix, 7933 identity_matrix,
7909 gfx::PointF(), 7934 gfx::PointF(),
7910 gfx::PointF(), 7935 gfx::PointF(),
7911 gfx::Size(50, 50), 7936 gfx::Size(50, 50),
7912 true, 7937 true,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
7948 7973
7949 // We should have one render surface and one layers. The child has 7974 // We should have one render surface and one layers. The child has
7950 // hidden itself and the grand child. 7975 // hidden itself and the grand child.
7951 ASSERT_EQ(1u, render_surface_layer_list.size()); 7976 ASSERT_EQ(1u, render_surface_layer_list.size());
7952 ASSERT_EQ(1u, root->render_surface()->layer_list().size()); 7977 ASSERT_EQ(1u, root->render_surface()->layer_list().size());
7953 EXPECT_EQ(root->id(), root->render_surface()->layer_list().at(0)->id()); 7978 EXPECT_EQ(root->id(), root->render_surface()->layer_list().at(0)->id());
7954 } 7979 }
7955 7980
7956 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) { 7981 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) {
7957 FakeImplProxy proxy; 7982 FakeImplProxy proxy;
7958 FakeLayerTreeHostImpl host_impl(&proxy); 7983 TestSharedBitmapManager shared_bitmap_manager;
7984 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
7959 host_impl.CreatePendingTree(); 7985 host_impl.CreatePendingTree();
7960 const gfx::Transform identity_matrix; 7986 const gfx::Transform identity_matrix;
7961 7987
7962 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); 7988 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1);
7963 SetLayerPropertiesForTesting(root.get(), 7989 SetLayerPropertiesForTesting(root.get(),
7964 identity_matrix, 7990 identity_matrix,
7965 gfx::PointF(), 7991 gfx::PointF(),
7966 gfx::PointF(), 7992 gfx::PointF(),
7967 gfx::Size(50, 50), 7993 gfx::Size(50, 50),
7968 true, 7994 true,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
8004 // hidden itself and the grand child. 8030 // hidden itself and the grand child.
8005 ASSERT_EQ(1u, render_surface_layer_list.size()); 8031 ASSERT_EQ(1u, render_surface_layer_list.size());
8006 ASSERT_EQ(1u, root->render_surface()->layer_list().size()); 8032 ASSERT_EQ(1u, root->render_surface()->layer_list().size());
8007 EXPECT_EQ(1, root->render_surface()->layer_list().at(0)->id()); 8033 EXPECT_EQ(1, root->render_surface()->layer_list().at(0)->id());
8008 } 8034 }
8009 8035
8010 void EmptyCopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} 8036 void EmptyCopyOutputCallback(scoped_ptr<CopyOutputResult> result) {}
8011 8037
8012 TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) { 8038 TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) {
8013 FakeImplProxy proxy; 8039 FakeImplProxy proxy;
8014 FakeLayerTreeHostImpl host_impl(&proxy); 8040 TestSharedBitmapManager shared_bitmap_manager;
8041 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
8015 host_impl.CreatePendingTree(); 8042 host_impl.CreatePendingTree();
8016 const gfx::Transform identity_matrix; 8043 const gfx::Transform identity_matrix;
8017 8044
8018 scoped_refptr<Layer> root = Layer::Create(); 8045 scoped_refptr<Layer> root = Layer::Create();
8019 SetLayerPropertiesForTesting(root.get(), 8046 SetLayerPropertiesForTesting(root.get(),
8020 identity_matrix, 8047 identity_matrix,
8021 gfx::PointF(), 8048 gfx::PointF(),
8022 gfx::PointF(), 8049 gfx::PointF(),
8023 gfx::Size(50, 50), 8050 gfx::Size(50, 50),
8024 true, 8051 true,
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
8150 // The copy_layer's render surface should have two contributing layers. 8177 // The copy_layer's render surface should have two contributing layers.
8151 ASSERT_EQ(2u, copy_layer->render_surface()->layer_list().size()); 8178 ASSERT_EQ(2u, copy_layer->render_surface()->layer_list().size());
8152 EXPECT_EQ(copy_layer->id(), 8179 EXPECT_EQ(copy_layer->id(),
8153 copy_layer->render_surface()->layer_list().at(0)->id()); 8180 copy_layer->render_surface()->layer_list().at(0)->id());
8154 EXPECT_EQ(copy_child->id(), 8181 EXPECT_EQ(copy_child->id(),
8155 copy_layer->render_surface()->layer_list().at(1)->id()); 8182 copy_layer->render_surface()->layer_list().at(1)->id());
8156 } 8183 }
8157 8184
8158 TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) { 8185 TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) {
8159 FakeImplProxy proxy; 8186 FakeImplProxy proxy;
8160 FakeLayerTreeHostImpl host_impl(&proxy); 8187 TestSharedBitmapManager shared_bitmap_manager;
8188 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
8161 host_impl.CreatePendingTree(); 8189 host_impl.CreatePendingTree();
8162 const gfx::Transform identity_matrix; 8190 const gfx::Transform identity_matrix;
8163 8191
8164 scoped_refptr<Layer> root = Layer::Create(); 8192 scoped_refptr<Layer> root = Layer::Create();
8165 SetLayerPropertiesForTesting(root.get(), 8193 SetLayerPropertiesForTesting(root.get(),
8166 identity_matrix, 8194 identity_matrix,
8167 gfx::PointF(), 8195 gfx::PointF(),
8168 gfx::PointF(), 8196 gfx::PointF(),
8169 gfx::Size(50, 50), 8197 gfx::Size(50, 50),
8170 true, 8198 true,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
8224 EXPECT_EQ(root->id(), render_surface_layer_list.at(0)->id()); 8252 EXPECT_EQ(root->id(), render_surface_layer_list.at(0)->id());
8225 8253
8226 // The root render surface should only have 1 contributing layer, since the 8254 // The root render surface should only have 1 contributing layer, since the
8227 // other layers are empty/clipped away. 8255 // other layers are empty/clipped away.
8228 ASSERT_EQ(1u, root->render_surface()->layer_list().size()); 8256 ASSERT_EQ(1u, root->render_surface()->layer_list().size());
8229 EXPECT_EQ(root->id(), root->render_surface()->layer_list().at(0)->id()); 8257 EXPECT_EQ(root->id(), root->render_surface()->layer_list().at(0)->id());
8230 } 8258 }
8231 8259
8232 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInsideSurface) { 8260 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInsideSurface) {
8233 FakeImplProxy proxy; 8261 FakeImplProxy proxy;
8234 FakeLayerTreeHostImpl host_impl(&proxy); 8262 TestSharedBitmapManager shared_bitmap_manager;
8263 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
8235 host_impl.CreatePendingTree(); 8264 host_impl.CreatePendingTree();
8236 const gfx::Transform identity_matrix; 8265 const gfx::Transform identity_matrix;
8237 8266
8238 scoped_refptr<Layer> root = Layer::Create(); 8267 scoped_refptr<Layer> root = Layer::Create();
8239 SetLayerPropertiesForTesting(root.get(), 8268 SetLayerPropertiesForTesting(root.get(),
8240 identity_matrix, 8269 identity_matrix,
8241 gfx::PointF(), 8270 gfx::PointF(),
8242 gfx::PointF(), 8271 gfx::PointF(),
8243 gfx::Size(50, 50), 8272 gfx::Size(50, 50),
8244 true, 8273 true,
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
8834 EXPECT_EQ(gfx::Rect(0, 0, 5, 5).ToString(), 8863 EXPECT_EQ(gfx::Rect(0, 0, 5, 5).ToString(),
8835 render_surface2->render_surface()->content_rect().ToString()); 8864 render_surface2->render_surface()->content_rect().ToString());
8836 8865
8837 // Sanity check our num_unclipped_descendants values. 8866 // Sanity check our num_unclipped_descendants values.
8838 EXPECT_EQ(1, render_surface1->num_unclipped_descendants()); 8867 EXPECT_EQ(1, render_surface1->num_unclipped_descendants());
8839 EXPECT_EQ(0, render_surface2->num_unclipped_descendants()); 8868 EXPECT_EQ(0, render_surface2->num_unclipped_descendants());
8840 } 8869 }
8841 8870
8842 TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) { 8871 TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) {
8843 FakeImplProxy proxy; 8872 FakeImplProxy proxy;
8844 FakeLayerTreeHostImpl host_impl(&proxy); 8873 TestSharedBitmapManager shared_bitmap_manager;
8874 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
8845 scoped_ptr<LayerImpl> root = 8875 scoped_ptr<LayerImpl> root =
8846 LayerImpl::Create(host_impl.active_tree(), 12345); 8876 LayerImpl::Create(host_impl.active_tree(), 12345);
8847 scoped_ptr<LayerImpl> child1 = 8877 scoped_ptr<LayerImpl> child1 =
8848 LayerImpl::Create(host_impl.active_tree(), 123456); 8878 LayerImpl::Create(host_impl.active_tree(), 123456);
8849 scoped_ptr<LayerImpl> child2 = 8879 scoped_ptr<LayerImpl> child2 =
8850 LayerImpl::Create(host_impl.active_tree(), 1234567); 8880 LayerImpl::Create(host_impl.active_tree(), 1234567);
8851 scoped_ptr<LayerImpl> child3 = 8881 scoped_ptr<LayerImpl> child3 =
8852 LayerImpl::Create(host_impl.active_tree(), 12345678); 8882 LayerImpl::Create(host_impl.active_tree(), 12345678);
8853 8883
8854 gfx::Transform identity_matrix; 8884 gfx::Transform identity_matrix;
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
9423 // 9453 //
9424 // + root 9454 // + root
9425 // + scroll_child 9455 // + scroll_child
9426 // + top_content 9456 // + top_content
9427 // + bottom_content 9457 // + bottom_content
9428 // + scroll_parent_border 9458 // + scroll_parent_border
9429 // + scroll_parent_clip 9459 // + scroll_parent_clip
9430 // + scroll_parent 9460 // + scroll_parent
9431 // 9461 //
9432 FakeImplProxy proxy; 9462 FakeImplProxy proxy;
9433 FakeLayerTreeHostImpl host_impl(&proxy); 9463 TestSharedBitmapManager shared_bitmap_manager;
9464 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
9434 host_impl.CreatePendingTree(); 9465 host_impl.CreatePendingTree();
9435 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); 9466 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
9436 scoped_ptr<LayerImpl> scroll_parent_border = 9467 scoped_ptr<LayerImpl> scroll_parent_border =
9437 LayerImpl::Create(host_impl.active_tree(), 2); 9468 LayerImpl::Create(host_impl.active_tree(), 2);
9438 scoped_ptr<LayerImpl> scroll_parent_clip = 9469 scoped_ptr<LayerImpl> scroll_parent_clip =
9439 LayerImpl::Create(host_impl.active_tree(), 3); 9470 LayerImpl::Create(host_impl.active_tree(), 3);
9440 scoped_ptr<LayerImpl> scroll_parent = 9471 scoped_ptr<LayerImpl> scroll_parent =
9441 LayerImpl::Create(host_impl.active_tree(), 4); 9472 LayerImpl::Create(host_impl.active_tree(), 4);
9442 scoped_ptr<LayerImpl> scroll_child = 9473 scoped_ptr<LayerImpl> scroll_child =
9443 LayerImpl::Create(host_impl.active_tree(), 5); 9474 LayerImpl::Create(host_impl.active_tree(), 5);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
9549 TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) { 9580 TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) {
9550 // This test verifies that a scrolling layer that gets snapped to 9581 // This test verifies that a scrolling layer that gets snapped to
9551 // integer coordinates doesn't move a fixed position child. 9582 // integer coordinates doesn't move a fixed position child.
9552 // 9583 //
9553 // + root 9584 // + root
9554 // + container 9585 // + container
9555 // + scroller 9586 // + scroller
9556 // + fixed 9587 // + fixed
9557 // 9588 //
9558 FakeImplProxy proxy; 9589 FakeImplProxy proxy;
9559 FakeLayerTreeHostImpl host_impl(&proxy); 9590 TestSharedBitmapManager shared_bitmap_manager;
9591 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
9560 host_impl.CreatePendingTree(); 9592 host_impl.CreatePendingTree();
9561 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); 9593 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
9562 scoped_ptr<LayerImpl> container = 9594 scoped_ptr<LayerImpl> container =
9563 LayerImpl::Create(host_impl.active_tree(), 2); 9595 LayerImpl::Create(host_impl.active_tree(), 2);
9564 LayerImpl* container_layer = container.get(); 9596 LayerImpl* container_layer = container.get();
9565 scoped_ptr<LayerImpl> scroller = 9597 scoped_ptr<LayerImpl> scroller =
9566 LayerImpl::Create(host_impl.active_tree(), 3); 9598 LayerImpl::Create(host_impl.active_tree(), 3);
9567 LayerImpl* scroll_layer = scroller.get(); 9599 LayerImpl* scroll_layer = scroller.get();
9568 scoped_ptr<LayerImpl> fixed = LayerImpl::Create(host_impl.active_tree(), 4); 9600 scoped_ptr<LayerImpl> fixed = LayerImpl::Create(host_impl.active_tree(), 4);
9569 LayerImpl* fixed_layer = fixed.get(); 9601 LayerImpl* fixed_layer = fixed.get();
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
9654 fixed_layer->draw_properties().screen_space_transform.To2dTranslation(), 9686 fixed_layer->draw_properties().screen_space_transform.To2dTranslation(),
9655 container_offset); 9687 container_offset);
9656 EXPECT_VECTOR_EQ(scroll_layer->draw_properties() 9688 EXPECT_VECTOR_EQ(scroll_layer->draw_properties()
9657 .screen_space_transform.To2dTranslation(), 9689 .screen_space_transform.To2dTranslation(),
9658 container_offset - rounded_scroll_delta); 9690 container_offset - rounded_scroll_delta);
9659 } 9691 }
9660 } 9692 }
9661 9693
9662 } // namespace 9694 } // namespace
9663 } // namespace cc 9695 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_sorter_unittest.cc ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698