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

Unified Diff: cc/layers/layer_unittest.cc

Issue 2253143002: Revert of cc: Move data to LayerTree from LayerTreeHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@layer_tree_change
Patch Set: Created 4 years, 4 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
« no previous file with comments | « cc/layers/layer_proto_converter.h ('k') | cc/layers/painted_scrollbar_layer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer_unittest.cc
diff --git a/cc/layers/layer_unittest.cc b/cc/layers/layer_unittest.cc
index 81025657a321ba3dfcdd9d6756fb793f419b2546..02768a29925699f5d0ef13bb3176577da0e15f26 100644
--- a/cc/layers/layer_unittest.cc
+++ b/cc/layers/layer_unittest.cc
@@ -49,11 +49,11 @@
using ::testing::StrictMock;
using ::testing::_;
-#define EXPECT_SET_NEEDS_FULL_TREE_SYNC(expect, code_to_test) \
- do { \
- EXPECT_CALL(*layer_tree_, SetNeedsFullTreeSync()).Times((expect)); \
- code_to_test; \
- Mock::VerifyAndClearExpectations(layer_tree_); \
+#define EXPECT_SET_NEEDS_FULL_TREE_SYNC(expect, code_to_test) \
+ do { \
+ EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times((expect)); \
+ code_to_test; \
+ Mock::VerifyAndClearExpectations(layer_tree_host_.get()); \
} while (false)
#define EXECUTE_AND_VERIFY_SUBTREE_CHANGED(code_to_test) \
@@ -888,31 +888,18 @@
namespace {
-class MockLayerTree : public LayerTree {
- public:
- MockLayerTree(std::unique_ptr<AnimationHost> animation_host,
- LayerTreeHost* layer_tree_host)
- : LayerTree(std::move(animation_host), layer_tree_host) {}
- ~MockLayerTree() override {}
-
- MOCK_METHOD0(SetNeedsFullTreeSync, void());
-};
-
class MockLayerTreeHost : public LayerTreeHost {
public:
MockLayerTreeHost(LayerTreeHostSingleThreadClient* single_thread_client,
LayerTreeHost::InitParams* params)
- : LayerTreeHost(
- params,
- CompositorMode::SINGLE_THREADED,
- base::MakeUnique<MockLayerTree>(std::move(params->animation_host),
- this)) {
+ : LayerTreeHost(params, CompositorMode::SINGLE_THREADED) {
InitializeSingleThreaded(single_thread_client,
base::ThreadTaskRunnerHandle::Get(), nullptr);
}
MOCK_METHOD0(SetNeedsCommit, void());
MOCK_METHOD0(SetNeedsUpdateLayers, void());
+ MOCK_METHOD0(SetNeedsFullTreeSync, void());
};
class LayerTest : public testing::Test {
@@ -942,14 +929,11 @@
layer_tree_host_.reset(
new StrictMock<MockLayerTreeHost>(&single_thread_client_, &params));
- layer_tree_ = static_cast<StrictMock<MockLayerTree>*>(
- layer_tree_host_->GetLayerTree());
}
void TearDown() override {
Mock::VerifyAndClearExpectations(layer_tree_host_.get());
- Mock::VerifyAndClearExpectations(layer_tree_);
- EXPECT_CALL(*layer_tree_, SetNeedsFullTreeSync()).Times(AnyNumber());
+ EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(AnyNumber());
parent_ = nullptr;
child1_ = nullptr;
child2_ = nullptr;
@@ -958,9 +942,8 @@
grand_child2_ = nullptr;
grand_child3_ = nullptr;
- layer_tree_->SetRootLayer(nullptr);
+ layer_tree_host_->SetRootLayer(nullptr);
layer_tree_host_ = nullptr;
- layer_tree_ = nullptr;
}
void VerifyTestTreeInitialState() const {
@@ -994,8 +977,8 @@
grand_child2_ = Layer::Create();
grand_child3_ = Layer::Create();
- EXPECT_CALL(*layer_tree_, SetNeedsFullTreeSync()).Times(AnyNumber());
- layer_tree_->SetRootLayer(parent_);
+ EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(AnyNumber());
+ layer_tree_host_->SetRootLayer(parent_);
parent_->AddChild(child1_);
parent_->AddChild(child2_);
@@ -1004,7 +987,7 @@
child1_->AddChild(grand_child2_);
child2_->AddChild(grand_child3_);
- Mock::VerifyAndClearExpectations(layer_tree_);
+ Mock::VerifyAndClearExpectations(layer_tree_host_.get());
VerifyTestTreeInitialState();
}
@@ -1017,7 +1000,6 @@
StubLayerTreeHostSingleThreadClient single_thread_client_;
FakeLayerTreeHostClient fake_client_;
std::unique_ptr<StrictMock<MockLayerTreeHost>> layer_tree_host_;
- StrictMock<MockLayerTree>* layer_tree_;
scoped_refptr<Layer> parent_;
scoped_refptr<Layer> child1_;
scoped_refptr<Layer> child2_;
@@ -1044,7 +1026,7 @@
}
TEST_F(LayerTest, LayerPropertyChangedForSubtree) {
- EXPECT_CALL(*layer_tree_, SetNeedsFullTreeSync()).Times(AtLeast(1));
+ EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(AtLeast(1));
scoped_refptr<Layer> root = Layer::Create();
scoped_refptr<Layer> child = Layer::Create();
scoped_refptr<Layer> child2 = Layer::Create();
@@ -1052,7 +1034,7 @@
scoped_refptr<Layer> dummy_layer1 = Layer::Create();
scoped_refptr<Layer> dummy_layer2 = Layer::Create();
- layer_tree_->SetRootLayer(root);
+ layer_tree_host_->SetRootLayer(root);
root->AddChild(child);
root->AddChild(child2);
child->AddChild(grand_child);
@@ -1074,7 +1056,7 @@
std::unique_ptr<LayerImpl> dummy_layer2_impl =
LayerImpl::Create(host_impl_.active_tree(), dummy_layer2->id());
- EXPECT_CALL(*layer_tree_, SetNeedsFullTreeSync()).Times(1);
+ EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(1);
EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetMaskLayer(dummy_layer1.get()));
EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET(
root->PushPropertiesTo(root_impl.get());
@@ -1099,7 +1081,7 @@
child2->PushPropertiesTo(child2_impl.get());
grand_child->PushPropertiesTo(grand_child_impl.get()));
- EXPECT_CALL(*layer_tree_, SetNeedsFullTreeSync()).Times(1);
+ EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(1);
EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetReplicaLayer(dummy_layer2.get()));
EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET(
root->PushPropertiesTo(root_impl.get());
@@ -1179,7 +1161,7 @@
gfx::PointF arbitrary_point_f = gfx::PointF(0.125f, 0.25f);
EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1);
root->SetPosition(arbitrary_point_f);
- TransformNode* node = layer_tree_->property_trees()->transform_tree.Node(
+ TransformNode* node = layer_tree_host_->property_trees()->transform_tree.Node(
root->transform_tree_index());
EXPECT_TRUE(node->transform_changed);
EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET(
@@ -1187,33 +1169,33 @@
child->PushPropertiesTo(child_impl.get());
child2->PushPropertiesTo(child2_impl.get());
grand_child->PushPropertiesTo(grand_child_impl.get());
- layer_tree_->property_trees()->ResetAllChangeTracking());
+ layer_tree_host_->property_trees()->ResetAllChangeTracking());
EXPECT_FALSE(node->transform_changed);
EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1);
child->SetPosition(arbitrary_point_f);
- node = layer_tree_->property_trees()->transform_tree.Node(
+ node = layer_tree_host_->property_trees()->transform_tree.Node(
child->transform_tree_index());
EXPECT_TRUE(node->transform_changed);
// child2 is not in the subtree of child, but its scroll parent is. So, its
// to_screen will be effected by change in position of child2.
- layer_tree_->property_trees()->transform_tree.UpdateTransforms(
+ layer_tree_host_->property_trees()->transform_tree.UpdateTransforms(
child2->transform_tree_index());
- node = layer_tree_->property_trees()->transform_tree.Node(
+ node = layer_tree_host_->property_trees()->transform_tree.Node(
child2->transform_tree_index());
EXPECT_TRUE(node->transform_changed);
EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET(
child->PushPropertiesTo(child_impl.get());
grand_child->PushPropertiesTo(grand_child_impl.get());
- layer_tree_->property_trees()->ResetAllChangeTracking());
- node = layer_tree_->property_trees()->transform_tree.Node(
+ layer_tree_host_->property_trees()->ResetAllChangeTracking());
+ node = layer_tree_host_->property_trees()->transform_tree.Node(
child->transform_tree_index());
EXPECT_FALSE(node->transform_changed);
gfx::Point3F arbitrary_point_3f = gfx::Point3F(0.125f, 0.25f, 0.f);
EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1);
root->SetTransformOrigin(arbitrary_point_3f);
- node = layer_tree_->property_trees()->transform_tree.Node(
+ node = layer_tree_host_->property_trees()->transform_tree.Node(
root->transform_tree_index());
EXPECT_TRUE(node->transform_changed);
EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET(
@@ -1221,13 +1203,13 @@
child->PushPropertiesTo(child_impl.get());
child2->PushPropertiesTo(child2_impl.get());
grand_child->PushPropertiesTo(grand_child_impl.get());
- layer_tree_->property_trees()->ResetAllChangeTracking());
+ layer_tree_host_->property_trees()->ResetAllChangeTracking());
gfx::Transform arbitrary_transform;
arbitrary_transform.Scale3d(0.1f, 0.2f, 0.3f);
EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1);
root->SetTransform(arbitrary_transform);
- node = layer_tree_->property_trees()->transform_tree.Node(
+ node = layer_tree_host_->property_trees()->transform_tree.Node(
root->transform_tree_index());
EXPECT_TRUE(node->transform_changed);
}
@@ -1240,7 +1222,7 @@
ASSERT_EQ(0U, parent->children().size());
EXPECT_FALSE(child->parent());
- EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_->SetRootLayer(parent));
+ EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(parent));
EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, parent->AddChild(child));
ASSERT_EQ(1U, parent->children().size());
@@ -1252,12 +1234,12 @@
}
TEST_F(LayerTest, AddSameChildTwice) {
- EXPECT_CALL(*layer_tree_, SetNeedsFullTreeSync()).Times(AtLeast(1));
+ EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(AtLeast(1));
scoped_refptr<Layer> parent = Layer::Create();
scoped_refptr<Layer> child = Layer::Create();
- layer_tree_->SetRootLayer(parent);
+ layer_tree_host_->SetRootLayer(parent);
ASSERT_EQ(0u, parent->children().size());
@@ -1277,7 +1259,7 @@
scoped_refptr<Layer> child3 = Layer::Create();
scoped_refptr<Layer> child4 = Layer::Create();
- EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_->SetRootLayer(parent));
+ EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(parent));
ASSERT_EQ(0U, parent->children().size());
@@ -1312,7 +1294,7 @@
EXPECT_EQ(child4, parent->children()[3]);
EXPECT_EQ(parent.get(), child4->parent());
- EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_->SetRootLayer(nullptr));
+ EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(nullptr));
}
TEST_F(LayerTest, InsertChildPastEndOfList) {
@@ -1341,7 +1323,7 @@
scoped_refptr<Layer> child1 = Layer::Create();
scoped_refptr<Layer> child2 = Layer::Create();
- EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_->SetRootLayer(parent));
+ EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(parent));
ASSERT_EQ(0U, parent->children().size());
@@ -1361,7 +1343,7 @@
EXPECT_EQ(child2, parent->children()[0]);
EXPECT_EQ(child1, parent->children()[1]);
- EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_->SetRootLayer(nullptr));
+ EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(nullptr));
}
TEST_F(LayerTest, ReplaceChildWithNewChild) {
@@ -1418,7 +1400,7 @@
scoped_refptr<Layer> child1 = Layer::Create();
scoped_refptr<Layer> child2 = Layer::Create();
- EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_->SetRootLayer(parent));
+ EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(parent));
ASSERT_EQ(0U, parent->children().size());
@@ -1437,9 +1419,11 @@
EXPECT_SET_NEEDS_COMMIT(1, child2 = nullptr);
- EXPECT_TRUE(layer_tree_->LayerNeedsPushPropertiesForTesting(child1.get()));
-
- EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_->SetRootLayer(nullptr));
+ EXPECT_TRUE(
+ layer_tree_host_->GetLayerTree()->LayerNeedsPushPropertiesForTesting(
+ child1.get()));
+
+ EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(nullptr));
}
TEST_F(LayerTest, DeleteRemovedScrollChild) {
@@ -1447,7 +1431,7 @@
scoped_refptr<Layer> child1 = Layer::Create();
scoped_refptr<Layer> child2 = Layer::Create();
- EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_->SetRootLayer(parent));
+ EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(parent));
ASSERT_EQ(0U, parent->children().size());
@@ -1466,9 +1450,11 @@
EXPECT_SET_NEEDS_COMMIT(1, child1 = nullptr);
- EXPECT_TRUE(layer_tree_->LayerNeedsPushPropertiesForTesting(child2.get()));
-
- EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_->SetRootLayer(nullptr));
+ EXPECT_TRUE(
+ layer_tree_host_->GetLayerTree()->LayerNeedsPushPropertiesForTesting(
+ child2.get()));
+
+ EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(nullptr));
}
TEST_F(LayerTest, ReplaceChildWithSameChild) {
@@ -1477,7 +1463,7 @@
// SetNeedsFullTreeSync / SetNeedsCommit should not be called because its the
// same child.
EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(0);
- EXPECT_CALL(*layer_tree_, SetNeedsFullTreeSync()).Times(0);
+ EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(0);
parent_->ReplaceChild(child2_.get(), child2_);
VerifyTestTreeInitialState();
@@ -1512,7 +1498,8 @@
EXPECT_EQ(old_parent.get(), child1->parent());
EXPECT_FALSE(child2->parent());
- EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_->SetRootLayer(new_parent));
+ EXPECT_SET_NEEDS_FULL_TREE_SYNC(
+ 1, layer_tree_host_->SetRootLayer(new_parent));
EXPECT_SET_NEEDS_FULL_TREE_SYNC(
AtLeast(1), new_parent->SetChildren(new_children));
@@ -1521,7 +1508,7 @@
EXPECT_EQ(new_parent.get(), child1->parent());
EXPECT_EQ(new_parent.get(), child2->parent());
- EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_->SetRootLayer(nullptr));
+ EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(nullptr));
}
TEST_F(LayerTest, HasAncestor) {
@@ -1549,7 +1536,7 @@
CreateSimpleTestTree();
// For this test we don't care about SetNeedsFullTreeSync calls.
- EXPECT_CALL(*layer_tree_, SetNeedsFullTreeSync()).Times(AnyNumber());
+ EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(AnyNumber());
scoped_refptr<Layer> child4 = Layer::Create();
@@ -1607,7 +1594,8 @@
// SetNeedsDisplay.
scoped_refptr<Layer> test_layer = Layer::Create();
- EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_->SetRootLayer(test_layer));
+ EXPECT_SET_NEEDS_FULL_TREE_SYNC(
+ 1, layer_tree_host_->SetRootLayer(test_layer));
EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetIsDrawable(true));
gfx::Size test_bounds = gfx::Size(501, 508);
@@ -1658,7 +1646,8 @@
TEST_F(LayerTest, TestSettingMainThreadScrollingReason) {
scoped_refptr<Layer> test_layer = Layer::Create();
- EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_->SetRootLayer(test_layer));
+ EXPECT_SET_NEEDS_FULL_TREE_SYNC(1,
+ layer_tree_host_->SetRootLayer(test_layer));
EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetIsDrawable(true));
// sanity check of initial test condition
@@ -1708,7 +1697,8 @@
TEST_F(LayerTest, CheckPropertyChangeCausesCorrectBehavior) {
scoped_refptr<Layer> test_layer = Layer::Create();
- EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_->SetRootLayer(test_layer));
+ 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();
@@ -1759,7 +1749,7 @@
EXPECT_FALSE(test_layer->NeedsDisplayForTesting());
// As layers are removed from the tree, they will cause a tree sync.
- EXPECT_CALL(*layer_tree_, SetNeedsFullTreeSync()).Times((AnyNumber()));
+ EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times((AnyNumber()));
}
TEST_F(LayerTest, PushPropertiesAccumulatesUpdateRect) {
@@ -1767,7 +1757,8 @@
std::unique_ptr<LayerImpl> impl_layer =
LayerImpl::Create(host_impl_.active_tree(), 1);
- EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_->SetRootLayer(test_layer));
+ EXPECT_SET_NEEDS_FULL_TREE_SYNC(1,
+ layer_tree_host_->SetRootLayer(test_layer));
host_impl_.active_tree()->SetRootLayerForTesting(std::move(impl_layer));
host_impl_.active_tree()->BuildLayerListForTesting();
@@ -1798,7 +1789,8 @@
std::unique_ptr<LayerImpl> impl_layer =
LayerImpl::Create(host_impl_.active_tree(), 1);
- EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_->SetRootLayer(test_layer));
+ EXPECT_SET_NEEDS_FULL_TREE_SYNC(1,
+ layer_tree_host_->SetRootLayer(test_layer));
gfx::Transform transform;
transform.Rotate(45.0);
@@ -1816,7 +1808,8 @@
std::unique_ptr<LayerImpl> impl_layer =
LayerImpl::Create(host_impl_.active_tree(), 1);
- EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_->SetRootLayer(test_layer));
+ EXPECT_SET_NEEDS_FULL_TREE_SYNC(1,
+ layer_tree_host_->SetRootLayer(test_layer));
EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetOpacity(0.5f));
@@ -1922,16 +1915,15 @@
LayerTreeHostFactory factory;
std::unique_ptr<LayerTreeHost> layer_tree_host = factory.Create();
- LayerTree* layer_tree = layer_tree_host->GetLayerTree();
// Setting the root layer should set the host pointer for all layers in the
// tree.
- layer_tree->SetRootLayer(parent.get());
+ layer_tree_host->SetRootLayer(parent.get());
AssertLayerTreeHostMatchesForSubtree(parent.get(), layer_tree_host.get());
// Clearing the root layer should also clear out the host pointers for all
// layers in the tree.
- layer_tree->SetRootLayer(nullptr);
+ layer_tree_host->SetRootLayer(nullptr);
AssertLayerTreeHostMatchesForSubtree(parent.get(), nullptr);
}
@@ -1940,9 +1932,8 @@
scoped_refptr<Layer> parent = Layer::Create();
LayerTreeHostFactory factory;
std::unique_ptr<LayerTreeHost> layer_tree_host = factory.Create();
- LayerTree* layer_tree = layer_tree_host->GetLayerTree();
-
- layer_tree->SetRootLayer(parent.get());
+
+ layer_tree_host->SetRootLayer(parent.get());
EXPECT_EQ(parent->layer_tree_host(), layer_tree_host.get());
@@ -1963,7 +1954,7 @@
parent->AddChild(child);
AssertLayerTreeHostMatchesForSubtree(parent.get(), layer_tree_host.get());
- layer_tree->SetRootLayer(nullptr);
+ layer_tree_host->SetRootLayer(nullptr);
}
TEST_F(LayerLayerTreeHostTest, ChangeHost) {
@@ -1981,7 +1972,7 @@
LayerTreeHostFactory factory;
std::unique_ptr<LayerTreeHost> first_layer_tree_host = factory.Create();
- first_layer_tree_host->GetLayerTree()->SetRootLayer(parent.get());
+ first_layer_tree_host->SetRootLayer(parent.get());
AssertLayerTreeHostMatchesForSubtree(parent.get(),
first_layer_tree_host.get());
@@ -1989,12 +1980,12 @@
// Now re-root the tree to a new host (simulating what we do on a context lost
// event). This should update the host pointers for all layers in the tree.
std::unique_ptr<LayerTreeHost> second_layer_tree_host = factory.Create();
- second_layer_tree_host->GetLayerTree()->SetRootLayer(parent.get());
+ second_layer_tree_host->SetRootLayer(parent.get());
AssertLayerTreeHostMatchesForSubtree(parent.get(),
second_layer_tree_host.get());
- second_layer_tree_host->GetLayerTree()->SetRootLayer(nullptr);
+ second_layer_tree_host->SetRootLayer(nullptr);
}
TEST_F(LayerLayerTreeHostTest, ChangeHostInSubtree) {
@@ -2011,7 +2002,7 @@
LayerTreeHostFactory factory;
std::unique_ptr<LayerTreeHost> first_layer_tree_host = factory.Create();
- first_layer_tree_host->GetLayerTree()->SetRootLayer(first_parent.get());
+ first_layer_tree_host->SetRootLayer(first_parent.get());
AssertLayerTreeHostMatchesForSubtree(first_parent.get(),
first_layer_tree_host.get());
@@ -2019,7 +2010,7 @@
// Now reparent the subtree starting at second_child to a layer in a different
// tree.
std::unique_ptr<LayerTreeHost> second_layer_tree_host = factory.Create();
- second_layer_tree_host->GetLayerTree()->SetRootLayer(second_parent.get());
+ second_layer_tree_host->SetRootLayer(second_parent.get());
second_parent->AddChild(second_child);
@@ -2029,8 +2020,8 @@
second_grand_child->layer_tree_host());
// Test over, cleanup time.
- first_layer_tree_host->GetLayerTree()->SetRootLayer(nullptr);
- second_layer_tree_host->GetLayerTree()->SetRootLayer(nullptr);
+ first_layer_tree_host->SetRootLayer(nullptr);
+ second_layer_tree_host->SetRootLayer(nullptr);
}
TEST_F(LayerLayerTreeHostTest, ReplaceMaskAndReplicaLayer) {
@@ -2049,7 +2040,7 @@
LayerTreeHostFactory factory;
std::unique_ptr<LayerTreeHost> layer_tree_host = factory.Create();
- layer_tree_host->GetLayerTree()->SetRootLayer(parent.get());
+ layer_tree_host->SetRootLayer(parent.get());
AssertLayerTreeHostMatchesForSubtree(parent.get(), layer_tree_host.get());
@@ -2064,7 +2055,7 @@
EXPECT_EQ(nullptr, replica_child->layer_tree_host());
// Test over, cleanup time.
- layer_tree_host->GetLayerTree()->SetRootLayer(nullptr);
+ layer_tree_host->SetRootLayer(nullptr);
}
TEST_F(LayerLayerTreeHostTest, DestroyHostWithNonNullRootLayer) {
@@ -2073,16 +2064,15 @@
root->AddChild(child);
LayerTreeHostFactory factory;
std::unique_ptr<LayerTreeHost> layer_tree_host = factory.Create();
- layer_tree_host->GetLayerTree()->SetRootLayer(root);
+ layer_tree_host->SetRootLayer(root);
}
TEST_F(LayerTest, SafeOpaqueBackgroundColor) {
LayerTreeHostFactory factory;
std::unique_ptr<LayerTreeHost> layer_tree_host = factory.Create();
- LayerTree* layer_tree = layer_tree_host->GetLayerTree();
scoped_refptr<Layer> layer = Layer::Create();
- layer_tree->SetRootLayer(layer);
+ layer_tree_host->SetRootLayer(layer);
for (int contents_opaque = 0; contents_opaque < 2; ++contents_opaque) {
for (int layer_opaque = 0; layer_opaque < 2; ++layer_opaque) {
@@ -2090,10 +2080,10 @@
layer->SetContentsOpaque(!!contents_opaque);
layer->SetBackgroundColor(layer_opaque ? SK_ColorRED
: SK_ColorTRANSPARENT);
- layer_tree->set_background_color(host_opaque ? SK_ColorRED
- : SK_ColorTRANSPARENT);
-
- layer_tree->property_trees()->needs_rebuild = true;
+ layer_tree_host->set_background_color(
+ host_opaque ? SK_ColorRED : SK_ColorTRANSPARENT);
+
+ layer_tree_host->property_trees()->needs_rebuild = true;
layer_tree_host->BuildPropertyTreesForTesting();
SkColor safe_color = layer->SafeOpaqueBackgroundColor();
if (contents_opaque) {
@@ -2226,7 +2216,7 @@
TEST_F(LayerTest, AnimationSchedulesLayerUpdate) {
scoped_refptr<Layer> layer = Layer::Create();
- EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_->SetRootLayer(layer));
+ EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(layer));
LayerInternalsForTest layer_internals(layer.get());
@@ -2542,7 +2532,8 @@
std::unique_ptr<LayerImpl> impl_layer =
LayerImpl::Create(host_impl_.active_tree(), 1);
- EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_->SetRootLayer(test_layer));
+ EXPECT_SET_NEEDS_FULL_TREE_SYNC(1,
+ layer_tree_host_->SetRootLayer(test_layer));
EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(2);
« no previous file with comments | « cc/layers/layer_proto_converter.h ('k') | cc/layers/painted_scrollbar_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698