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

Unified Diff: cc/trees/layer_tree_host_unittest.cc

Issue 2159513003: Setup LayerTree class, refactor 2 functions from LayerTreeHost to it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix based on review. Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: cc/trees/layer_tree_host_unittest.cc
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index f6b2f4e5b28120a146fb0ea4e16d003090a56f13..63edaee450c20c6dd8592ef9787e7be6d8d59cfe 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -3003,7 +3003,7 @@ class PushPropertiesCountingLayer : public Layer {
Layer::PushPropertiesTo(layer);
push_properties_count_++;
if (persist_needs_push_properties_) {
- layer_tree_host()->AddLayerShouldPushProperties(this);
+ layer_tree_host()->GetLayerTree()->AddLayerShouldPushProperties(this);
}
}
@@ -3090,36 +3090,38 @@ class LayerTreeHostTestLayersPushProperties : public LayerTreeHostTest {
// The scrollbar layer always needs to be pushed.
if (root_->layer_tree_host()) {
- EXPECT_FALSE(root_->layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- root_.get()));
+ EXPECT_FALSE(root_->layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(root_.get()));
}
if (child2_->layer_tree_host()) {
- EXPECT_FALSE(
- child2_->layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- child2_.get()));
+ EXPECT_FALSE(child2_->layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(child2_.get()));
}
if (leaf_always_pushing_layer_->layer_tree_host()) {
EXPECT_TRUE(leaf_always_pushing_layer_->layer_tree_host()
+ ->GetLayerTree()
->LayerNeedsPushPropertiesForTesting(
leaf_always_pushing_layer_.get()));
}
// child_ and grandchild_ don't persist their need to push properties.
if (child_->layer_tree_host()) {
- EXPECT_FALSE(
- child_->layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- child_.get()));
+ EXPECT_FALSE(child_->layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(child_.get()));
}
if (grandchild_->layer_tree_host()) {
- EXPECT_FALSE(
- grandchild_->layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild_.get()));
+ EXPECT_FALSE(grandchild_->layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(grandchild_.get()));
}
if (other_root_->layer_tree_host()) {
- EXPECT_FALSE(
- other_root_->layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- other_root_.get()));
+ EXPECT_FALSE(other_root_->layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(other_root_.get()));
}
switch (num_commits_) {
@@ -3470,8 +3472,10 @@ class LayerTreeHostTestPropertyChangesDuringUpdateArePushed
scrollbar_layer_->SetBounds(gfx::Size(30, 30));
- EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- scrollbar_layer_.get()));
+ EXPECT_TRUE(
+ layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(scrollbar_layer_.get()));
layer_tree_host()->SetNeedsCommit();
scrollbar_layer_->reset_push_properties_count();
@@ -3507,6 +3511,7 @@ class LayerTreeHostTestSetDrawableCausesCommit : public LayerTreeHostTest {
}
void DidCommitAndDrawFrame() override {
+ LayerTree* layer_tree = layer_tree_host()->GetLayerTree();
switch (layer_tree_host()->source_frame_number()) {
case 0:
break;
@@ -3516,9 +3521,9 @@ class LayerTreeHostTestSetDrawableCausesCommit : public LayerTreeHostTest {
// is made during this, however, it needs to be pushed in the upcoming
// commit.
EXPECT_FALSE(
- layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- child_.get()));
+ layer_tree->LayerNeedsPushPropertiesForTesting(root_.get()));
+ EXPECT_FALSE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(child_.get()));
EXPECT_EQ(0, root_->NumDescendantsThatDrawContent());
root_->reset_push_properties_count();
child_->reset_push_properties_count();
@@ -3527,18 +3532,19 @@ class LayerTreeHostTestSetDrawableCausesCommit : public LayerTreeHostTest {
EXPECT_EQ(0u, root_->push_properties_count());
EXPECT_EQ(0u, child_->push_properties_count());
EXPECT_TRUE(
- layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
- EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- child_.get()));
+ layer_tree->LayerNeedsPushPropertiesForTesting(root_.get()));
+ EXPECT_TRUE(
+
+ layer_tree->LayerNeedsPushPropertiesForTesting(child_.get()));
break;
}
case 2:
EXPECT_EQ(1u, root_->push_properties_count());
EXPECT_EQ(1u, child_->push_properties_count());
EXPECT_FALSE(
- layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- child_.get()));
+ layer_tree->LayerNeedsPushPropertiesForTesting(root_.get()));
+ EXPECT_FALSE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(child_.get()));
EndTest();
break;
}
@@ -3605,16 +3611,24 @@ class LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush
case 0:
// All layers will need push properties as we set their layer tree host
layer_tree_host()->SetRootLayer(root_);
+ EXPECT_TRUE(layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(root_.get()));
+ EXPECT_TRUE(layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(child_.get()));
+ EXPECT_TRUE(
+ layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(grandchild1_.get()));
EXPECT_TRUE(
- layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
- EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- child_.get()));
- EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild1_.get()));
- EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild2_.get()));
- EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild3_.get()));
+ layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(grandchild2_.get()));
+ EXPECT_TRUE(
+ layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(grandchild3_.get()));
break;
case 1:
EndTest();
@@ -3635,71 +3649,105 @@ class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion
layer_tree_host()->SetRootLayer(root_);
break;
case 1:
+ EXPECT_FALSE(layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(root_.get()));
+ EXPECT_FALSE(layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(child_.get()));
+ EXPECT_FALSE(
+ layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(grandchild1_.get()));
EXPECT_FALSE(
- layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- child_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild1_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild2_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild3_.get()));
+ layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(grandchild2_.get()));
+ EXPECT_FALSE(
+ layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(grandchild3_.get()));
grandchild1_->RemoveFromParent();
grandchild1_->SetPosition(gfx::PointF(1.f, 1.f));
+ EXPECT_FALSE(layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(root_.get()));
+ EXPECT_FALSE(layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(child_.get()));
+ EXPECT_FALSE(
+ layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(grandchild2_.get()));
EXPECT_FALSE(
- layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- child_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild2_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild3_.get()));
+ layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(grandchild3_.get()));
child_->AddChild(grandchild1_);
+ EXPECT_FALSE(layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(root_.get()));
+ EXPECT_FALSE(layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(child_.get()));
+ EXPECT_TRUE(
+ layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(grandchild1_.get()));
EXPECT_FALSE(
- layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- child_.get()));
- EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild1_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild2_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild3_.get()));
+ layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(grandchild2_.get()));
+ EXPECT_FALSE(
+ layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(grandchild3_.get()));
grandchild2_->SetPosition(gfx::PointF(1.f, 1.f));
+ EXPECT_FALSE(layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(root_.get()));
+ EXPECT_FALSE(layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(child_.get()));
+ EXPECT_TRUE(
+ layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(grandchild1_.get()));
+ EXPECT_TRUE(
+ layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(grandchild2_.get()));
EXPECT_FALSE(
- layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- child_.get()));
- EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild1_.get()));
- EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild2_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild3_.get()));
+ layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(grandchild3_.get()));
// grandchild2_ will still need a push properties.
grandchild1_->RemoveFromParent();
- EXPECT_FALSE(
- layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- child_.get()));
+ EXPECT_FALSE(layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(root_.get()));
+ EXPECT_FALSE(layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(child_.get()));
// grandchild3_ does not need a push properties, so recursing should
// no longer be needed.
grandchild2_->RemoveFromParent();
- EXPECT_FALSE(
- layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- child_.get()));
+ EXPECT_FALSE(layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(root_.get()));
+ EXPECT_FALSE(layer_tree_host()
+ ->GetLayerTree()
+ ->LayerNeedsPushPropertiesForTesting(child_.get()));
EndTest();
break;
}
@@ -3712,6 +3760,7 @@ class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence
: public LayerTreeHostTestCasePushPropertiesThreeGrandChildren {
protected:
void DidCommitAndDrawFrame() override {
+ LayerTree* layer_tree = layer_tree_host()->GetLayerTree();
int last_source_frame_number = layer_tree_host()->source_frame_number() - 1;
switch (last_source_frame_number) {
case 0:
@@ -3721,32 +3770,32 @@ class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence
break;
case 1:
EXPECT_FALSE(
- layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- child_.get()));
- EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild1_.get()));
- EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild2_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild3_.get()));
+ layer_tree->LayerNeedsPushPropertiesForTesting(root_.get()));
+ EXPECT_FALSE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(child_.get()));
+ EXPECT_TRUE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get()));
+ EXPECT_TRUE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get()));
+ EXPECT_FALSE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(grandchild3_.get()));
// grandchild2_ will still need a push properties.
grandchild1_->RemoveFromParent();
EXPECT_FALSE(
- layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- child_.get()));
+ layer_tree->LayerNeedsPushPropertiesForTesting(root_.get()));
+ EXPECT_FALSE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(child_.get()));
// grandchild3_ does not need a push properties, so recursing should
// no longer be needed.
grandchild2_->RemoveFromParent();
EXPECT_FALSE(
- layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- child_.get()));
+ layer_tree->LayerNeedsPushPropertiesForTesting(root_.get()));
+ EXPECT_FALSE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(child_.get()));
EndTest();
break;
}
@@ -3760,6 +3809,7 @@ class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree
: public LayerTreeHostTestCasePushPropertiesThreeGrandChildren {
protected:
void DidCommitAndDrawFrame() override {
+ LayerTree* layer_tree = layer_tree_host()->GetLayerTree();
int last_source_frame_number = layer_tree_host()->source_frame_number() - 1;
switch (last_source_frame_number) {
case 0:
@@ -3767,15 +3817,15 @@ class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree
break;
case 1:
EXPECT_FALSE(
- layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- child_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild1_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild2_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild3_.get()));
+ layer_tree->LayerNeedsPushPropertiesForTesting(root_.get()));
+ EXPECT_FALSE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(child_.get()));
+ EXPECT_FALSE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get()));
+ EXPECT_FALSE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get()));
+ EXPECT_FALSE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(grandchild3_.get()));
// Change grandchildren while their parent is not in the tree.
child_->RemoveFromParent();
@@ -3784,36 +3834,36 @@ class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree
root_->AddChild(child_);
EXPECT_FALSE(
- layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
- EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- child_.get()));
- EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild1_.get()));
- EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild2_.get()));
- EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild3_.get()));
+ layer_tree->LayerNeedsPushPropertiesForTesting(root_.get()));
+ EXPECT_TRUE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(child_.get()));
+ EXPECT_TRUE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get()));
+ EXPECT_TRUE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get()));
+ EXPECT_TRUE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(grandchild3_.get()));
grandchild1_->RemoveFromParent();
EXPECT_FALSE(
- layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
- EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- child_.get()));
+ layer_tree->LayerNeedsPushPropertiesForTesting(root_.get()));
+ EXPECT_TRUE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(child_.get()));
grandchild2_->RemoveFromParent();
EXPECT_FALSE(
- layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
- EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- child_.get()));
+ layer_tree->LayerNeedsPushPropertiesForTesting(root_.get()));
+ EXPECT_TRUE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(child_.get()));
grandchild3_->RemoveFromParent();
EXPECT_FALSE(
- layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
- EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- child_.get()));
+ layer_tree->LayerNeedsPushPropertiesForTesting(root_.get()));
+ EXPECT_TRUE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(child_.get()));
EndTest();
break;
@@ -3828,6 +3878,7 @@ class LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild
: public LayerTreeHostTestCasePushPropertiesThreeGrandChildren {
protected:
void DidCommitAndDrawFrame() override {
+ LayerTree* layer_tree = layer_tree_host()->GetLayerTree();
int last_source_frame_number = layer_tree_host()->source_frame_number() - 1;
switch (last_source_frame_number) {
case 0:
@@ -3835,49 +3886,49 @@ class LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild
break;
case 1:
EXPECT_FALSE(
- layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- child_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild1_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild2_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild3_.get()));
+ layer_tree->LayerNeedsPushPropertiesForTesting(root_.get()));
+ EXPECT_FALSE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(child_.get()));
+ EXPECT_FALSE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get()));
+ EXPECT_FALSE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get()));
+ EXPECT_FALSE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(grandchild3_.get()));
child_->SetPosition(gfx::PointF(1.f, 1.f));
grandchild1_->SetPosition(gfx::PointF(1.f, 1.f));
grandchild2_->SetPosition(gfx::PointF(1.f, 1.f));
EXPECT_FALSE(
- layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
- EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- child_.get()));
- EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild1_.get()));
- EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild2_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild3_.get()));
+ layer_tree->LayerNeedsPushPropertiesForTesting(root_.get()));
+ EXPECT_TRUE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(child_.get()));
+ EXPECT_TRUE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get()));
+ EXPECT_TRUE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get()));
+ EXPECT_FALSE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(grandchild3_.get()));
grandchild1_->RemoveFromParent();
EXPECT_FALSE(
- layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
- EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- child_.get()));
+ layer_tree->LayerNeedsPushPropertiesForTesting(root_.get()));
+ EXPECT_TRUE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(child_.get()));
grandchild2_->RemoveFromParent();
EXPECT_FALSE(
- layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
- EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- child_.get()));
+ layer_tree->LayerNeedsPushPropertiesForTesting(root_.get()));
+ EXPECT_TRUE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(child_.get()));
child_->RemoveFromParent();
EXPECT_FALSE(
- layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
+ layer_tree->LayerNeedsPushPropertiesForTesting(root_.get()));
EndTest();
break;
@@ -3892,6 +3943,7 @@ class LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent
: public LayerTreeHostTestCasePushPropertiesThreeGrandChildren {
protected:
void DidCommitAndDrawFrame() override {
+ LayerTree* layer_tree = layer_tree_host()->GetLayerTree();
int last_source_frame_number = layer_tree_host()->source_frame_number() - 1;
switch (last_source_frame_number) {
case 0:
@@ -3899,49 +3951,49 @@ class LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent
break;
case 1:
EXPECT_FALSE(
- layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- child_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild1_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild2_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild3_.get()));
+ layer_tree->LayerNeedsPushPropertiesForTesting(root_.get()));
+ EXPECT_FALSE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(child_.get()));
+ EXPECT_FALSE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get()));
+ EXPECT_FALSE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get()));
+ EXPECT_FALSE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(grandchild3_.get()));
grandchild1_->SetPosition(gfx::PointF(1.f, 1.f));
grandchild2_->SetPosition(gfx::PointF(1.f, 1.f));
child_->SetPosition(gfx::PointF(1.f, 1.f));
EXPECT_FALSE(
- layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
- EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- child_.get()));
- EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild1_.get()));
- EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild2_.get()));
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- grandchild3_.get()));
+ layer_tree->LayerNeedsPushPropertiesForTesting(root_.get()));
+ EXPECT_TRUE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(child_.get()));
+ EXPECT_TRUE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get()));
+ EXPECT_TRUE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get()));
+ EXPECT_FALSE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(grandchild3_.get()));
grandchild1_->RemoveFromParent();
EXPECT_FALSE(
- layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
- EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- child_.get()));
+ layer_tree->LayerNeedsPushPropertiesForTesting(root_.get()));
+ EXPECT_TRUE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(child_.get()));
grandchild2_->RemoveFromParent();
EXPECT_FALSE(
- layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
- EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- child_.get()));
+ layer_tree->LayerNeedsPushPropertiesForTesting(root_.get()));
+ EXPECT_TRUE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(child_.get()));
child_->RemoveFromParent();
EXPECT_FALSE(
- layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
+ layer_tree->LayerNeedsPushPropertiesForTesting(root_.get()));
EndTest();
break;
@@ -4101,11 +4153,12 @@ class LayerTreeHostTestPushHiddenLayer : public LayerTreeHostTest {
void BeginTest() override { PostSetNeedsCommitToMainThread(); }
void DidCommitAndDrawFrame() override {
+ LayerTree* layer_tree = layer_tree_host()->GetLayerTree();
switch (layer_tree_host()->source_frame_number()) {
case 1:
// The layer type used does not need to push properties every frame.
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- child_layer_.get()));
+ EXPECT_FALSE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(child_layer_.get()));
// Change the bounds of the child layer, but make it skipped
// by CalculateDrawProperties.
@@ -4114,8 +4167,8 @@ class LayerTreeHostTestPushHiddenLayer : public LayerTreeHostTest {
break;
case 2:
// The bounds of the child layer were pushed to the impl side.
- EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
- child_layer_.get()));
+ EXPECT_FALSE(
+ layer_tree->LayerNeedsPushPropertiesForTesting(child_layer_.get()));
EndTest();
break;

Powered by Google App Engine
This is Rietveld 408576698