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

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: Use friend class for test code, or we need hundreds of SetSomethingForTest functions in future refa… 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 a33a3e0f82471dcab3277e4ab5c9236b4f7917d1..d95b24c92d6a1527bec8734ebbbbd15844a050dc 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -3032,7 +3032,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);
}
}
@@ -3119,36 +3119,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_) {
@@ -3499,8 +3501,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();
@@ -3536,6 +3540,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;
@@ -3545,9 +3550,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();
@@ -3556,18 +3561,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;
}
@@ -3634,16 +3640,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();
@@ -3664,71 +3678,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;
}
@@ -3741,6 +3789,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:
@@ -3750,32 +3799,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;
}
@@ -3789,6 +3838,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:
@@ -3796,15 +3846,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();
@@ -3813,36 +3863,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;
@@ -3857,6 +3907,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:
@@ -3864,49 +3915,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;
@@ -3921,6 +3972,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:
@@ -3928,49 +3980,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;
@@ -4130,11 +4182,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.
@@ -4143,8 +4196,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