Chromium Code Reviews| Index: cc/trees/layer_tree_host_unittest_damage.cc |
| diff --git a/cc/trees/layer_tree_host_unittest_damage.cc b/cc/trees/layer_tree_host_unittest_damage.cc |
| index 76c26f6682e9c35bf8fdbf75506167a702213575..522a2f1578b15213b0132b71125db7dd27974dff 100644 |
| --- a/cc/trees/layer_tree_host_unittest_damage.cc |
| +++ b/cc/trees/layer_tree_host_unittest_damage.cc |
| @@ -339,6 +339,7 @@ class LayerTreeHostScrollbarDamageTest : public LayerTreeHostDamageTest { |
| scoped_refptr<Layer> scroll_clip_layer = Layer::Create(); |
| scoped_refptr<Layer> content_layer = FakePictureLayer::Create(&client_); |
| + content_layer_ = content_layer.get(); |
| content_layer->SetScrollClipLayerId(scroll_clip_layer->id()); |
| content_layer->SetScrollOffset(gfx::ScrollOffset(10, 20)); |
| content_layer->SetBounds(gfx::Size(100, 200)); |
| @@ -368,6 +369,9 @@ class LayerTreeHostScrollbarDamageTest : public LayerTreeHostDamageTest { |
| private: |
| FakeContentLayerClient client_; |
| + |
| + protected: |
| + Layer* content_layer_; |
|
ajuma
2016/04/20 21:40:52
This should be a scoped_refptr.
sunxd
2016/04/21 17:31:15
Done.
|
| }; |
| class LayerTreeHostDamageTestScrollbarDoesDamage |
| @@ -410,9 +414,8 @@ class LayerTreeHostDamageTestScrollbarDoesDamage |
| void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, bool result) override { |
| ++did_swaps_; |
| EXPECT_TRUE(result); |
| - LayerImpl* root = host_impl->active_tree()->root_layer(); |
| - LayerImpl* scroll_clip_layer = root->children()[0]; |
| - LayerImpl* scroll_layer = scroll_clip_layer->children()[0]; |
| + LayerImpl* scroll_layer = |
| + host_impl->active_tree()->LayerById(content_layer_->id()); |
| switch (did_swaps_) { |
| case 1: |
| // Test that modifying the position of the content layer (not |
| @@ -439,18 +442,13 @@ class LayerTreeHostDamageTestScrollbarDoesDamage |
| void ModifyContentLayerPosition() { |
| EXPECT_EQ(1, did_swaps_); |
| - Layer* root = layer_tree_host()->root_layer(); |
| - Layer* scroll_clip_layer = root->child_at(0); |
| - Layer* scroll_layer = scroll_clip_layer->child_at(0); |
| - scroll_layer->SetPosition(gfx::PointF(10.f, 10.f)); |
| + content_layer_->SetPosition(gfx::PointF(10.f, 10.f)); |
| } |
| void ResizeScrollLayer() { |
| EXPECT_EQ(3, did_swaps_); |
| Layer* root = layer_tree_host()->root_layer(); |
| - Layer* scroll_clip_layer = root->child_at(0); |
| - Layer* scroll_layer = scroll_clip_layer->child_at(0); |
| - scroll_layer->SetBounds( |
| + content_layer_->SetBounds( |
| gfx::Size(root->bounds().width() + 60, root->bounds().height() + 100)); |
| } |
| @@ -503,9 +501,8 @@ class LayerTreeHostDamageTestScrollbarCommitDoesNoDamage |
| void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, bool result) override { |
| ++did_swaps_; |
| EXPECT_TRUE(result); |
| - LayerImpl* root = host_impl->active_tree()->root_layer(); |
| - LayerImpl* scroll_clip_layer = root->children()[0]; |
| - LayerImpl* scroll_layer = scroll_clip_layer->children()[0]; |
| + LayerImpl* scroll_layer = |
| + host_impl->active_tree()->LayerById(content_layer_->id()); |
| switch (did_swaps_) { |
| case 1: |
| // Scroll on the thread. This should damage the scrollbar for the |