Index: cc/layers/layer_unittest.cc |
diff --git a/cc/layers/layer_unittest.cc b/cc/layers/layer_unittest.cc |
index bae8185053fe6a9123df9667313e584a4cce0bed..836992aaea9efd55f7285ab165df704adc5ff8c9 100644 |
--- a/cc/layers/layer_unittest.cc |
+++ b/cc/layers/layer_unittest.cc |
@@ -109,13 +109,13 @@ class LayerTest : public testing::Test { |
} |
void CreateSimpleTestTree() { |
- parent_ = Layer::Create(); |
- child1_ = Layer::Create(); |
- child2_ = Layer::Create(); |
- child3_ = Layer::Create(); |
- grand_child1_ = Layer::Create(); |
- grand_child2_ = Layer::Create(); |
- grand_child3_ = Layer::Create(); |
+ parent_ = Layer::Create(layer_settings_); |
+ child1_ = Layer::Create(layer_settings_); |
+ child2_ = Layer::Create(layer_settings_); |
+ child3_ = Layer::Create(layer_settings_); |
+ grand_child1_ = Layer::Create(layer_settings_); |
+ grand_child2_ = Layer::Create(layer_settings_); |
+ grand_child3_ = Layer::Create(layer_settings_); |
EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(AnyNumber()); |
layer_tree_host_->SetRootLayer(parent_); |
@@ -146,10 +146,12 @@ class LayerTest : public testing::Test { |
scoped_refptr<Layer> grand_child1_; |
scoped_refptr<Layer> grand_child2_; |
scoped_refptr<Layer> grand_child3_; |
+ |
+ LayerSettings layer_settings_; |
}; |
TEST_F(LayerTest, BasicCreateAndDestroy) { |
- scoped_refptr<Layer> test_layer = Layer::Create(); |
+ scoped_refptr<Layer> test_layer = Layer::Create(layer_settings_); |
ASSERT_TRUE(test_layer.get()); |
EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(0); |
@@ -161,8 +163,8 @@ TEST_F(LayerTest, BasicCreateAndDestroy) { |
} |
TEST_F(LayerTest, AddAndRemoveChild) { |
- scoped_refptr<Layer> parent = Layer::Create(); |
- scoped_refptr<Layer> child = Layer::Create(); |
+ scoped_refptr<Layer> parent = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> child = Layer::Create(layer_settings_); |
// Upon creation, layers should not have children or parent. |
ASSERT_EQ(0U, parent->children().size()); |
@@ -182,8 +184,8 @@ TEST_F(LayerTest, AddAndRemoveChild) { |
TEST_F(LayerTest, AddSameChildTwice) { |
EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(AtLeast(1)); |
- scoped_refptr<Layer> parent = Layer::Create(); |
- scoped_refptr<Layer> child = Layer::Create(); |
+ scoped_refptr<Layer> parent = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> child = Layer::Create(layer_settings_); |
layer_tree_host_->SetRootLayer(parent); |
@@ -199,11 +201,11 @@ TEST_F(LayerTest, AddSameChildTwice) { |
} |
TEST_F(LayerTest, InsertChild) { |
- scoped_refptr<Layer> parent = Layer::Create(); |
- scoped_refptr<Layer> child1 = Layer::Create(); |
- scoped_refptr<Layer> child2 = Layer::Create(); |
- scoped_refptr<Layer> child3 = Layer::Create(); |
- scoped_refptr<Layer> child4 = Layer::Create(); |
+ scoped_refptr<Layer> parent = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> child1 = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> child2 = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> child3 = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> child4 = Layer::Create(layer_settings_); |
EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(parent)); |
@@ -244,9 +246,9 @@ TEST_F(LayerTest, InsertChild) { |
} |
TEST_F(LayerTest, InsertChildPastEndOfList) { |
- scoped_refptr<Layer> parent = Layer::Create(); |
- scoped_refptr<Layer> child1 = Layer::Create(); |
- scoped_refptr<Layer> child2 = Layer::Create(); |
+ scoped_refptr<Layer> parent = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> child1 = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> child2 = Layer::Create(layer_settings_); |
ASSERT_EQ(0U, parent->children().size()); |
@@ -265,9 +267,9 @@ TEST_F(LayerTest, InsertChildPastEndOfList) { |
} |
TEST_F(LayerTest, InsertSameChildTwice) { |
- scoped_refptr<Layer> parent = Layer::Create(); |
- scoped_refptr<Layer> child1 = Layer::Create(); |
- scoped_refptr<Layer> child2 = Layer::Create(); |
+ scoped_refptr<Layer> parent = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> child1 = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> child2 = Layer::Create(layer_settings_); |
EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(parent)); |
@@ -294,7 +296,7 @@ TEST_F(LayerTest, InsertSameChildTwice) { |
TEST_F(LayerTest, ReplaceChildWithNewChild) { |
CreateSimpleTestTree(); |
- scoped_refptr<Layer> child4 = Layer::Create(); |
+ scoped_refptr<Layer> child4 = Layer::Create(layer_settings_); |
EXPECT_FALSE(child4->parent()); |
@@ -319,8 +321,8 @@ TEST_F(LayerTest, ReplaceChildWithNewChildThatHasOtherParent) { |
CreateSimpleTestTree(); |
// create another simple tree with test_layer and child4. |
- scoped_refptr<Layer> test_layer = Layer::Create(); |
- scoped_refptr<Layer> child4 = Layer::Create(); |
+ scoped_refptr<Layer> test_layer = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> child4 = Layer::Create(layer_settings_); |
test_layer->AddChild(child4); |
ASSERT_EQ(1U, test_layer->children().size()); |
EXPECT_EQ(child4, test_layer->children()[0]); |
@@ -342,9 +344,9 @@ TEST_F(LayerTest, ReplaceChildWithNewChildThatHasOtherParent) { |
} |
TEST_F(LayerTest, DeleteRemovedScrollParent) { |
- scoped_refptr<Layer> parent = Layer::Create(); |
- scoped_refptr<Layer> child1 = Layer::Create(); |
- scoped_refptr<Layer> child2 = Layer::Create(); |
+ scoped_refptr<Layer> parent = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> child1 = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> child2 = Layer::Create(layer_settings_); |
EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(parent)); |
@@ -371,9 +373,9 @@ TEST_F(LayerTest, DeleteRemovedScrollParent) { |
} |
TEST_F(LayerTest, DeleteRemovedScrollChild) { |
- scoped_refptr<Layer> parent = Layer::Create(); |
- scoped_refptr<Layer> child1 = Layer::Create(); |
- scoped_refptr<Layer> child2 = Layer::Create(); |
+ scoped_refptr<Layer> parent = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> child1 = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> child2 = Layer::Create(layer_settings_); |
EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(parent)); |
@@ -423,11 +425,11 @@ TEST_F(LayerTest, RemoveAllChildren) { |
} |
TEST_F(LayerTest, SetChildren) { |
- scoped_refptr<Layer> old_parent = Layer::Create(); |
- scoped_refptr<Layer> new_parent = Layer::Create(); |
+ scoped_refptr<Layer> old_parent = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> new_parent = Layer::Create(layer_settings_); |
- scoped_refptr<Layer> child1 = Layer::Create(); |
- scoped_refptr<Layer> child2 = Layer::Create(); |
+ scoped_refptr<Layer> child1 = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> child2 = Layer::Create(layer_settings_); |
LayerList new_children; |
new_children.push_back(child1); |
@@ -454,17 +456,17 @@ TEST_F(LayerTest, SetChildren) { |
} |
TEST_F(LayerTest, HasAncestor) { |
- scoped_refptr<Layer> parent = Layer::Create(); |
+ scoped_refptr<Layer> parent = Layer::Create(layer_settings_); |
EXPECT_FALSE(parent->HasAncestor(parent.get())); |
- scoped_refptr<Layer> child = Layer::Create(); |
+ scoped_refptr<Layer> child = Layer::Create(layer_settings_); |
parent->AddChild(child); |
EXPECT_FALSE(child->HasAncestor(child.get())); |
EXPECT_TRUE(child->HasAncestor(parent.get())); |
EXPECT_FALSE(parent->HasAncestor(child.get())); |
- scoped_refptr<Layer> child_child = Layer::Create(); |
+ scoped_refptr<Layer> child_child = Layer::Create(layer_settings_); |
child->AddChild(child_child); |
EXPECT_FALSE(child_child->HasAncestor(child_child.get())); |
@@ -480,7 +482,7 @@ TEST_F(LayerTest, GetRootLayerAfterTreeManipulations) { |
// For this test we don't care about SetNeedsFullTreeSync calls. |
EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(AnyNumber()); |
- scoped_refptr<Layer> child4 = Layer::Create(); |
+ scoped_refptr<Layer> child4 = Layer::Create(layer_settings_); |
EXPECT_EQ(parent_.get(), parent_->RootLayer()); |
EXPECT_EQ(parent_.get(), child1_->RootLayer()); |
@@ -535,7 +537,7 @@ TEST_F(LayerTest, CheckSetNeedsDisplayCausesCorrectBehavior) { |
// 2. indirectly calls SetNeedsUpdate, exactly once for each call to |
// SetNeedsDisplay. |
- scoped_refptr<Layer> test_layer = Layer::Create(); |
+ scoped_refptr<Layer> test_layer = Layer::Create(layer_settings_); |
EXPECT_SET_NEEDS_FULL_TREE_SYNC( |
1, layer_tree_host_->SetRootLayer(test_layer)); |
EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetIsDrawable(true)); |
@@ -588,13 +590,13 @@ TEST_F(LayerTest, CheckSetNeedsDisplayCausesCorrectBehavior) { |
} |
TEST_F(LayerTest, CheckPropertyChangeCausesCorrectBehavior) { |
- scoped_refptr<Layer> test_layer = Layer::Create(); |
+ scoped_refptr<Layer> test_layer = Layer::Create(layer_settings_); |
EXPECT_SET_NEEDS_FULL_TREE_SYNC( |
1, layer_tree_host_->SetRootLayer(test_layer)); |
EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetIsDrawable(true)); |
- scoped_refptr<Layer> dummy_layer1 = Layer::Create(); |
- scoped_refptr<Layer> dummy_layer2 = Layer::Create(); |
+ scoped_refptr<Layer> dummy_layer1 = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> dummy_layer2 = Layer::Create(layer_settings_); |
// sanity check of initial test condition |
EXPECT_FALSE(test_layer->NeedsDisplayForTesting()); |
@@ -647,7 +649,7 @@ TEST_F(LayerTest, CheckPropertyChangeCausesCorrectBehavior) { |
} |
TEST_F(LayerTest, PushPropertiesAccumulatesUpdateRect) { |
- scoped_refptr<Layer> test_layer = Layer::Create(); |
+ scoped_refptr<Layer> test_layer = Layer::Create(layer_settings_); |
scoped_ptr<LayerImpl> impl_layer = |
LayerImpl::Create(host_impl_.active_tree(), 1); |
@@ -676,7 +678,7 @@ TEST_F(LayerTest, PushPropertiesAccumulatesUpdateRect) { |
} |
TEST_F(LayerTest, PushPropertiesCausesLayerPropertyChangedForTransform) { |
- scoped_refptr<Layer> test_layer = Layer::Create(); |
+ scoped_refptr<Layer> test_layer = Layer::Create(layer_settings_); |
scoped_ptr<LayerImpl> impl_layer = |
LayerImpl::Create(host_impl_.active_tree(), 1); |
@@ -695,7 +697,7 @@ TEST_F(LayerTest, PushPropertiesCausesLayerPropertyChangedForTransform) { |
} |
TEST_F(LayerTest, PushPropertiesCausesLayerPropertyChangedForOpacity) { |
- scoped_refptr<Layer> test_layer = Layer::Create(); |
+ scoped_refptr<Layer> test_layer = Layer::Create(layer_settings_); |
scoped_ptr<LayerImpl> impl_layer = |
LayerImpl::Create(host_impl_.active_tree(), 1); |
@@ -713,7 +715,7 @@ TEST_F(LayerTest, PushPropertiesCausesLayerPropertyChangedForOpacity) { |
TEST_F(LayerTest, |
PushPropsDoesntCauseLayerPropertyChangedDuringImplOnlyTransformAnim) { |
- scoped_refptr<Layer> test_layer = Layer::Create(); |
+ scoped_refptr<Layer> test_layer = Layer::Create(layer_settings_); |
scoped_ptr<LayerImpl> impl_layer = |
LayerImpl::Create(host_impl_.active_tree(), 1); |
@@ -755,7 +757,7 @@ TEST_F(LayerTest, |
TEST_F(LayerTest, |
PushPropsDoesntCauseLayerPropertyChangedDuringImplOnlyOpacityAnim) { |
- scoped_refptr<Layer> test_layer = Layer::Create(); |
+ scoped_refptr<Layer> test_layer = Layer::Create(layer_settings_); |
scoped_ptr<LayerImpl> impl_layer = |
LayerImpl::Create(host_impl_.active_tree(), 1); |
@@ -796,7 +798,7 @@ TEST_F(LayerTest, |
TEST_F(LayerTest, |
PushPropsDoesntCauseLayerPropertyChangedDuringImplOnlyFilterAnim) { |
- scoped_refptr<Layer> test_layer = Layer::Create(); |
+ scoped_refptr<Layer> test_layer = Layer::Create(layer_settings_); |
scoped_ptr<LayerImpl> impl_layer = |
LayerImpl::Create(host_impl_.active_tree(), 1); |
@@ -833,14 +835,15 @@ TEST_F(LayerTest, |
} |
TEST_F(LayerTest, MaskAndReplicaHasParent) { |
- scoped_refptr<Layer> parent = Layer::Create(); |
- scoped_refptr<Layer> child = Layer::Create(); |
- scoped_refptr<Layer> mask = Layer::Create(); |
- scoped_refptr<Layer> replica = Layer::Create(); |
- scoped_refptr<Layer> replica_mask = Layer::Create(); |
- scoped_refptr<Layer> mask_replacement = Layer::Create(); |
- scoped_refptr<Layer> replica_replacement = Layer::Create(); |
- scoped_refptr<Layer> replica_mask_replacement = Layer::Create(); |
+ scoped_refptr<Layer> parent = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> child = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> mask = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> replica = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> replica_mask = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> mask_replacement = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> replica_replacement = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> replica_mask_replacement = |
+ Layer::Create(layer_settings_); |
parent->AddChild(child); |
child->SetMaskLayer(mask.get()); |
@@ -868,7 +871,7 @@ TEST_F(LayerTest, MaskAndReplicaHasParent) { |
} |
TEST_F(LayerTest, CheckTranformIsInvertible) { |
- scoped_refptr<Layer> layer = Layer::Create(); |
+ scoped_refptr<Layer> layer = Layer::Create(layer_settings_); |
scoped_ptr<LayerImpl> impl_layer = |
LayerImpl::Create(host_impl_.active_tree(), 1); |
EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(1); |
@@ -899,7 +902,7 @@ TEST_F(LayerTest, CheckTranformIsInvertible) { |
} |
TEST_F(LayerTest, TranformIsInvertibleAnimation) { |
- scoped_refptr<Layer> layer = Layer::Create(); |
+ scoped_refptr<Layer> layer = Layer::Create(layer_settings_); |
scoped_ptr<LayerImpl> impl_layer = |
LayerImpl::Create(host_impl_.active_tree(), 1); |
EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(1); |
@@ -970,12 +973,18 @@ void AssertLayerTreeHostMatchesForSubtree(Layer* layer, LayerTreeHost* host) { |
AssertLayerTreeHostMatchesForSubtree(layer->replica_layer(), host); |
} |
-TEST(LayerLayerTreeHostTest, EnteringTree) { |
- scoped_refptr<Layer> parent = Layer::Create(); |
- scoped_refptr<Layer> child = Layer::Create(); |
- scoped_refptr<Layer> mask = Layer::Create(); |
- scoped_refptr<Layer> replica = Layer::Create(); |
- scoped_refptr<Layer> replica_mask = Layer::Create(); |
+class LayerLayerTreeHostTest : public testing::Test { |
+ public: |
+ protected: |
+ LayerSettings layer_settings_; |
+}; |
+ |
+TEST_F(LayerLayerTreeHostTest, EnteringTree) { |
+ scoped_refptr<Layer> parent = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> child = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> mask = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> replica = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> replica_mask = Layer::Create(layer_settings_); |
// Set up a detached tree of layers. The host pointer should be nil for these |
// layers. |
@@ -1001,8 +1010,8 @@ TEST(LayerLayerTreeHostTest, EnteringTree) { |
AssertLayerTreeHostMatchesForSubtree(parent.get(), nullptr); |
} |
-TEST(LayerLayerTreeHostTest, AddingLayerSubtree) { |
- scoped_refptr<Layer> parent = Layer::Create(); |
+TEST_F(LayerLayerTreeHostTest, AddingLayerSubtree) { |
+ scoped_refptr<Layer> parent = Layer::Create(layer_settings_); |
LayerTreeHostFactory factory; |
scoped_ptr<LayerTreeHost> layer_tree_host = factory.Create(); |
@@ -1012,16 +1021,16 @@ TEST(LayerLayerTreeHostTest, AddingLayerSubtree) { |
// Adding a subtree to a layer already associated with a host should set the |
// host pointer on all layers in that subtree. |
- scoped_refptr<Layer> child = Layer::Create(); |
- scoped_refptr<Layer> grand_child = Layer::Create(); |
+ scoped_refptr<Layer> child = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> grand_child = Layer::Create(layer_settings_); |
child->AddChild(grand_child); |
// Masks, replicas, and replica masks should pick up the new host too. |
- scoped_refptr<Layer> child_mask = Layer::Create(); |
+ scoped_refptr<Layer> child_mask = Layer::Create(layer_settings_); |
child->SetMaskLayer(child_mask.get()); |
- scoped_refptr<Layer> child_replica = Layer::Create(); |
+ scoped_refptr<Layer> child_replica = Layer::Create(layer_settings_); |
child->SetReplicaLayer(child_replica.get()); |
- scoped_refptr<Layer> child_replica_mask = Layer::Create(); |
+ scoped_refptr<Layer> child_replica_mask = Layer::Create(layer_settings_); |
child_replica->SetMaskLayer(child_replica_mask.get()); |
parent->AddChild(child); |
@@ -1030,12 +1039,12 @@ TEST(LayerLayerTreeHostTest, AddingLayerSubtree) { |
layer_tree_host->SetRootLayer(nullptr); |
} |
-TEST(LayerLayerTreeHostTest, ChangeHost) { |
- scoped_refptr<Layer> parent = Layer::Create(); |
- scoped_refptr<Layer> child = Layer::Create(); |
- scoped_refptr<Layer> mask = Layer::Create(); |
- scoped_refptr<Layer> replica = Layer::Create(); |
- scoped_refptr<Layer> replica_mask = Layer::Create(); |
+TEST_F(LayerLayerTreeHostTest, ChangeHost) { |
+ scoped_refptr<Layer> parent = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> child = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> mask = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> replica = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> replica_mask = Layer::Create(layer_settings_); |
// Same setup as the previous test. |
parent->AddChild(child); |
@@ -1061,12 +1070,12 @@ TEST(LayerLayerTreeHostTest, ChangeHost) { |
second_layer_tree_host->SetRootLayer(nullptr); |
} |
-TEST(LayerLayerTreeHostTest, ChangeHostInSubtree) { |
- scoped_refptr<Layer> first_parent = Layer::Create(); |
- scoped_refptr<Layer> first_child = Layer::Create(); |
- scoped_refptr<Layer> second_parent = Layer::Create(); |
- scoped_refptr<Layer> second_child = Layer::Create(); |
- scoped_refptr<Layer> second_grand_child = Layer::Create(); |
+TEST_F(LayerLayerTreeHostTest, ChangeHostInSubtree) { |
+ scoped_refptr<Layer> first_parent = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> first_child = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> second_parent = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> second_child = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> second_grand_child = Layer::Create(layer_settings_); |
// First put all children under the first parent and set the first host. |
first_parent->AddChild(first_child); |
@@ -1097,14 +1106,14 @@ TEST(LayerLayerTreeHostTest, ChangeHostInSubtree) { |
second_layer_tree_host->SetRootLayer(nullptr); |
} |
-TEST(LayerLayerTreeHostTest, ReplaceMaskAndReplicaLayer) { |
- scoped_refptr<Layer> parent = Layer::Create(); |
- scoped_refptr<Layer> mask = Layer::Create(); |
- scoped_refptr<Layer> replica = Layer::Create(); |
- scoped_refptr<Layer> mask_child = Layer::Create(); |
- scoped_refptr<Layer> replica_child = Layer::Create(); |
- scoped_refptr<Layer> mask_replacement = Layer::Create(); |
- scoped_refptr<Layer> replica_replacement = Layer::Create(); |
+TEST_F(LayerLayerTreeHostTest, ReplaceMaskAndReplicaLayer) { |
+ scoped_refptr<Layer> parent = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> mask = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> replica = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> mask_child = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> replica_child = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> mask_replacement = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> replica_replacement = Layer::Create(layer_settings_); |
parent->SetMaskLayer(mask.get()); |
parent->SetReplicaLayer(replica.get()); |
@@ -1131,9 +1140,9 @@ TEST(LayerLayerTreeHostTest, ReplaceMaskAndReplicaLayer) { |
layer_tree_host->SetRootLayer(nullptr); |
} |
-TEST(LayerLayerTreeHostTest, DestroyHostWithNonNullRootLayer) { |
- scoped_refptr<Layer> root = Layer::Create(); |
- scoped_refptr<Layer> child = Layer::Create(); |
+TEST_F(LayerLayerTreeHostTest, DestroyHostWithNonNullRootLayer) { |
+ scoped_refptr<Layer> root = Layer::Create(layer_settings_); |
+ scoped_refptr<Layer> child = Layer::Create(layer_settings_); |
root->AddChild(child); |
LayerTreeHostFactory factory; |
scoped_ptr<LayerTreeHost> layer_tree_host = factory.Create(); |
@@ -1152,15 +1161,15 @@ static bool AddTestAnimation(Layer* layer) { |
return layer->AddAnimation(animation.Pass()); |
} |
-TEST(LayerLayerTreeHostTest, ShouldNotAddAnimationWithoutAnimationRegistrar) { |
- scoped_refptr<Layer> layer = Layer::Create(); |
+TEST_F(LayerLayerTreeHostTest, ShouldNotAddAnimationWithoutAnimationRegistrar) { |
+ scoped_refptr<Layer> layer = Layer::Create(layer_settings_); |
// Case 1: without a LayerTreeHost and without an AnimationRegistrar, the |
// animation should not be accepted. |
EXPECT_FALSE(AddTestAnimation(layer.get())); |
scoped_ptr<AnimationRegistrar> registrar = AnimationRegistrar::Create(); |
- layer->layer_animation_controller()->SetAnimationRegistrar(registrar.get()); |
+ layer->RegisterForAnimations(registrar.get()); |
// Case 2: with an AnimationRegistrar, the animation should be accepted. |
EXPECT_TRUE(AddTestAnimation(layer.get())); |
@@ -1181,7 +1190,7 @@ TEST_F(LayerTest, SafeOpaqueBackgroundColor) { |
LayerTreeHostFactory factory; |
scoped_ptr<LayerTreeHost> layer_tree_host = factory.Create(); |
- scoped_refptr<Layer> layer = Layer::Create(); |
+ scoped_refptr<Layer> layer = Layer::Create(layer_settings_); |
layer_tree_host->SetRootLayer(layer); |
for (int contents_opaque = 0; contents_opaque < 2; ++contents_opaque) { |
@@ -1210,8 +1219,9 @@ TEST_F(LayerTest, SafeOpaqueBackgroundColor) { |
class DrawsContentChangeLayer : public Layer { |
public: |
- static scoped_refptr<DrawsContentChangeLayer> Create() { |
- return make_scoped_refptr(new DrawsContentChangeLayer()); |
+ static scoped_refptr<DrawsContentChangeLayer> Create( |
+ const LayerSettings& settings) { |
+ return make_scoped_refptr(new DrawsContentChangeLayer(settings)); |
} |
void SetLayerTreeHost(LayerTreeHost* host) override { |
@@ -1229,18 +1239,19 @@ class DrawsContentChangeLayer : public Layer { |
} |
private: |
- DrawsContentChangeLayer() : Layer(), fake_draws_content_(false) {} |
+ explicit DrawsContentChangeLayer(const LayerSettings& settings) |
+ : Layer(settings), fake_draws_content_(false) {} |
~DrawsContentChangeLayer() override {} |
bool fake_draws_content_; |
}; |
TEST_F(LayerTest, DrawsContentChangedInSetLayerTreeHost) { |
- scoped_refptr<Layer> root_layer = Layer::Create(); |
+ scoped_refptr<Layer> root_layer = Layer::Create(layer_settings_); |
scoped_refptr<DrawsContentChangeLayer> becomes_not_draws_content = |
- DrawsContentChangeLayer::Create(); |
+ DrawsContentChangeLayer::Create(layer_settings_); |
scoped_refptr<DrawsContentChangeLayer> becomes_draws_content = |
- DrawsContentChangeLayer::Create(); |
+ DrawsContentChangeLayer::Create(layer_settings_); |
root_layer->SetIsDrawable(true); |
becomes_not_draws_content->SetIsDrawable(true); |
becomes_not_draws_content->SetFakeDrawsContent(true); |
@@ -1259,7 +1270,7 @@ void ReceiveCopyOutputResult(int* result_count, |
} |
TEST_F(LayerTest, DedupesCopyOutputRequestsBySource) { |
- scoped_refptr<Layer> layer = Layer::Create(); |
+ scoped_refptr<Layer> layer = Layer::Create(layer_settings_); |
int result_count = 0; |
// Create identical requests without the source being set, and expect the |
@@ -1277,7 +1288,7 @@ TEST_F(LayerTest, DedupesCopyOutputRequestsBySource) { |
layer = nullptr; |
EXPECT_EQ(2, result_count); |
- layer = Layer::Create(); |
+ layer = Layer::Create(layer_settings_); |
result_count = 0; |
// Create identical requests, but this time the source is being set. Expect |