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

Side by Side Diff: cc/layers/layer_unittest.cc

Issue 2099743002: cc: Move background filters to the effect tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ' Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « cc/layers/layer_impl_unittest.cc ('k') | cc/layers/render_surface_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layers/layer.h" 5 #include "cc/layers/layer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/threading/thread_task_runner_handle.h" 9 #include "base/threading/thread_task_runner_handle.h"
10 #include "cc/animation/animation_host.h" 10 #include "cc/animation/animation_host.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 EXPECT_FALSE(root->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \ 73 EXPECT_FALSE(root->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \
74 root.get())); \ 74 root.get())); \
75 EXPECT_FALSE(child->subtree_property_changed()); \ 75 EXPECT_FALSE(child->subtree_property_changed()); \
76 EXPECT_FALSE(child->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \ 76 EXPECT_FALSE(child->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \
77 child.get())); \ 77 child.get())); \
78 EXPECT_FALSE(grand_child->subtree_property_changed()); \ 78 EXPECT_FALSE(grand_child->subtree_property_changed()); \
79 EXPECT_FALSE( \ 79 EXPECT_FALSE( \
80 grand_child->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \ 80 grand_child->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \
81 grand_child.get())); 81 grand_child.get()));
82 82
83 #define EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(code_to_test) \
84 code_to_test; \
85 root->layer_tree_host()->BuildPropertyTreesForTesting(); \
86 EXPECT_TRUE(root->layer_property_changed()); \
87 EXPECT_FALSE(root->subtree_property_changed()); \
88 EXPECT_TRUE(root->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \
89 root.get())); \
90 EXPECT_FALSE(child->layer_property_changed()); \
91 EXPECT_FALSE(child->subtree_property_changed()); \
92 EXPECT_FALSE(child->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \
93 child.get())); \
94 EXPECT_FALSE(grand_child->layer_property_changed()); \
95 EXPECT_FALSE(grand_child->subtree_property_changed()); \
96 EXPECT_FALSE( \
97 grand_child->layer_tree_host()->LayerNeedsPushPropertiesForTesting( \
98 grand_child.get()));
99
83 namespace cc { 100 namespace cc {
84 101
85 // This class is a friend of Layer, and is used as a wrapper for all the tests 102 // This class is a friend of Layer, and is used as a wrapper for all the tests
86 // related to proto serialization. This is done so that it is unnecessary to 103 // related to proto serialization. This is done so that it is unnecessary to
87 // add FRIEND_TEST_ALL_PREFIXES in //cc/layers/layer.h for all the tests. 104 // add FRIEND_TEST_ALL_PREFIXES in //cc/layers/layer.h for all the tests.
88 // It is in the cc namespace so that it can be a friend of Layer. 105 // It is in the cc namespace so that it can be a friend of Layer.
89 // The tests still have helpful names, and a test with the name FooBar would 106 // The tests still have helpful names, and a test with the name FooBar would
90 // have a wrapper method in this class called RunFooBarTest. 107 // have a wrapper method in this class called RunFooBarTest.
91 class LayerSerializationTest : public testing::Test { 108 class LayerSerializationTest : public testing::Test {
92 public: 109 public:
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 FilterOperations arbitrary_filters; 1120 FilterOperations arbitrary_filters;
1104 arbitrary_filters.Append(FilterOperation::CreateOpacityFilter(0.5f)); 1121 arbitrary_filters.Append(FilterOperation::CreateOpacityFilter(0.5f));
1105 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1); 1122 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1);
1106 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetFilters(arbitrary_filters)); 1123 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetFilters(arbitrary_filters));
1107 EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET( 1124 EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET(
1108 root->PushPropertiesTo(root_impl.get()); 1125 root->PushPropertiesTo(root_impl.get());
1109 child->PushPropertiesTo(child_impl.get()); 1126 child->PushPropertiesTo(child_impl.get());
1110 child2->PushPropertiesTo(child2_impl.get()); 1127 child2->PushPropertiesTo(child2_impl.get());
1111 grand_child->PushPropertiesTo(grand_child_impl.get())); 1128 grand_child->PushPropertiesTo(grand_child_impl.get()));
1112 1129
1130 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1);
1131 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(
1132 root->SetBackgroundFilters(arbitrary_filters));
1133 EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET(
1134 root->PushPropertiesTo(root_impl.get()));
1135
1113 gfx::PointF arbitrary_point_f = gfx::PointF(0.125f, 0.25f); 1136 gfx::PointF arbitrary_point_f = gfx::PointF(0.125f, 0.25f);
1114 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1); 1137 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1);
1115 root->SetPosition(arbitrary_point_f); 1138 root->SetPosition(arbitrary_point_f);
1116 TransformNode* node = layer_tree_host_->property_trees()->transform_tree.Node( 1139 TransformNode* node = layer_tree_host_->property_trees()->transform_tree.Node(
1117 root->transform_tree_index()); 1140 root->transform_tree_index());
1118 EXPECT_TRUE(node->data.transform_changed); 1141 EXPECT_TRUE(node->data.transform_changed);
1119 EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET( 1142 EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET(
1120 root->PushPropertiesTo(root_impl.get()); 1143 root->PushPropertiesTo(root_impl.get());
1121 child->PushPropertiesTo(child_impl.get()); 1144 child->PushPropertiesTo(child_impl.get());
1122 child2->PushPropertiesTo(child2_impl.get()); 1145 child2->PushPropertiesTo(child2_impl.get());
(...skipping 1370 matching lines...) Expand 10 before | Expand all | Expand 10 after
2493 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties()); 2516 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties());
2494 2517
2495 test_layer->PushPropertiesTo(impl_layer.get()); 2518 test_layer->PushPropertiesTo(impl_layer.get());
2496 2519
2497 EXPECT_EQ(2lu, impl_layer->element_id()); 2520 EXPECT_EQ(2lu, impl_layer->element_id());
2498 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties()); 2521 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties());
2499 } 2522 }
2500 2523
2501 } // namespace 2524 } // namespace
2502 } // namespace cc 2525 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl_unittest.cc ('k') | cc/layers/render_surface_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698