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

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: rebase 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
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/fake_impl_task_runner_provider.h" 12 #include "cc/test/fake_impl_task_runner_provider.h"
12 #include "cc/test/fake_layer_tree_host_impl.h" 13 #include "cc/test/fake_layer_tree_host_impl.h"
13 #include "cc/test/fake_output_surface.h" 14 #include "cc/test/fake_output_surface.h"
14 #include "cc/test/geometry_test_utils.h" 15 #include "cc/test/geometry_test_utils.h"
15 #include "cc/test/test_shared_bitmap_manager.h" 16 #include "cc/test/test_shared_bitmap_manager.h"
16 #include "cc/test/test_task_graph_runner.h" 17 #include "cc/test/test_task_graph_runner.h"
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 189
189 // Special case: check that SetBounds changes behavior depending on 190 // Special case: check that SetBounds changes behavior depending on
190 // masksToBounds. 191 // masksToBounds.
191 root->SetMasksToBounds(false); 192 root->SetMasksToBounds(false);
192 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetBounds(gfx::Size(135, 246))); 193 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetBounds(gfx::Size(135, 246)));
193 root->SetMasksToBounds(true); 194 root->SetMasksToBounds(true);
194 // Should be a different size than previous call, to ensure it marks tree 195 // Should be a different size than previous call, to ensure it marks tree
195 // changed. 196 // changed.
196 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetBounds(arbitrary_size)); 197 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetBounds(arbitrary_size));
197 198
198 // Changing this property does not cause the layer to be marked as changed 199 // Changing these properties does not cause the layer to be marked as changed
199 // but does cause the layer to need to push properties. 200 // but does cause the layer to need to push properties.
200 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( 201 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE(
201 root->SetIsRootForIsolatedGroup(true)); 202 root->SetIsRootForIsolatedGroup(true));
202 203 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE(
203 // Changing these properties should cause the layer to need to push properties 204 root->SetElementId(2));
205 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE(
206 root->SetMutableProperties(kMutablePropertyOpacity));
204 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( 207 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE(
205 root->SetScrollParent(scroll_parent.get())); 208 root->SetScrollParent(scroll_parent.get()));
206 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( 209 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE(
207 root->SetScrollChildren(scroll_children)); 210 root->SetScrollChildren(scroll_children));
208 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( 211 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE(
209 root->SetClipParent(clip_parent.get())); 212 root->SetClipParent(clip_parent.get()));
210 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( 213 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE(
211 root->SetClipChildren(clip_children)); 214 root->SetClipChildren(clip_children));
212 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( 215 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE(
213 root->SetNumDescendantsThatDrawContent(10)); 216 root->SetNumDescendantsThatDrawContent(10));
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 367 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
365 layer->SetBackgroundFilters(arbitrary_filters)); 368 layer->SetBackgroundFilters(arbitrary_filters));
366 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetOpacity(arbitrary_number)); 369 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetOpacity(arbitrary_number));
367 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 370 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
368 layer->SetBlendMode(arbitrary_blend_mode)); 371 layer->SetBlendMode(arbitrary_blend_mode));
369 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 372 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
370 layer->SetIsRootForIsolatedGroup(true)); 373 layer->SetIsRootForIsolatedGroup(true));
371 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 374 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
372 layer->SetTransform(arbitrary_transform)); 375 layer->SetTransform(arbitrary_transform));
373 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size)); 376 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size));
377 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetElementId(2));
378 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
379 layer->SetMutableProperties(kMutablePropertyTransform));
374 } 380 }
375 381
376 TEST(LayerImplTest, SafeOpaqueBackgroundColor) { 382 TEST(LayerImplTest, SafeOpaqueBackgroundColor) {
377 FakeImplTaskRunnerProvider task_runner_provider; 383 FakeImplTaskRunnerProvider task_runner_provider;
378 TestSharedBitmapManager shared_bitmap_manager; 384 TestSharedBitmapManager shared_bitmap_manager;
379 TestTaskGraphRunner task_graph_runner; 385 TestTaskGraphRunner task_graph_runner;
380 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); 386 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d();
381 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 387 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
382 &task_graph_runner); 388 &task_graph_runner);
383 host_impl.SetVisible(true); 389 host_impl.SetVisible(true);
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 591
586 pending_layer->PushPropertiesTo(layer()); 592 pending_layer->PushPropertiesTo(layer());
587 593
588 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); 594 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset());
589 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), 595 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(),
590 pending_layer->CurrentScrollOffset()); 596 pending_layer->CurrentScrollOffset());
591 } 597 }
592 598
593 } // namespace 599 } // namespace
594 } // namespace cc 600 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698