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

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

Issue 1405993008: compositor-worker: plumb element id and mutable properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix rebase error. Created 5 years 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.cc ('k') | cc/layers/layer_unittest.cc » ('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_impl.h" 5 #include "cc/layers/layer_impl.h"
6 6
7 #include "cc/animation/mutable_properties.h"
7 #include "cc/layers/painted_scrollbar_layer_impl.h" 8 #include "cc/layers/painted_scrollbar_layer_impl.h"
8 #include "cc/layers/solid_color_scrollbar_layer_impl.h" 9 #include "cc/layers/solid_color_scrollbar_layer_impl.h"
9 #include "cc/output/filter_operation.h" 10 #include "cc/output/filter_operation.h"
10 #include "cc/output/filter_operations.h" 11 #include "cc/output/filter_operations.h"
11 #include "cc/test/animation_test_common.h" 12 #include "cc/test/animation_test_common.h"
12 #include "cc/test/fake_impl_task_runner_provider.h" 13 #include "cc/test/fake_impl_task_runner_provider.h"
13 #include "cc/test/fake_layer_tree_host_impl.h" 14 #include "cc/test/fake_layer_tree_host_impl.h"
14 #include "cc/test/fake_output_surface.h" 15 #include "cc/test/fake_output_surface.h"
15 #include "cc/test/geometry_test_utils.h" 16 #include "cc/test/geometry_test_utils.h"
16 #include "cc/test/test_shared_bitmap_manager.h" 17 #include "cc/test/test_shared_bitmap_manager.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 190
190 // Special case: check that SetBounds changes behavior depending on 191 // Special case: check that SetBounds changes behavior depending on
191 // masksToBounds. 192 // masksToBounds.
192 root->SetMasksToBounds(false); 193 root->SetMasksToBounds(false);
193 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetBounds(gfx::Size(135, 246))); 194 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetBounds(gfx::Size(135, 246)));
194 root->SetMasksToBounds(true); 195 root->SetMasksToBounds(true);
195 // Should be a different size than previous call, to ensure it marks tree 196 // Should be a different size than previous call, to ensure it marks tree
196 // changed. 197 // changed.
197 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetBounds(arbitrary_size)); 198 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetBounds(arbitrary_size));
198 199
199 // Changing this property does not cause the layer to be marked as changed 200 // Changing these properties does not cause the layer to be marked as changed
200 // but does cause the layer to need to push properties. 201 // but does cause the layer to need to push properties.
201 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( 202 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE(
202 root->SetIsRootForIsolatedGroup(true)); 203 root->SetIsRootForIsolatedGroup(true));
203 204 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE(
204 // Changing these properties should cause the layer to need to push properties 205 root->SetElementId(2));
206 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE(
207 root->SetMutableProperties(kMutablePropertyOpacity));
205 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( 208 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE(
206 root->SetScrollParent(scroll_parent.get())); 209 root->SetScrollParent(scroll_parent.get()));
207 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( 210 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE(
208 root->SetScrollChildren(scroll_children)); 211 root->SetScrollChildren(scroll_children));
209 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( 212 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE(
210 root->SetClipParent(clip_parent.get())); 213 root->SetClipParent(clip_parent.get()));
211 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( 214 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE(
212 root->SetClipChildren(clip_children)); 215 root->SetClipChildren(clip_children));
213 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( 216 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE(
214 root->SetNumDescendantsThatDrawContent(10)); 217 root->SetNumDescendantsThatDrawContent(10));
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 373 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
371 layer->SetBackgroundFilters(arbitrary_filters)); 374 layer->SetBackgroundFilters(arbitrary_filters));
372 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetOpacity(arbitrary_number)); 375 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetOpacity(arbitrary_number));
373 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 376 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
374 layer->SetBlendMode(arbitrary_blend_mode)); 377 layer->SetBlendMode(arbitrary_blend_mode));
375 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 378 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
376 layer->SetIsRootForIsolatedGroup(true)); 379 layer->SetIsRootForIsolatedGroup(true));
377 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 380 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
378 layer->SetTransform(arbitrary_transform)); 381 layer->SetTransform(arbitrary_transform));
379 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size)); 382 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size));
383 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetElementId(2));
384 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
385 layer->SetMutableProperties(kMutablePropertyTransform));
380 } 386 }
381 387
382 TEST(LayerImplTest, SafeOpaqueBackgroundColor) { 388 TEST(LayerImplTest, SafeOpaqueBackgroundColor) {
383 FakeImplTaskRunnerProvider task_runner_provider; 389 FakeImplTaskRunnerProvider task_runner_provider;
384 TestSharedBitmapManager shared_bitmap_manager; 390 TestSharedBitmapManager shared_bitmap_manager;
385 TestTaskGraphRunner task_graph_runner; 391 TestTaskGraphRunner task_graph_runner;
386 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); 392 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d();
387 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 393 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
388 &task_graph_runner); 394 &task_graph_runner);
389 host_impl.SetVisible(true); 395 host_impl.SetVisible(true);
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 597
592 pending_layer->PushPropertiesTo(layer()); 598 pending_layer->PushPropertiesTo(layer());
593 599
594 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); 600 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset());
595 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), 601 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(),
596 pending_layer->CurrentScrollOffset()); 602 pending_layer->CurrentScrollOffset());
597 } 603 }
598 604
599 } // namespace 605 } // namespace
600 } // namespace cc 606 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/layers/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698