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

Unified Diff: cc/layers/layer_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: Layer GetLayerTree now directly uses LayerTree pointer. 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/layers/layer_unittest.cc
diff --git a/cc/layers/layer_unittest.cc b/cc/layers/layer_unittest.cc
index adc789400088ebb229c23f1374bba10f3b884bed..cd9f0d07478c4122f7377c2eaa6da82e06a97c03 100644
--- a/cc/layers/layer_unittest.cc
+++ b/cc/layers/layer_unittest.cc
@@ -56,48 +56,47 @@ using ::testing::_;
Mock::VerifyAndClearExpectations(layer_tree_host_.get()); \
} while (false)
-#define EXECUTE_AND_VERIFY_SUBTREE_CHANGED(code_to_test) \
- code_to_test; \
- root->layer_tree_host()->BuildPropertyTreesForTesting(); \
- EXPECT_TRUE(root->subtree_property_changed()); \
- EXPECT_TRUE(root->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \
- root.get())); \
- EXPECT_TRUE(child->subtree_property_changed()); \
- EXPECT_TRUE(child->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \
- child.get())); \
- EXPECT_TRUE(grand_child->subtree_property_changed()); \
- EXPECT_TRUE( \
- grand_child->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \
+#define EXECUTE_AND_VERIFY_SUBTREE_CHANGED(code_to_test) \
+ code_to_test; \
+ root->layer_tree_host()->BuildPropertyTreesForTesting(); \
+ EXPECT_TRUE(root->subtree_property_changed()); \
+ EXPECT_TRUE( \
+ root->GetLayerTree()->LayerNeedsPushPropertiesForTesting(root.get())); \
+ EXPECT_TRUE(child->subtree_property_changed()); \
+ EXPECT_TRUE( \
+ child->GetLayerTree()->LayerNeedsPushPropertiesForTesting(child.get())); \
+ EXPECT_TRUE(grand_child->subtree_property_changed()); \
+ EXPECT_TRUE(grand_child->GetLayerTree()->LayerNeedsPushPropertiesForTesting( \
+ grand_child.get()));
+
+#define EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET(code_to_test) \
+ code_to_test; \
+ EXPECT_FALSE(root->subtree_property_changed()); \
+ EXPECT_FALSE( \
+ root->GetLayerTree()->LayerNeedsPushPropertiesForTesting(root.get())); \
+ EXPECT_FALSE(child->subtree_property_changed()); \
+ EXPECT_FALSE( \
+ child->GetLayerTree()->LayerNeedsPushPropertiesForTesting(child.get())); \
+ EXPECT_FALSE(grand_child->subtree_property_changed()); \
+ EXPECT_FALSE( \
+ grand_child->GetLayerTree()->LayerNeedsPushPropertiesForTesting( \
grand_child.get()));
-#define EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET(code_to_test) \
- code_to_test; \
- EXPECT_FALSE(root->subtree_property_changed()); \
- EXPECT_FALSE(root->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \
- root.get())); \
- EXPECT_FALSE(child->subtree_property_changed()); \
- EXPECT_FALSE(child->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \
- child.get())); \
- EXPECT_FALSE(grand_child->subtree_property_changed()); \
- EXPECT_FALSE( \
- grand_child->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \
- grand_child.get()));
-
-#define EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(code_to_test) \
- code_to_test; \
- root->layer_tree_host()->BuildPropertyTreesForTesting(); \
- EXPECT_TRUE(root->layer_property_changed()); \
- EXPECT_FALSE(root->subtree_property_changed()); \
- EXPECT_TRUE(root->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \
- root.get())); \
- EXPECT_FALSE(child->layer_property_changed()); \
- EXPECT_FALSE(child->subtree_property_changed()); \
- EXPECT_FALSE(child->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \
- child.get())); \
- EXPECT_FALSE(grand_child->layer_property_changed()); \
- EXPECT_FALSE(grand_child->subtree_property_changed()); \
- EXPECT_FALSE( \
- grand_child->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \
+#define EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(code_to_test) \
+ code_to_test; \
+ root->layer_tree_host()->BuildPropertyTreesForTesting(); \
+ EXPECT_TRUE(root->layer_property_changed()); \
+ EXPECT_FALSE(root->subtree_property_changed()); \
+ EXPECT_TRUE( \
+ root->GetLayerTree()->LayerNeedsPushPropertiesForTesting(root.get())); \
+ EXPECT_FALSE(child->layer_property_changed()); \
+ EXPECT_FALSE(child->subtree_property_changed()); \
+ EXPECT_FALSE( \
+ child->GetLayerTree()->LayerNeedsPushPropertiesForTesting(child.get())); \
+ EXPECT_FALSE(grand_child->layer_property_changed()); \
+ EXPECT_FALSE(grand_child->subtree_property_changed()); \
+ EXPECT_FALSE( \
+ grand_child->GetLayerTree()->LayerNeedsPushPropertiesForTesting( \
grand_child.get()));
namespace cc {
@@ -140,17 +139,18 @@ class LayerSerializationTest : public testing::Test {
proto::LayerProperties props = layer_update.layers(0);
// The |dest| layer needs to be able to lookup the scroll and clip parents.
+ LayerTree* layer_tree = layer_tree_host_->GetLayerTree();
if (src->inputs_.scroll_parent)
- layer_tree_host_->RegisterLayer(src->inputs_.scroll_parent);
+ layer_tree->RegisterLayer(src->inputs_.scroll_parent);
if (src->scroll_children_) {
for (auto* child : *(src->scroll_children_))
- layer_tree_host_->RegisterLayer(child);
+ layer_tree->RegisterLayer(child);
}
if (src->inputs_.clip_parent)
- layer_tree_host_->RegisterLayer(src->inputs_.clip_parent);
+ layer_tree->RegisterLayer(src->inputs_.clip_parent);
if (src->clip_children_) {
for (auto* child : *(src->clip_children_))
- layer_tree_host_->RegisterLayer(child);
+ layer_tree->RegisterLayer(child);
}
// Reset the LayerTreeHost registration for the |src| layer so
// it can be re-used for the |dest| layer.
@@ -248,24 +248,24 @@ class LayerSerializationTest : public testing::Test {
// Cleanup scroll tree.
if (src->inputs_.scroll_parent)
- layer_tree_host_->UnregisterLayer(src->inputs_.scroll_parent);
+ layer_tree->UnregisterLayer(src->inputs_.scroll_parent);
src->inputs_.scroll_parent = nullptr;
dest->inputs_.scroll_parent = nullptr;
if (src->scroll_children_) {
for (auto* child : *(src->scroll_children_))
- layer_tree_host_->UnregisterLayer(child);
+ layer_tree->UnregisterLayer(child);
src->scroll_children_.reset();
dest->scroll_children_.reset();
}
// Cleanup clip tree.
if (src->inputs_.clip_parent)
- layer_tree_host_->UnregisterLayer(src->inputs_.clip_parent);
+ layer_tree->UnregisterLayer(src->inputs_.clip_parent);
src->inputs_.clip_parent = nullptr;
dest->inputs_.clip_parent = nullptr;
if (src->clip_children_) {
for (auto* child : *(src->clip_children_))
- layer_tree_host_->UnregisterLayer(child);
+ layer_tree->UnregisterLayer(child);
src->clip_children_.reset();
dest->clip_children_.reset();
}
@@ -1409,7 +1409,8 @@ TEST_F(LayerTest, DeleteRemovedScrollParent) {
EXPECT_SET_NEEDS_COMMIT(1, child2 = nullptr);
EXPECT_TRUE(
- layer_tree_host_->LayerNeedsPushPropertiesForTesting(child1.get()));
+ layer_tree_host_->GetLayerTree()->LayerNeedsPushPropertiesForTesting(
+ child1.get()));
EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(nullptr));
}
@@ -1439,7 +1440,8 @@ TEST_F(LayerTest, DeleteRemovedScrollChild) {
EXPECT_SET_NEEDS_COMMIT(1, child1 = nullptr);
EXPECT_TRUE(
- layer_tree_host_->LayerNeedsPushPropertiesForTesting(child2.get()));
+ layer_tree_host_->GetLayerTree()->LayerNeedsPushPropertiesForTesting(
+ child2.get()));
EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(nullptr));
}

Powered by Google App Engine
This is Rietveld 408576698