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

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

Issue 2452483002: Move GpuMemoryBufferManager and SharedBitmapManager to CompositorFrameSink (Closed)
Patch Set: rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/damage_tracker_unittest.cc ('k') | cc/trees/layer_tree_host_impl.h » ('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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) { 514 TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) {
515 const gfx::ScrollOffset kScrollOffset(50, 100); 515 const gfx::ScrollOffset kScrollOffset(50, 100);
516 const gfx::Vector2dF kScrollDelta(2.34f, 5.67f); 516 const gfx::Vector2dF kScrollDelta(2.34f, 5.67f);
517 const gfx::Vector2d kMaxScrollOffset(200, 200); 517 const gfx::Vector2d kMaxScrollOffset(200, 200);
518 const gfx::PointF kScrollLayerPosition(-kScrollOffset.x(), 518 const gfx::PointF kScrollLayerPosition(-kScrollOffset.x(),
519 -kScrollOffset.y()); 519 -kScrollOffset.y());
520 float page_scale = 0.888f; 520 float page_scale = 0.888f;
521 const float kDeviceScale = 1.666f; 521 const float kDeviceScale = 1.666f;
522 522
523 FakeImplTaskRunnerProvider task_runner_provider; 523 FakeImplTaskRunnerProvider task_runner_provider;
524 TestSharedBitmapManager shared_bitmap_manager;
525 TestTaskGraphRunner task_graph_runner; 524 TestTaskGraphRunner task_graph_runner;
526 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 525 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner);
527 &task_graph_runner);
528 526
529 std::unique_ptr<LayerImpl> sublayer_scoped_ptr( 527 std::unique_ptr<LayerImpl> sublayer_scoped_ptr(
530 LayerImpl::Create(host_impl.active_tree(), 1)); 528 LayerImpl::Create(host_impl.active_tree(), 1));
531 LayerImpl* sublayer = sublayer_scoped_ptr.get(); 529 LayerImpl* sublayer = sublayer_scoped_ptr.get();
532 sublayer->SetDrawsContent(true); 530 sublayer->SetDrawsContent(true);
533 sublayer->SetBounds(gfx::Size(500, 500)); 531 sublayer->SetBounds(gfx::Size(500, 500));
534 532
535 std::unique_ptr<LayerImpl> scroll_layer_scoped_ptr( 533 std::unique_ptr<LayerImpl> scroll_layer_scoped_ptr(
536 LayerImpl::Create(host_impl.active_tree(), 2)); 534 LayerImpl::Create(host_impl.active_tree(), 2));
537 LayerImpl* scroll_layer = scroll_layer_scoped_ptr.get(); 535 LayerImpl* scroll_layer = scroll_layer_scoped_ptr.get();
(...skipping 2902 matching lines...) Expand 10 before | Expand all | Expand 10 after
3440 ->transform_tree.Node(grand_child->transform_tree_index()) 3438 ->transform_tree.Node(grand_child->transform_tree_index())
3441 ->ancestors_are_invertible); 3439 ->ancestors_are_invertible);
3442 3440
3443 // CalcDrawProps skips a subtree when a layer's screen space transform is 3441 // CalcDrawProps skips a subtree when a layer's screen space transform is
3444 // uninvertible 3442 // uninvertible
3445 EXPECT_EQ(gfx::Rect(), grand_child->visible_layer_rect()); 3443 EXPECT_EQ(gfx::Rect(), grand_child->visible_layer_rect());
3446 } 3444 }
3447 3445
3448 TEST_F(LayerTreeHostCommonTest, OcclusionBySiblingOfTarget) { 3446 TEST_F(LayerTreeHostCommonTest, OcclusionBySiblingOfTarget) {
3449 FakeImplTaskRunnerProvider task_runner_provider; 3447 FakeImplTaskRunnerProvider task_runner_provider;
3450 TestSharedBitmapManager shared_bitmap_manager;
3451 TestTaskGraphRunner task_graph_runner; 3448 TestTaskGraphRunner task_graph_runner;
3452 std::unique_ptr<CompositorFrameSink> compositor_frame_sink = 3449 std::unique_ptr<CompositorFrameSink> compositor_frame_sink =
3453 FakeCompositorFrameSink::Create3d(); 3450 FakeCompositorFrameSink::Create3d();
3454 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 3451 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner);
3455 &task_graph_runner);
3456 3452
3457 std::unique_ptr<LayerImpl> root = 3453 std::unique_ptr<LayerImpl> root =
3458 LayerImpl::Create(host_impl.active_tree(), 1); 3454 LayerImpl::Create(host_impl.active_tree(), 1);
3459 std::unique_ptr<LayerImpl> child = 3455 std::unique_ptr<LayerImpl> child =
3460 LayerImpl::Create(host_impl.active_tree(), 2); 3456 LayerImpl::Create(host_impl.active_tree(), 2);
3461 std::unique_ptr<TextureLayerImpl> surface = 3457 std::unique_ptr<TextureLayerImpl> surface =
3462 TextureLayerImpl::Create(host_impl.active_tree(), 3); 3458 TextureLayerImpl::Create(host_impl.active_tree(), 3);
3463 std::unique_ptr<TextureLayerImpl> surface_child = 3459 std::unique_ptr<TextureLayerImpl> surface_child =
3464 TextureLayerImpl::Create(host_impl.active_tree(), 4); 3460 TextureLayerImpl::Create(host_impl.active_tree(), 4);
3465 std::unique_ptr<TextureLayerImpl> surface_sibling = 3461 std::unique_ptr<TextureLayerImpl> surface_sibling =
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
3517 EXPECT_TRUE(expected_occlusion.IsEqual(actual_occlusion)); 3513 EXPECT_TRUE(expected_occlusion.IsEqual(actual_occlusion));
3518 3514
3519 // Mask layer should have the same occlusion. 3515 // Mask layer should have the same occlusion.
3520 actual_occlusion = 3516 actual_occlusion =
3521 surface_child_mask_ptr->draw_properties().occlusion_in_content_space; 3517 surface_child_mask_ptr->draw_properties().occlusion_in_content_space;
3522 EXPECT_TRUE(expected_occlusion.IsEqual(actual_occlusion)); 3518 EXPECT_TRUE(expected_occlusion.IsEqual(actual_occlusion));
3523 } 3519 }
3524 3520
3525 TEST_F(LayerTreeHostCommonTest, TextureLayerSnapping) { 3521 TEST_F(LayerTreeHostCommonTest, TextureLayerSnapping) {
3526 FakeImplTaskRunnerProvider task_runner_provider; 3522 FakeImplTaskRunnerProvider task_runner_provider;
3527 TestSharedBitmapManager shared_bitmap_manager;
3528 TestTaskGraphRunner task_graph_runner; 3523 TestTaskGraphRunner task_graph_runner;
3529 std::unique_ptr<CompositorFrameSink> compositor_frame_sink = 3524 std::unique_ptr<CompositorFrameSink> compositor_frame_sink =
3530 FakeCompositorFrameSink::Create3d(); 3525 FakeCompositorFrameSink::Create3d();
3531 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 3526 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner);
3532 &task_graph_runner);
3533 3527
3534 std::unique_ptr<LayerImpl> root = 3528 std::unique_ptr<LayerImpl> root =
3535 LayerImpl::Create(host_impl.active_tree(), 1); 3529 LayerImpl::Create(host_impl.active_tree(), 1);
3536 std::unique_ptr<TextureLayerImpl> child = 3530 std::unique_ptr<TextureLayerImpl> child =
3537 TextureLayerImpl::Create(host_impl.active_tree(), 2); 3531 TextureLayerImpl::Create(host_impl.active_tree(), 2);
3538 3532
3539 LayerImpl* child_ptr = child.get(); 3533 LayerImpl* child_ptr = child.get();
3540 3534
3541 root->SetBounds(gfx::Size(100, 100)); 3535 root->SetBounds(gfx::Size(100, 100));
3542 child->SetBounds(gfx::Size(100, 100)); 3536 child->SetBounds(gfx::Size(100, 100));
(...skipping 18 matching lines...) Expand all
3561 fractional_translate); 3555 fractional_translate);
3562 gfx::RectF layer_bounds_in_screen_space = 3556 gfx::RectF layer_bounds_in_screen_space =
3563 MathUtil::MapClippedRect(child_ptr->ScreenSpaceTransform(), 3557 MathUtil::MapClippedRect(child_ptr->ScreenSpaceTransform(),
3564 gfx::RectF(gfx::SizeF(child_ptr->bounds()))); 3558 gfx::RectF(gfx::SizeF(child_ptr->bounds())));
3565 EXPECT_EQ(layer_bounds_in_screen_space, gfx::RectF(11.f, 20.f, 100.f, 100.f)); 3559 EXPECT_EQ(layer_bounds_in_screen_space, gfx::RectF(11.f, 20.f, 100.f, 100.f));
3566 } 3560 }
3567 3561
3568 TEST_F(LayerTreeHostCommonTest, 3562 TEST_F(LayerTreeHostCommonTest,
3569 OcclusionForLayerWithUninvertibleDrawTransform) { 3563 OcclusionForLayerWithUninvertibleDrawTransform) {
3570 FakeImplTaskRunnerProvider task_runner_provider; 3564 FakeImplTaskRunnerProvider task_runner_provider;
3571 TestSharedBitmapManager shared_bitmap_manager;
3572 TestTaskGraphRunner task_graph_runner; 3565 TestTaskGraphRunner task_graph_runner;
3573 std::unique_ptr<CompositorFrameSink> compositor_frame_sink = 3566 std::unique_ptr<CompositorFrameSink> compositor_frame_sink =
3574 FakeCompositorFrameSink::Create3d(); 3567 FakeCompositorFrameSink::Create3d();
3575 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 3568 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner);
3576 &task_graph_runner);
3577 3569
3578 std::unique_ptr<LayerImpl> root = 3570 std::unique_ptr<LayerImpl> root =
3579 LayerImpl::Create(host_impl.active_tree(), 1); 3571 LayerImpl::Create(host_impl.active_tree(), 1);
3580 std::unique_ptr<LayerImpl> child = 3572 std::unique_ptr<LayerImpl> child =
3581 LayerImpl::Create(host_impl.active_tree(), 2); 3573 LayerImpl::Create(host_impl.active_tree(), 2);
3582 std::unique_ptr<LayerImpl> grand_child = 3574 std::unique_ptr<LayerImpl> grand_child =
3583 LayerImpl::Create(host_impl.active_tree(), 3); 3575 LayerImpl::Create(host_impl.active_tree(), 3);
3584 std::unique_ptr<LayerImpl> occluding_child = 3576 std::unique_ptr<LayerImpl> occluding_child =
3585 LayerImpl::Create(host_impl.active_tree(), 4); 3577 LayerImpl::Create(host_impl.active_tree(), 4);
3586 3578
(...skipping 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after
4831 child->SetBounds(gfx::Size(10, 10)); 4823 child->SetBounds(gfx::Size(10, 10));
4832 child->test_properties()->opacity = 0.5f; 4824 child->test_properties()->opacity = 0.5f;
4833 grand_child->SetBounds(gfx::Size(10, 10)); 4825 grand_child->SetBounds(gfx::Size(10, 10));
4834 grand_child->SetDrawsContent(true); 4826 grand_child->SetDrawsContent(true);
4835 ExecuteCalculateDrawProperties(root); 4827 ExecuteCalculateDrawProperties(root);
4836 EXPECT_FALSE(child->has_render_surface()); 4828 EXPECT_FALSE(child->has_render_surface());
4837 } 4829 }
4838 4830
4839 TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) { 4831 TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) {
4840 FakeImplTaskRunnerProvider task_runner_provider; 4832 FakeImplTaskRunnerProvider task_runner_provider;
4841 TestSharedBitmapManager shared_bitmap_manager;
4842 TestTaskGraphRunner task_graph_runner; 4833 TestTaskGraphRunner task_graph_runner;
4843 FakeLayerTreeHostImpl host_impl(host()->GetSettings(), &task_runner_provider, 4834 FakeLayerTreeHostImpl host_impl(host()->GetSettings(), &task_runner_provider,
4844 &shared_bitmap_manager, &task_graph_runner); 4835 &task_graph_runner);
4845 host_impl.CreatePendingTree(); 4836 host_impl.CreatePendingTree();
4846 std::unique_ptr<LayerImpl> root = 4837 std::unique_ptr<LayerImpl> root =
4847 LayerImpl::Create(host_impl.pending_tree(), 1); 4838 LayerImpl::Create(host_impl.pending_tree(), 1);
4848 root->SetBounds(gfx::Size(100, 100)); 4839 root->SetBounds(gfx::Size(100, 100));
4849 root->SetDrawsContent(true); 4840 root->SetDrawsContent(true);
4850 4841
4851 std::unique_ptr<LayerImpl> child = 4842 std::unique_ptr<LayerImpl> child =
4852 LayerImpl::Create(host_impl.pending_tree(), 2); 4843 LayerImpl::Create(host_impl.pending_tree(), 2);
4853 child->SetBounds(gfx::Size(50, 50)); 4844 child->SetBounds(gfx::Size(50, 50));
4854 child->SetDrawsContent(true); 4845 child->SetDrawsContent(true);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
4936 } 4927 }
4937 4928
4938 using LCDTextTestParam = std::tr1::tuple<bool, bool, bool>; 4929 using LCDTextTestParam = std::tr1::tuple<bool, bool, bool>;
4939 class LCDTextTest : public LayerTreeHostCommonTestBase, 4930 class LCDTextTest : public LayerTreeHostCommonTestBase,
4940 public testing::TestWithParam<LCDTextTestParam> { 4931 public testing::TestWithParam<LCDTextTestParam> {
4941 public: 4932 public:
4942 LCDTextTest() 4933 LCDTextTest()
4943 : LayerTreeHostCommonTestBase(LCDTextTestLayerTreeSettings()), 4934 : LayerTreeHostCommonTestBase(LCDTextTestLayerTreeSettings()),
4944 host_impl_(LCDTextTestLayerTreeSettings(), 4935 host_impl_(LCDTextTestLayerTreeSettings(),
4945 &task_runner_provider_, 4936 &task_runner_provider_,
4946 &shared_bitmap_manager_,
4947 &task_graph_runner_) {} 4937 &task_graph_runner_) {}
4948 4938
4949 scoped_refptr<AnimationTimeline> timeline() { return timeline_; } 4939 scoped_refptr<AnimationTimeline> timeline() { return timeline_; }
4950 4940
4951 protected: 4941 protected:
4952 LayerTreeSettings LCDTextTestLayerTreeSettings() { 4942 LayerTreeSettings LCDTextTestLayerTreeSettings() {
4953 LayerTreeSettings settings = VerifyTreeCalcsLayerTreeSettings(); 4943 LayerTreeSettings settings = VerifyTreeCalcsLayerTreeSettings();
4954 4944
4955 can_use_lcd_text_ = std::tr1::get<0>(GetParam()); 4945 can_use_lcd_text_ = std::tr1::get<0>(GetParam());
4956 layers_always_allowed_lcd_text_ = std::tr1::get<1>(GetParam()); 4946 layers_always_allowed_lcd_text_ = std::tr1::get<1>(GetParam());
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
4995 grand_child_->SetBounds(gfx::Size(1, 1)); 4985 grand_child_->SetBounds(gfx::Size(1, 1));
4996 4986
4997 child_->test_properties()->force_render_surface = 4987 child_->test_properties()->force_render_surface =
4998 std::tr1::get<2>(GetParam()); 4988 std::tr1::get<2>(GetParam());
4999 } 4989 }
5000 4990
5001 bool can_use_lcd_text_; 4991 bool can_use_lcd_text_;
5002 bool layers_always_allowed_lcd_text_; 4992 bool layers_always_allowed_lcd_text_;
5003 4993
5004 FakeImplTaskRunnerProvider task_runner_provider_; 4994 FakeImplTaskRunnerProvider task_runner_provider_;
5005 TestSharedBitmapManager shared_bitmap_manager_;
5006 TestTaskGraphRunner task_graph_runner_; 4995 TestTaskGraphRunner task_graph_runner_;
5007 FakeLayerTreeHostImpl host_impl_; 4996 FakeLayerTreeHostImpl host_impl_;
5008 scoped_refptr<AnimationTimeline> timeline_; 4997 scoped_refptr<AnimationTimeline> timeline_;
5009 4998
5010 LayerImpl* root_ = nullptr; 4999 LayerImpl* root_ = nullptr;
5011 LayerImpl* child_ = nullptr; 5000 LayerImpl* child_ = nullptr;
5012 LayerImpl* grand_child_ = nullptr; 5001 LayerImpl* grand_child_ = nullptr;
5013 }; 5002 };
5014 5003
5015 TEST_P(LCDTextTest, CanUseLCDText) { 5004 TEST_P(LCDTextTest, CanUseLCDText) {
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
5153 } 5142 }
5154 5143
5155 INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest, 5144 INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest,
5156 LCDTextTest, 5145 LCDTextTest,
5157 testing::Combine(testing::Bool(), 5146 testing::Combine(testing::Bool(),
5158 testing::Bool(), 5147 testing::Bool(),
5159 testing::Bool())); 5148 testing::Bool()));
5160 5149
5161 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) { 5150 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) {
5162 FakeImplTaskRunnerProvider task_runner_provider; 5151 FakeImplTaskRunnerProvider task_runner_provider;
5163 TestSharedBitmapManager shared_bitmap_manager;
5164 TestTaskGraphRunner task_graph_runner; 5152 TestTaskGraphRunner task_graph_runner;
5165 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 5153 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner);
5166 &task_graph_runner);
5167 host_impl.CreatePendingTree(); 5154 host_impl.CreatePendingTree();
5168 5155
5169 std::unique_ptr<LayerImpl> root = 5156 std::unique_ptr<LayerImpl> root =
5170 LayerImpl::Create(host_impl.pending_tree(), 1); 5157 LayerImpl::Create(host_impl.pending_tree(), 1);
5171 root->SetBounds(gfx::Size(50, 50)); 5158 root->SetBounds(gfx::Size(50, 50));
5172 root->SetDrawsContent(true); 5159 root->SetDrawsContent(true);
5173 LayerImpl* root_layer = root.get(); 5160 LayerImpl* root_layer = root.get();
5174 5161
5175 std::unique_ptr<LayerImpl> child = 5162 std::unique_ptr<LayerImpl> child =
5176 LayerImpl::Create(host_impl.pending_tree(), 2); 5163 LayerImpl::Create(host_impl.pending_tree(), 2);
(...skipping 20 matching lines...) Expand all
5197 // We should have one render surface and two layers. The grand child has 5184 // We should have one render surface and two layers. The grand child has
5198 // hidden itself. 5185 // hidden itself.
5199 ASSERT_EQ(1u, render_surface_layer_list.size()); 5186 ASSERT_EQ(1u, render_surface_layer_list.size());
5200 ASSERT_EQ(2u, root_layer->render_surface()->layer_list().size()); 5187 ASSERT_EQ(2u, root_layer->render_surface()->layer_list().size());
5201 EXPECT_EQ(1, root_layer->render_surface()->layer_list().at(0)->id()); 5188 EXPECT_EQ(1, root_layer->render_surface()->layer_list().at(0)->id());
5202 EXPECT_EQ(2, root_layer->render_surface()->layer_list().at(1)->id()); 5189 EXPECT_EQ(2, root_layer->render_surface()->layer_list().at(1)->id());
5203 } 5190 }
5204 5191
5205 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) { 5192 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) {
5206 FakeImplTaskRunnerProvider task_runner_provider; 5193 FakeImplTaskRunnerProvider task_runner_provider;
5207 TestSharedBitmapManager shared_bitmap_manager;
5208 TestTaskGraphRunner task_graph_runner; 5194 TestTaskGraphRunner task_graph_runner;
5209 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 5195 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner);
5210 &task_graph_runner);
5211 host_impl.CreatePendingTree(); 5196 host_impl.CreatePendingTree();
5212 5197
5213 std::unique_ptr<LayerImpl> root = 5198 std::unique_ptr<LayerImpl> root =
5214 LayerImpl::Create(host_impl.pending_tree(), 1); 5199 LayerImpl::Create(host_impl.pending_tree(), 1);
5215 root->SetBounds(gfx::Size(50, 50)); 5200 root->SetBounds(gfx::Size(50, 50));
5216 root->SetDrawsContent(true); 5201 root->SetDrawsContent(true);
5217 LayerImpl* root_layer = root.get(); 5202 LayerImpl* root_layer = root.get();
5218 5203
5219 std::unique_ptr<LayerImpl> child = 5204 std::unique_ptr<LayerImpl> child =
5220 LayerImpl::Create(host_impl.pending_tree(), 2); 5205 LayerImpl::Create(host_impl.pending_tree(), 2);
(...skipping 20 matching lines...) Expand all
5241 // hidden itself and the grand child. 5226 // hidden itself and the grand child.
5242 ASSERT_EQ(1u, render_surface_layer_list.size()); 5227 ASSERT_EQ(1u, render_surface_layer_list.size());
5243 ASSERT_EQ(1u, root_layer->render_surface()->layer_list().size()); 5228 ASSERT_EQ(1u, root_layer->render_surface()->layer_list().size());
5244 EXPECT_EQ(1, root_layer->render_surface()->layer_list().at(0)->id()); 5229 EXPECT_EQ(1, root_layer->render_surface()->layer_list().at(0)->id());
5245 } 5230 }
5246 5231
5247 void EmptyCopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {} 5232 void EmptyCopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {}
5248 5233
5249 TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) { 5234 TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) {
5250 FakeImplTaskRunnerProvider task_runner_provider; 5235 FakeImplTaskRunnerProvider task_runner_provider;
5251 TestSharedBitmapManager shared_bitmap_manager;
5252 TestTaskGraphRunner task_graph_runner; 5236 TestTaskGraphRunner task_graph_runner;
5253 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 5237 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner);
5254 &task_graph_runner);
5255 host_impl.CreatePendingTree(); 5238 host_impl.CreatePendingTree();
5256 5239
5257 std::unique_ptr<LayerImpl> root = 5240 std::unique_ptr<LayerImpl> root =
5258 LayerImpl::Create(host_impl.pending_tree(), 1); 5241 LayerImpl::Create(host_impl.pending_tree(), 1);
5259 root->SetBounds(gfx::Size(50, 50)); 5242 root->SetBounds(gfx::Size(50, 50));
5260 root->SetDrawsContent(true); 5243 root->SetDrawsContent(true);
5261 LayerImpl* root_layer = root.get(); 5244 LayerImpl* root_layer = root.get();
5262 5245
5263 std::unique_ptr<LayerImpl> copy_grand_parent = 5246 std::unique_ptr<LayerImpl> copy_grand_parent =
5264 LayerImpl::Create(host_impl.pending_tree(), 2); 5247 LayerImpl::Create(host_impl.pending_tree(), 2);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
5387 node = tree.Node(copy_grand_child_layer->effect_tree_index()); 5370 node = tree.Node(copy_grand_child_layer->effect_tree_index());
5388 EXPECT_FALSE(node->is_drawn); 5371 EXPECT_FALSE(node->is_drawn);
5389 5372
5390 // Though copy_layer is drawn, it shouldn't contribute to drawn surface as its 5373 // Though copy_layer is drawn, it shouldn't contribute to drawn surface as its
5391 // actually hidden. 5374 // actually hidden.
5392 EXPECT_FALSE(copy_layer->render_surface()->contributes_to_drawn_surface()); 5375 EXPECT_FALSE(copy_layer->render_surface()->contributes_to_drawn_surface());
5393 } 5376 }
5394 5377
5395 TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) { 5378 TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) {
5396 FakeImplTaskRunnerProvider task_runner_provider; 5379 FakeImplTaskRunnerProvider task_runner_provider;
5397 TestSharedBitmapManager shared_bitmap_manager;
5398 TestTaskGraphRunner task_graph_runner; 5380 TestTaskGraphRunner task_graph_runner;
5399 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 5381 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner);
5400 &task_graph_runner);
5401 host_impl.CreatePendingTree(); 5382 host_impl.CreatePendingTree();
5402 5383
5403 std::unique_ptr<LayerImpl> root = 5384 std::unique_ptr<LayerImpl> root =
5404 LayerImpl::Create(host_impl.pending_tree(), 1); 5385 LayerImpl::Create(host_impl.pending_tree(), 1);
5405 root->SetBounds(gfx::Size(50, 50)); 5386 root->SetBounds(gfx::Size(50, 50));
5406 root->SetDrawsContent(true); 5387 root->SetDrawsContent(true);
5407 5388
5408 std::unique_ptr<LayerImpl> copy_parent = 5389 std::unique_ptr<LayerImpl> copy_parent =
5409 LayerImpl::Create(host_impl.pending_tree(), 2); 5390 LayerImpl::Create(host_impl.pending_tree(), 2);
5410 copy_parent->SetDrawsContent(true); 5391 copy_parent->SetDrawsContent(true);
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
5897 5878
5898 // Verify which render surfaces were created. 5879 // Verify which render surfaces were created.
5899 EXPECT_TRUE(root->has_render_surface()); 5880 EXPECT_TRUE(root->has_render_surface());
5900 EXPECT_FALSE(child1->has_render_surface()); 5881 EXPECT_FALSE(child1->has_render_surface());
5901 EXPECT_TRUE(child2->has_render_surface()); 5882 EXPECT_TRUE(child2->has_render_surface());
5902 EXPECT_FALSE(child3->has_render_surface()); 5883 EXPECT_FALSE(child3->has_render_surface());
5903 } 5884 }
5904 5885
5905 TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) { 5886 TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) {
5906 FakeImplTaskRunnerProvider task_runner_provider; 5887 FakeImplTaskRunnerProvider task_runner_provider;
5907 TestSharedBitmapManager shared_bitmap_manager;
5908 TestTaskGraphRunner task_graph_runner; 5888 TestTaskGraphRunner task_graph_runner;
5909 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 5889 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner);
5910 &task_graph_runner);
5911 5890
5912 std::unique_ptr<LayerImpl> root = 5891 std::unique_ptr<LayerImpl> root =
5913 LayerImpl::Create(host_impl.active_tree(), 12345); 5892 LayerImpl::Create(host_impl.active_tree(), 12345);
5914 std::unique_ptr<LayerImpl> child1 = 5893 std::unique_ptr<LayerImpl> child1 =
5915 LayerImpl::Create(host_impl.active_tree(), 123456); 5894 LayerImpl::Create(host_impl.active_tree(), 123456);
5916 std::unique_ptr<LayerImpl> child2 = 5895 std::unique_ptr<LayerImpl> child2 =
5917 LayerImpl::Create(host_impl.active_tree(), 1234567); 5896 LayerImpl::Create(host_impl.active_tree(), 1234567);
5918 std::unique_ptr<LayerImpl> child3 = 5897 std::unique_ptr<LayerImpl> child3 =
5919 LayerImpl::Create(host_impl.active_tree(), 12345678); 5898 LayerImpl::Create(host_impl.active_tree(), 12345678);
5920 5899
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
6597 TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) { 6576 TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) {
6598 // This test verifies that a scrolling layer that gets snapped to 6577 // This test verifies that a scrolling layer that gets snapped to
6599 // integer coordinates doesn't move a fixed position child. 6578 // integer coordinates doesn't move a fixed position child.
6600 // 6579 //
6601 // + root 6580 // + root
6602 // + container 6581 // + container
6603 // + scroller 6582 // + scroller
6604 // + fixed 6583 // + fixed
6605 // 6584 //
6606 FakeImplTaskRunnerProvider task_runner_provider; 6585 FakeImplTaskRunnerProvider task_runner_provider;
6607 TestSharedBitmapManager shared_bitmap_manager;
6608 TestTaskGraphRunner task_graph_runner; 6586 TestTaskGraphRunner task_graph_runner;
6609 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 6587 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner);
6610 &task_graph_runner);
6611 host_impl.CreatePendingTree(); 6588 host_impl.CreatePendingTree();
6612 std::unique_ptr<LayerImpl> root_ptr = 6589 std::unique_ptr<LayerImpl> root_ptr =
6613 LayerImpl::Create(host_impl.active_tree(), 1); 6590 LayerImpl::Create(host_impl.active_tree(), 1);
6614 LayerImpl* root = root_ptr.get(); 6591 LayerImpl* root = root_ptr.get();
6615 std::unique_ptr<LayerImpl> container = 6592 std::unique_ptr<LayerImpl> container =
6616 LayerImpl::Create(host_impl.active_tree(), 2); 6593 LayerImpl::Create(host_impl.active_tree(), 2);
6617 LayerImpl* container_layer = container.get(); 6594 LayerImpl* container_layer = container.get();
6618 std::unique_ptr<LayerImpl> scroller = 6595 std::unique_ptr<LayerImpl> scroller =
6619 LayerImpl::Create(host_impl.active_tree(), 3); 6596 LayerImpl::Create(host_impl.active_tree(), 3);
6620 LayerImpl* scroll_layer = scroller.get(); 6597 LayerImpl* scroll_layer = scroller.get();
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after
7628 private: 7605 private:
7629 explicit AnimationScaleFactorTrackingLayerImpl(LayerTreeImpl* tree_impl, 7606 explicit AnimationScaleFactorTrackingLayerImpl(LayerTreeImpl* tree_impl,
7630 int id) 7607 int id)
7631 : LayerImpl(tree_impl, id) { 7608 : LayerImpl(tree_impl, id) {
7632 SetDrawsContent(true); 7609 SetDrawsContent(true);
7633 } 7610 }
7634 }; 7611 };
7635 7612
7636 TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) { 7613 TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) {
7637 FakeImplTaskRunnerProvider task_runner_provider; 7614 FakeImplTaskRunnerProvider task_runner_provider;
7638 TestSharedBitmapManager shared_bitmap_manager;
7639 TestTaskGraphRunner task_graph_runner; 7615 TestTaskGraphRunner task_graph_runner;
7640 LayerTreeSettings settings = host()->GetSettings(); 7616 LayerTreeSettings settings = host()->GetSettings();
7641 settings.layer_transforms_should_scale_layer_contents = true; 7617 settings.layer_transforms_should_scale_layer_contents = true;
7642 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider, 7618 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider,
7643 &shared_bitmap_manager, &task_graph_runner); 7619 &task_graph_runner);
7644 std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> grand_parent = 7620 std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> grand_parent =
7645 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 1); 7621 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 1);
7646 std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> parent = 7622 std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> parent =
7647 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 2); 7623 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 2);
7648 std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> child = 7624 std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> child =
7649 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 3); 7625 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 3);
7650 std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> grand_child = 7626 std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> grand_child =
7651 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 4); 7627 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 4);
7652 7628
7653 AnimationScaleFactorTrackingLayerImpl* parent_raw = parent.get(); 7629 AnimationScaleFactorTrackingLayerImpl* parent_raw = parent.get();
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
7886 if (!it.represents_contributing_render_surface()) 7862 if (!it.represents_contributing_render_surface())
7887 continue; 7863 continue;
7888 7864
7889 if (layer->render_surface()->MaskLayer()) 7865 if (layer->render_surface()->MaskLayer())
7890 drawn_layers->insert(layer->render_surface()->MaskLayer()); 7866 drawn_layers->insert(layer->render_surface()->MaskLayer());
7891 } 7867 }
7892 } 7868 }
7893 7869
7894 TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) { 7870 TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) {
7895 FakeImplTaskRunnerProvider task_runner_provider; 7871 FakeImplTaskRunnerProvider task_runner_provider;
7896 TestSharedBitmapManager shared_bitmap_manager;
7897 TestTaskGraphRunner task_graph_runner; 7872 TestTaskGraphRunner task_graph_runner;
7898 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 7873 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner);
7899 &task_graph_runner);
7900 7874
7901 std::unique_ptr<LayerImpl> grand_parent = 7875 std::unique_ptr<LayerImpl> grand_parent =
7902 LayerImpl::Create(host_impl.active_tree(), 1); 7876 LayerImpl::Create(host_impl.active_tree(), 1);
7903 std::unique_ptr<LayerImpl> parent = 7877 std::unique_ptr<LayerImpl> parent =
7904 LayerImpl::Create(host_impl.active_tree(), 3); 7878 LayerImpl::Create(host_impl.active_tree(), 3);
7905 std::unique_ptr<LayerImpl> child = 7879 std::unique_ptr<LayerImpl> child =
7906 LayerImpl::Create(host_impl.active_tree(), 5); 7880 LayerImpl::Create(host_impl.active_tree(), 5);
7907 std::unique_ptr<LayerImpl> grand_child1 = 7881 std::unique_ptr<LayerImpl> grand_child1 =
7908 LayerImpl::Create(host_impl.active_tree(), 7); 7882 LayerImpl::Create(host_impl.active_tree(), 7);
7909 std::unique_ptr<LayerImpl> grand_child2 = 7883 std::unique_ptr<LayerImpl> grand_child2 =
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
8112 expected.insert(grand_child1_raw); 8086 expected.insert(grand_child1_raw);
8113 expected.insert(grand_child2_raw); 8087 expected.insert(grand_child2_raw);
8114 8088
8115 actual.clear(); 8089 actual.clear();
8116 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); 8090 GatherDrawnLayers(render_surface_layer_list_impl(), &actual);
8117 EXPECT_EQ(expected, actual); 8091 EXPECT_EQ(expected, actual);
8118 } 8092 }
8119 8093
8120 TEST_F(LayerTreeHostCommonTest, DrawPropertyScales) { 8094 TEST_F(LayerTreeHostCommonTest, DrawPropertyScales) {
8121 FakeImplTaskRunnerProvider task_runner_provider; 8095 FakeImplTaskRunnerProvider task_runner_provider;
8122 TestSharedBitmapManager shared_bitmap_manager;
8123 TestTaskGraphRunner task_graph_runner; 8096 TestTaskGraphRunner task_graph_runner;
8124 LayerTreeSettings settings = host()->GetSettings(); 8097 LayerTreeSettings settings = host()->GetSettings();
8125 settings.layer_transforms_should_scale_layer_contents = true; 8098 settings.layer_transforms_should_scale_layer_contents = true;
8126 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider, 8099 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider,
8127 &shared_bitmap_manager, &task_graph_runner); 8100 &task_graph_runner);
8128 8101
8129 std::unique_ptr<LayerImpl> root = 8102 std::unique_ptr<LayerImpl> root =
8130 LayerImpl::Create(host_impl.active_tree(), 1); 8103 LayerImpl::Create(host_impl.active_tree(), 1);
8131 LayerImpl* root_layer = root.get(); 8104 LayerImpl* root_layer = root.get();
8132 std::unique_ptr<LayerImpl> child1 = 8105 std::unique_ptr<LayerImpl> child1 =
8133 LayerImpl::Create(host_impl.active_tree(), 2); 8106 LayerImpl::Create(host_impl.active_tree(), 2);
8134 LayerImpl* child1_layer = child1.get(); 8107 LayerImpl* child1_layer = child1.get();
8135 std::unique_ptr<LayerImpl> child2 = 8108 std::unique_ptr<LayerImpl> child2 =
8136 LayerImpl::Create(host_impl.active_tree(), 3); 8109 LayerImpl::Create(host_impl.active_tree(), 3);
8137 LayerImpl* child2_layer = child2.get(); 8110 LayerImpl* child2_layer = child2.get();
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
8227 child1_layer->test_properties()->mask_layer->GetIdealContentsScale()); 8200 child1_layer->test_properties()->mask_layer->GetIdealContentsScale());
8228 EXPECT_FLOAT_EQ(60.f, child2_layer->GetIdealContentsScale()); 8201 EXPECT_FLOAT_EQ(60.f, child2_layer->GetIdealContentsScale());
8229 8202
8230 EXPECT_FLOAT_EQ(0.f, GetMaximumAnimationScale(root_layer)); 8203 EXPECT_FLOAT_EQ(0.f, GetMaximumAnimationScale(root_layer));
8231 EXPECT_FLOAT_EQ(0.f, GetMaximumAnimationScale(child1_layer)); 8204 EXPECT_FLOAT_EQ(0.f, GetMaximumAnimationScale(child1_layer));
8232 EXPECT_FLOAT_EQ(96.f, GetMaximumAnimationScale(child2_layer)); 8205 EXPECT_FLOAT_EQ(96.f, GetMaximumAnimationScale(child2_layer));
8233 } 8206 }
8234 8207
8235 TEST_F(LayerTreeHostCommonTest, AnimationScales) { 8208 TEST_F(LayerTreeHostCommonTest, AnimationScales) {
8236 FakeImplTaskRunnerProvider task_runner_provider; 8209 FakeImplTaskRunnerProvider task_runner_provider;
8237 TestSharedBitmapManager shared_bitmap_manager;
8238 TestTaskGraphRunner task_graph_runner; 8210 TestTaskGraphRunner task_graph_runner;
8239 LayerTreeSettings settings = host()->GetSettings(); 8211 LayerTreeSettings settings = host()->GetSettings();
8240 settings.layer_transforms_should_scale_layer_contents = true; 8212 settings.layer_transforms_should_scale_layer_contents = true;
8241 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider, 8213 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider,
8242 &shared_bitmap_manager, &task_graph_runner); 8214 &task_graph_runner);
8243 8215
8244 std::unique_ptr<LayerImpl> root = 8216 std::unique_ptr<LayerImpl> root =
8245 LayerImpl::Create(host_impl.active_tree(), 1); 8217 LayerImpl::Create(host_impl.active_tree(), 1);
8246 LayerImpl* root_layer = root.get(); 8218 LayerImpl* root_layer = root.get();
8247 std::unique_ptr<LayerImpl> child1 = 8219 std::unique_ptr<LayerImpl> child1 =
8248 LayerImpl::Create(host_impl.active_tree(), 2); 8220 LayerImpl::Create(host_impl.active_tree(), 2);
8249 LayerImpl* child1_layer = child1.get(); 8221 LayerImpl* child1_layer = child1.get();
8250 std::unique_ptr<LayerImpl> child2 = 8222 std::unique_ptr<LayerImpl> child2 =
8251 LayerImpl::Create(host_impl.active_tree(), 3); 8223 LayerImpl::Create(host_impl.active_tree(), 3);
8252 LayerImpl* child2_layer = child2.get(); 8224 LayerImpl* child2_layer = child2.get();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
8306 child2_layer->transform_tree_index(), 100.f, 100.f); 8278 child2_layer->transform_tree_index(), 100.f, 100.f);
8307 EXPECT_FLOAT_EQ(100.f, GetMaximumAnimationScale(child2_layer)); 8279 EXPECT_FLOAT_EQ(100.f, GetMaximumAnimationScale(child2_layer));
8308 EXPECT_FLOAT_EQ(100.f, GetStartingAnimationScale(child2_layer)); 8280 EXPECT_FLOAT_EQ(100.f, GetStartingAnimationScale(child2_layer));
8309 } 8281 }
8310 8282
8311 TEST_F(LayerTreeHostCommonTest, 8283 TEST_F(LayerTreeHostCommonTest,
8312 AnimationScaleWhenLayerTransformShouldNotScaleLayerBounds) { 8284 AnimationScaleWhenLayerTransformShouldNotScaleLayerBounds) {
8313 // Returns empty scale if layer_transforms_should_scale_layer_contents is 8285 // Returns empty scale if layer_transforms_should_scale_layer_contents is
8314 // false. 8286 // false.
8315 FakeImplTaskRunnerProvider task_runner_provider; 8287 FakeImplTaskRunnerProvider task_runner_provider;
8316 TestSharedBitmapManager shared_bitmap_manager;
8317 TestTaskGraphRunner task_graph_runner; 8288 TestTaskGraphRunner task_graph_runner;
8318 LayerTreeSettings settings = host()->GetSettings(); 8289 LayerTreeSettings settings = host()->GetSettings();
8319 settings.layer_transforms_should_scale_layer_contents = false; 8290 settings.layer_transforms_should_scale_layer_contents = false;
8320 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider, 8291 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider,
8321 &shared_bitmap_manager, &task_graph_runner); 8292 &task_graph_runner);
8322 8293
8323 std::unique_ptr<LayerImpl> root = 8294 std::unique_ptr<LayerImpl> root =
8324 LayerImpl::Create(host_impl.active_tree(), 1); 8295 LayerImpl::Create(host_impl.active_tree(), 1);
8325 LayerImpl* root_layer = root.get(); 8296 LayerImpl* root_layer = root.get();
8326 std::unique_ptr<LayerImpl> child = 8297 std::unique_ptr<LayerImpl> child =
8327 LayerImpl::Create(host_impl.active_tree(), 2); 8298 LayerImpl::Create(host_impl.active_tree(), 2);
8328 LayerImpl* child_layer = child.get(); 8299 LayerImpl* child_layer = child.get();
8329 8300
8330 root->test_properties()->AddChild(std::move(child)); 8301 root->test_properties()->AddChild(std::move(child));
8331 host_impl.active_tree()->SetRootLayerForTesting(std::move(root)); 8302 host_impl.active_tree()->SetRootLayerForTesting(std::move(root));
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
8386 // by the viewport. 8357 // by the viewport.
8387 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), root->visible_layer_rect()); 8358 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), root->visible_layer_rect());
8388 8359
8389 // Layers drawing to a child render surface should still have their visible 8360 // Layers drawing to a child render surface should still have their visible
8390 // content rect clipped by the viewport. 8361 // content rect clipped by the viewport.
8391 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), content->visible_layer_rect()); 8362 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), content->visible_layer_rect());
8392 } 8363 }
8393 8364
8394 TEST_F(LayerTreeHostCommonTest, BoundsDeltaAffectVisibleContentRect) { 8365 TEST_F(LayerTreeHostCommonTest, BoundsDeltaAffectVisibleContentRect) {
8395 FakeImplTaskRunnerProvider task_runner_provider; 8366 FakeImplTaskRunnerProvider task_runner_provider;
8396 TestSharedBitmapManager shared_bitmap_manager;
8397 TestTaskGraphRunner task_graph_runner; 8367 TestTaskGraphRunner task_graph_runner;
8398 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 8368 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner);
8399 &task_graph_runner);
8400 8369
8401 // Set two layers: the root layer clips it's child, 8370 // Set two layers: the root layer clips it's child,
8402 // the child draws its content. 8371 // the child draws its content.
8403 8372
8404 gfx::Size root_size = gfx::Size(300, 500); 8373 gfx::Size root_size = gfx::Size(300, 500);
8405 8374
8406 // Sublayer should be bigger than the root enlarged by bounds_delta. 8375 // Sublayer should be bigger than the root enlarged by bounds_delta.
8407 gfx::Size sublayer_size = gfx::Size(300, 1000); 8376 gfx::Size sublayer_size = gfx::Size(300, 1000);
8408 8377
8409 // Device viewport accomidated the root and the browser controls. 8378 // Device viewport accomidated the root and the browser controls.
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
9017 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); 8986 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000));
9018 AddAnimationToElementWithExistingPlayer(child->element_id(), timeline(), 8987 AddAnimationToElementWithExistingPlayer(child->element_id(), timeline(),
9019 std::move(animation)); 8988 std::move(animation));
9020 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); 8989 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get());
9021 update_list = GetUpdateLayerList(); 8990 update_list = GetUpdateLayerList();
9022 EXPECT_TRUE(VerifyLayerInList(grandchild, update_list)); 8991 EXPECT_TRUE(VerifyLayerInList(grandchild, update_list));
9023 } 8992 }
9024 8993
9025 TEST_F(LayerTreeHostCommonTest, SkippingLayerImpl) { 8994 TEST_F(LayerTreeHostCommonTest, SkippingLayerImpl) {
9026 FakeImplTaskRunnerProvider task_runner_provider; 8995 FakeImplTaskRunnerProvider task_runner_provider;
9027 TestSharedBitmapManager shared_bitmap_manager;
9028 TestTaskGraphRunner task_graph_runner; 8996 TestTaskGraphRunner task_graph_runner;
9029 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 8997 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner);
9030 &task_graph_runner);
9031 8998
9032 std::unique_ptr<LayerImpl> root = 8999 std::unique_ptr<LayerImpl> root =
9033 LayerImpl::Create(host_impl.active_tree(), 1); 9000 LayerImpl::Create(host_impl.active_tree(), 1);
9034 std::unique_ptr<LayerImpl> child = 9001 std::unique_ptr<LayerImpl> child =
9035 LayerImpl::Create(host_impl.active_tree(), 2); 9002 LayerImpl::Create(host_impl.active_tree(), 2);
9036 std::unique_ptr<LayerImpl> grandchild = 9003 std::unique_ptr<LayerImpl> grandchild =
9037 LayerImpl::Create(host_impl.active_tree(), 3); 9004 LayerImpl::Create(host_impl.active_tree(), 3);
9038 9005
9039 std::unique_ptr<FakePictureLayerImpl> greatgrandchild( 9006 std::unique_ptr<FakePictureLayerImpl> greatgrandchild(
9040 FakePictureLayerImpl::Create(host_impl.active_tree(), 4)); 9007 FakePictureLayerImpl::Create(host_impl.active_tree(), 4));
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
9206 ExecuteCalculateDrawProperties(root); 9173 ExecuteCalculateDrawProperties(root);
9207 EXPECT_EQ(gfx::Rect(0, 0), grand_child->visible_layer_rect()); 9174 EXPECT_EQ(gfx::Rect(0, 0), grand_child->visible_layer_rect());
9208 EXPECT_EQ(gfx::Rect(0, 0), child->visible_layer_rect()); 9175 EXPECT_EQ(gfx::Rect(0, 0), child->visible_layer_rect());
9209 9176
9210 host_impl()->active_tree()->animation_host()->UnregisterPlayerForElement( 9177 host_impl()->active_tree()->animation_host()->UnregisterPlayerForElement(
9211 grand_child->element_id(), player.get()); 9178 grand_child->element_id(), player.get());
9212 } 9179 }
9213 9180
9214 TEST_F(LayerTreeHostCommonTest, SkippingPendingLayerImpl) { 9181 TEST_F(LayerTreeHostCommonTest, SkippingPendingLayerImpl) {
9215 FakeImplTaskRunnerProvider task_runner_provider; 9182 FakeImplTaskRunnerProvider task_runner_provider;
9216 TestSharedBitmapManager shared_bitmap_manager;
9217 TestTaskGraphRunner task_graph_runner; 9183 TestTaskGraphRunner task_graph_runner;
9218 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 9184 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner);
9219 &task_graph_runner);
9220 9185
9221 host_impl.CreatePendingTree(); 9186 host_impl.CreatePendingTree();
9222 std::unique_ptr<LayerImpl> root = 9187 std::unique_ptr<LayerImpl> root =
9223 LayerImpl::Create(host_impl.pending_tree(), 1); 9188 LayerImpl::Create(host_impl.pending_tree(), 1);
9224 std::unique_ptr<LayerImpl> child = 9189 std::unique_ptr<LayerImpl> child =
9225 LayerImpl::Create(host_impl.pending_tree(), 2); 9190 LayerImpl::Create(host_impl.pending_tree(), 2);
9226 std::unique_ptr<LayerImpl> grandchild = 9191 std::unique_ptr<LayerImpl> grandchild =
9227 LayerImpl::Create(host_impl.pending_tree(), 3); 9192 LayerImpl::Create(host_impl.pending_tree(), 3);
9228 9193
9229 std::unique_ptr<FakePictureLayerImpl> greatgrandchild( 9194 std::unique_ptr<FakePictureLayerImpl> greatgrandchild(
(...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after
10380 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); 10345 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index());
10381 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); 10346 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index());
10382 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); 10347 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index());
10383 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); 10348 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index());
10384 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); 10349 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index());
10385 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); 10350 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index());
10386 } 10351 }
10387 10352
10388 } // namespace 10353 } // namespace
10389 } // namespace cc 10354 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/damage_tracker_unittest.cc ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698