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

Unified Diff: cc/trees/layer_tree_host_unittest.cc

Issue 2612093002: Build mapping from element id to transform/effect nodes. (Closed)
Patch Set: Sync to head. Created 3 years, 11 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 | « no previous file | cc/trees/property_tree.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5e58148f9db03b81fc5af4b916472398a081e627..820562a3d484c8d90cb382d339a93b329ff91448 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -30,7 +30,6 @@
#include "cc/output/copy_output_result.h"
#include "cc/output/output_surface.h"
#include "cc/output/swap_promise.h"
-#include "cc/playback/display_item_list_settings.h"
#include "cc/quads/draw_quad.h"
#include "cc/quads/render_pass_draw_quad.h"
#include "cc/quads/tile_draw_quad.h"
@@ -918,6 +917,93 @@ class LayerTreeHostTestPushNodeOwnerToNodeIdMap : public LayerTreeHostTest {
// engine will never build PropertyTrees in LTH remote. See crbug.com/655795.
SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushNodeOwnerToNodeIdMap);
+class LayerTreeHostTestPushElementIdToNodeIdMap : public LayerTreeHostTest {
+ protected:
+ void SetupTree() override {
+ root_ = Layer::Create();
+ child_ = Layer::Create();
+ child_->SetElementId(kTestElementId);
+ root_->AddChild(child_);
+ layer_tree()->SetRootLayer(root_);
+ LayerTreeHostTest::SetupTree();
+ }
+
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
+
+ void DidCommit() override {
+ switch (layer_tree_host()->SourceFrameNumber()) {
+ case 1:
+ child_->SetForceRenderSurfaceForTesting(true);
+ break;
+ case 2:
+ child_->SetForceRenderSurfaceForTesting(false);
+ break;
+ }
+ }
+
+ void CommitCompleteOnThread(LayerTreeHostImpl* impl) override {
+ PropertyTrees* property_trees = impl->sync_tree()->property_trees();
+ LayerImpl* child_impl_ = impl->sync_tree()->LayerById(child_->id());
+ switch (impl->sync_tree()->source_frame_number()) {
+ case 0:
+ EXPECT_EQ(2U, child_impl_->layer_tree_impl()
+ ->property_trees()
+ ->transform_tree.size());
+ EXPECT_EQ(2U, child_impl_->layer_tree_impl()
+ ->property_trees()
+ ->effect_tree.size());
+ EXPECT_TRUE(property_trees->element_id_to_transform_node_index.find(
+ kTestElementId) ==
+ property_trees->element_id_to_transform_node_index.end());
+ EXPECT_TRUE(property_trees->element_id_to_effect_node_index.find(
+ kTestElementId) ==
+ property_trees->element_id_to_effect_node_index.end());
+ break;
+ case 1:
+ EXPECT_EQ(3U, child_impl_->layer_tree_impl()
+ ->property_trees()
+ ->transform_tree.size());
+ EXPECT_EQ(3U, child_impl_->layer_tree_impl()
+ ->property_trees()
+ ->effect_tree.size());
+ EXPECT_EQ(
+ 2,
+ property_trees->element_id_to_transform_node_index[kTestElementId]);
+ EXPECT_EQ(
+ 2, property_trees->element_id_to_effect_node_index[kTestElementId]);
+ break;
+ case 2:
+ EXPECT_EQ(2U, child_impl_->layer_tree_impl()
+ ->property_trees()
+ ->transform_tree.size());
+ EXPECT_EQ(2U, child_impl_->layer_tree_impl()
+ ->property_trees()
+ ->effect_tree.size());
+ EXPECT_TRUE(property_trees->element_id_to_transform_node_index.find(
+ kTestElementId) ==
+ property_trees->element_id_to_transform_node_index.end());
+ EXPECT_TRUE(property_trees->element_id_to_effect_node_index.find(
+ kTestElementId) ==
+ property_trees->element_id_to_effect_node_index.end());
+ break;
+ }
+ EndTest();
+ }
+
+ void AfterTest() override {}
+
+ private:
+ const ElementId kTestElementId = ElementId(42, 8118);
+
+ scoped_refptr<Layer> root_;
+ scoped_refptr<Layer> child_;
+};
+
+// Validates that, for a layer with a compositor element id set on it, mappings
+// from compositor element id to transform/effect node indexes are created as
+// part of building a layer's property tree and are present on the impl thread.
+SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushElementIdToNodeIdMap);
+
class LayerTreeHostTestSurfaceDamage : public LayerTreeHostTest {
protected:
void SetupTree() override {
« no previous file with comments | « no previous file | cc/trees/property_tree.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698